dendronhq / dendron

The personal knowledge management (PKM) tool that grows as you do!
https://wiki.dendron.so
Apache License 2.0
6.68k stars 252 forks source link

User tag in yaml frontmatter breaks preview #3614

Open pedrolimasi opened 2 years ago

pedrolimasi commented 2 years ago

Please select the area your bug applies to.

Describe the bug

User tag in yaml frontmatter breaks preview. Adding a user tag will freeze the preview if its already open, or the preview will lock in buffering if you try to launch it.

Backlinks appear to work normally though.

To Reproduce

MWE:

---
id: oeisf4b85cnljmho66kk8fq
title: Paper title
desc: 'Reading notes'
updated: 1664485041841
created: 1664479886525
PaperAuthors:
  - @Ana
  - Bob
  - Carl
---

Lorem ipsum

Desktop (please complete the following information)

Additional context

I wanted to push some user mentions to the yaml frontmatter so that the notes are linked, but I don't necessarily need this linking to occupy the text body. This, however, breaks the preview. It may not be a big deal on its own, but it may be a symptom of a limitation in the frontmatter parsing by Dendron.

If this is by design, is it documented anywhere? I couldn't find it.

hikchoi commented 1 year ago

Thank you for the report.

Apologies for the confusion. This is an issue we are aware of internally but is not documented well for the public.

The issue arises due to the fact that yaml (frontmatter) does not allow the special symbol @ in plain values. Unfortunately bending the rules of the yaml specification and writing a custom parser for this is a bit involved.

If this is by design, is it documented anywhere? I couldn't find it.

It is not by design. I would say that the limitation in the yaml specification / the use of user tags in frontmatter was not under our radar when we decided @ is the syntax for user tags.

For the time being, the only way to use the @ syntax is to wrap everything in a quote which makes user tags pointless. You can instead opt not to user the user tag syntax and use wikilinks in frontmatter, which works as expected.

We'll discuss how this should be handled and let you know when we make any progress on this matter.