zk
zk copied to clipboard
Special characters throw off the YAML frontmatter parser
It looks like using special characters in the YAML frontmatter or note titles might be breaking the indexing.
Ahh, I'm wondering if certain characters in a filename or title might be breaking completion?
|,:, and&are command items in some of my note file names and titles (i auto-extract calendar titles and use those from meeting note generation and pass that along to zk.nvim to generate the note, or open an existing note with the same file name).When searching for a note (using
zk edit --interactivevia cli, not abstracted out via zk.nvim) that does contain one of the above characters, these are throw into the preview area of fzf:
Originally posted by @megalithic in https://github.com/mickael-menu/zk/issues/22#issuecomment-814347167
@megalithic From the logs you shared, I think it's the content of the YAML frontmatter failing with these notes. Would you mind sharing the content of one of these notes up to the first heading? Redacted if you prefer.
Btw such errors might be visible only after modifying these notes. You can force reindexing the notes with zk index --force to see all the errors found when parsing your notebook.
I can reproduce this warning:
zk: warning: yaml: mapping values are not allowed in this context
with the following frontmatter:
---
title: A title with: special characters
---
But it's not valid YAML, if it contains a : the title must be surrounded by double quotes to produce a valid string, this works:
---
title: "A title with: special characters"
---
ahh, i will handle that post-haste in my own templates and configs. thank you!
Okay let me know if you have any other warnings after fixing your templates, and then I'll close this issue. I'm not sure there's anything to do in zk at the moment.
YAML is annoyingly ambiguous, I wish another format was more widespread for Markdown frontmatters. I'm thinking we could fallback on MultiMarkdown parsing, but it doesn't support lists for tags.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs in the next 5 days.
