Metadata-Version: 2.1
Name: py-obsidianmd
Version: 0.1.2
Summary: python library for ObsidianMD
Home-page: https://github.com/selimrbd/py-obsidianmd
License: MIT
Author: Selim Raboudi
Author-email: selim.raboudi@gmail.com
Requires-Python: >=3.10,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Requires-Dist: hydra-core (>=1.2.0,<2.0.0)
Requires-Dist: python-frontmatter (>=1.0.0,<2.0.0)
Project-URL: Repository, https://github.com/selimrbd/py-obsidianmd
Description-Content-Type: text/markdown

Python utilities for the personal knowledge management tool [Obsidian](https://obsidian.md/)


## Motivation

I wanted to modify my notes' metadata in batch and couldn't find an existing plugin to do so.
If some of the functionalities you see here are already available in a plugin, please let me know.
Open for contributions.

## Current features

* Create a Note object from a file path, that has a 'frontmatter', 'metadata', and 'tags' attributes
* Add / remove tags from the note
* Write back the updated note to disk

## Warnings

* **This code hasn't been much tested yet**, use at your own peril
* **This code only handles tags present in the frontmatter**, not the note body

## Basic usage


```{python}
path = Path('path/to/file')
note = Note(path)

## print frontmatter
print(note.frontmatter)

## get the note's metadata (from frontmatter) as a dict
note.metadata

## get list of tags
print(note.tags)

## add a tag
note.add_tag('tag_name')

## remove a tag
note.remove_tag('tag_name')

## write the note with the updated metadata
note.write()
```

Original motivation: add a tag to all files in a folder

```{python}
import os
from pathlib import Path
from source.note import Note

path_dir = Path('path/to/dir')

for r,d,fls in os.walk(path_dir):
    for f in fls:
        pth = Path(r)/f
        note = Note(pth)
        note.add_tag('tag_name')
        note.write()
```

