python library for ObsidianMD
Project description
py-obsidianmd
A python library for ObsidianMD for modifying your notes in batch.
:warning: Consider backing up your vault before using the library, to avoid any risk of data loss.
Quickstart
pip install py-obsidianmd
from pathlib import Path
from pyomd import Notes
from pyomd.metadata import MetadataType
path_dir = Path('/path/to/obsidian/folder')
notes = Notes(path_dir)
You can test the library on this example vault
move metadata between frontmatter and inline
notes.metadata.move(fr=MetadataType.FRONTMATTER, to=MetadataType.INLINE)
notes.update_content(inline_position="top", inline_tml="callout", inline_inplace=False) #type: ignore
notes.write()
regroup inline metadata inside a callout
notes.update_content(inline_inplace=False, inline_position="top", inline_tml="callout") #type: ignore
notes.write()
add and remove metadata
notes.filter(has_meta=[("tags", "type/book", MetadataType.INLINE)])
notes.metadata.add(k="type", l="[[book]]", meta_type=MetadataType.INLINE)
notes.metadata.remove(k="tags", l="type/book", meta_type=MetadataType.INLINE)
notes.update_content(inline_inplace=False, inline_position="top", inline_tml="callout") #type: ignore
notes.write()
License
Contributing
Contributions are welcome ! Different ways you can contribute:
- Write an issue: report a bug, suggest an enhancement, ...
- Submit a pull request to solve an open issue
For more details, see the contribution guidelines.
Support
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
py-obsidianmd-0.1.6.tar.gz
(13.3 kB
view hashes)
Built Distribution
Close
Hashes for py_obsidianmd-0.1.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96dc2402bf38fb9140a0aaa7de228391d6919f3b0f0841fc3f362d28b3be2f3c |
|
MD5 | 1eeba3be6bacb2996a90591dfd53eaf7 |
|
BLAKE2b-256 | 36fe2bb13f9cbf4f2e3440fb84c12d7acf11d17fa13ea99b80b53aeaf87219d7 |