Metadata-Version: 2.1
Name: py-obsidianmd
Version: 0.1.4
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: python-frontmatter (>=1.0.0,<2.0.0)
Project-URL: Repository, https://github.com/selimrbd/py-obsidianmd
Description-Content-Type: text/markdown

# py-obsidianmd

A python library for [ObsidianMD](https://obsidian.md/) for modifying your notes in batch.

:warning: **Consider backing up your vault** before using the library, to avoid any risk of data loss.


## Quickstart

```bash
pip install py-obsidianmd
```

```python
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](https://github.com/selimrbd/example-vault)

## move metadata between frontmatter and inline

```python
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()
```
![](./docs/imgs/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/imgs/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/imgs/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 issue

For more details, see the [contribution guidelines](CONTRIBUTING.md).

## Support
<a href="https://www.paypal.com/donate/?hosted_button_id=R5NYTS46CQMSS"><img src="./docs/imgs/donate-paypal.png" width="150" height="100" /></a>
<br>
<a href="https://ko-fi.com/selimrbd"><img src="./docs/imgs/support-kofi.png" width="200" height="50" /></a>
