selimrbd / py-obsidianmd

Python interface to your Obsidian notes
BSD 3-Clause "New" or "Revised" License
262 stars 21 forks source link

Skip notes with bad metadata #14

Open matthewturk opened 1 year ago

matthewturk commented 1 year ago

Hi! I use the built-in template engine for daily notes, which leads to having files including frontmatter like:

date: {{date:YYYY-MM-DD}}

But this doesn't parse, because python-frontmatter uses SafeLoader for the YAML loader, and it tries to make these into mappings/embeddings. I'm wondering if it would be possible to have an option to either exclude some directories when creating Notes at the root level of a vault, or to have a allow_errors (or something) option such that if it's set to True it would either skip adding those notes to the Notes object or add them without their metadata.

(On the other hand, perhaps I am doing something very wrong here in having these template variables? But that seems like it's unrelated to py-obsidianmd :smile: )

matthewturk commented 1 year ago

As a note, I was able to address this by changing how I set up my templates -- feel free to close this, as I can work around it and still use pyomd.