Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/selimrbd/py-obsidianmd
Python interface to your Obsidian notes
https://github.com/selimrbd/py-obsidianmd
Last synced: about 2 months ago
JSON representation
Python interface to your Obsidian notes
- Host: GitHub
- URL: https://github.com/selimrbd/py-obsidianmd
- Owner: selimrbd
- License: bsd-3-clause
- Created: 2021-11-07T16:17:33.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-24T17:39:13.000Z (over 1 year ago)
- Last Synced: 2024-11-13T11:09:17.770Z (about 2 months ago)
- Language: Python
- Homepage:
- Size: 7.38 MB
- Stars: 273
- Watchers: 10
- Forks: 22
- Open Issues: 22
-
Metadata Files:
- Readme: Readme.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
Awesome Lists containing this project
- project-awesome - selimrbd/py-obsidianmd - Python interface to your Obsidian notes (Python)
- jimsghstars - selimrbd/py-obsidianmd - Python interface to your Obsidian notes (Python)
README
# py-obsidianmd
A python library for modifying [Obsidian](https://obsidian.md/) notes in batch.
See the [full documentation](https://selimrbd.github.io/py-obsidianmd/)
:warning: **Consider backing up your vault** before using the library, to avoid any risk of data loss. You can test the library on this [example vault](https://github.com/selimrbd/example-vault)
## Presentation video
[![Watch the video](https://img.youtube.com/vi/gRPBAKiu37Y/hqdefault.jpg)](https://www.youtube.com/watch?v=gRPBAKiu37Y)
## Quickstart
```bash
pip install py-obsidianmd
``````python
from pathlib import Path
from pyomd import Notes
from pyomd.metadata import MetadataTypepath_dir = Path('/path/to/obsidian/folder')
notes = Notes(path_dir)
```## move metadata between frontmatter and inline
```python
notes.metadata.move(fr=MetadataType.FRONTMATTER, to=MetadataType.INLINE)
notes.update_content(inline_inplace=False, inline_position="top", inline_tml="standard") #type: ignore
notes.write()
```
![](./docs/docs/assets/example-gifs/pyomd-1.gif)## regroup inline metadata inside a callout
```python
notes.update_content(inline_inplace=False, inline_position="top", inline_tml="callout") #type: ignore
notes.write()
```
![](./docs/docs/assets/example-gifs/pyomd-2.gif)## add and remove metadata
```python
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()
```
![](./docs/docs/assets/example-gifs/pyomd-3.gif)## License
[BSD 3](LICENSE.txt)
## 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 issueFor more details, see the [contribution guidelines](CONTRIBUTING.md).
## Support
If you found this library useful and wish to support it's development, you can do so using the links below (paypal or Ko-fi). Thanks a bunch !