xwmx / nb

CLI and local web plain text note‑taking, bookmarking, and archiving with linking, tagging, filtering, search, Git versioning & syncing, Pandoc conversion, + more, in a single portable script.
https://xwmx.github.io/nb
GNU Affero General Public License v3.0
6.43k stars 180 forks source link

[BUG] `yaml` title with `:` symbol brake `gui` #308

Closed foozzi closed 3 months ago

foozzi commented 4 months ago

For example, try to create a note with content like:

---
title: 20240228205831 - My Neovim Zettelkasten: How I Take Notes in Markdown Using Vim and Bash | Mischa van den Burg
public: false
date: 2024-02-29T01:58:32.567040+00:00
id: 20240228205831
---

# How I Take Notes in Markdown Using Vim and Bash | Mischa van den Burg

<https://mischavandenburg.com/zet/neovim-zettelkasten/>

A problem in the yaml section

When I start the gui mode, my note will not be displayed.

If I remove : from My Neovim Zettelkasten: How I Take Notes in Markdown Using Vim and Bash | Mischa van den Burg - it works properly

UPD: I've tested pandoc exporting with this file and have got the output

nb export 03-bookmarks:10 ./test222.html
YAML parse exception at line 1, column 27:
mapping values are not allowed in this context

So, I can't find where nb renders a page with with pandoc, but I think it will be a good idea to make this title around quotes before converting

xwmx commented 3 months ago

@foozzi This appears to be occurring because the title isn't quoted, and YAML treats the colon : as special "indicator" character that has to be quoted in some cases. I added a test demonstrating that quoting the title eliminates the error and allows the item to be processed. Currently, I don't see an easy way to handle this error beyond what's already happening, so I haven't made any changes to nb.