Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Special characters throw off the YAML frontmatter parser #24

Closed
mickael-menu opened this issue Apr 6, 2021 · 5 comments
Closed

Special characters throw off the YAML frontmatter parser #24

mickael-menu opened this issue Apr 6, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@mickael-menu
Copy link
Member

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 --interactive via cli, not abstracted out via zk.nvim) that does contain one of the above characters, these are throw into the preview area of fzf:

image

Originally posted by @megalithic in #22 (comment)

@mickael-menu mickael-menu added the bug Something isn't working label Apr 6, 2021
@mickael-menu
Copy link
Member Author

@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.

@mickael-menu
Copy link
Member Author

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"
---

@megalithic
Copy link

ahh, i will handle that post-haste in my own templates and configs. thank you!

@mickael-menu
Copy link
Member Author

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.

@github-actions
Copy link

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.

@github-actions github-actions bot added stale No recent activity and removed stale No recent activity labels Jan 23, 2022
@tjex tjex closed this as completed Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants