Skip to content

change: quote default literatureNoteContentTemplate#126

Open
eddieantonio wants to merge 1 commit intohans:masterfrom
eddieantonio:patch-1
Open

change: quote default literatureNoteContentTemplate#126
eddieantonio wants to merge 1 commit intohans:masterfrom
eddieantonio:patch-1

Conversation

@eddieantonio
Copy link
Copy Markdown

The default value of literatureNoteContentTemplate will generate YAML front matter that is often broken by special YAML characters. For instance, a colon (:) in the {{title}} will cause a syntax error in YAML. This adds quotes around both {{title}} and {{authorString}} in an attempt to remedy the easily-broken default.

For example, I created a literature note which contains a colon in the title. This is the result using the previous default template:

---
title: Ontology development 101: A guide to creating your first ontology
authors: Natalya F. Noy, Deborah L. McGuinness
year: 2001
---

(try this snippet in YAML Lint!)

Obsidian presents this as "Metadata (invalid YAML)" in the preview:

The message within Obsidian reading "Metadata (invalid YAML)"

After the change, the front matter is as follows:

---
title: "Ontology development 101: A guide to creating your first ontology"
authors: "Natalya F. Noy, Deborah L. McGuinness"
year: 2001
---

After this change, the default is no longer broken by the titles containing colons or other YAML syntax.

Note: this may be considered a breaking change, as it changes the defaults of the plugin.

Fixes #117
Addresses #89

The default value of `literatureNoteContentTemplate` will generate YAML front matter that is often broken by special YAML characters. For instance, a colon (`:`) in the {{title}} will cause a syntax error in YAML. This adds quotes around both `{{title}}` and `{{authorString}}` in an attempt to remedy the easily-broken default.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[QoL REQUEST] Default Literature Note template currently becomes invalid YAML

1 participant