This is a follow-up to YAML Fontmatter syntax highlighter has issues with quotes, which was moved to the graveyard with the reply “This doesn’t happen anymore” and then closed automatically. It still happens in Source mode. In Live Preview the Properties widget hides the front matter text, so the highlighting cannot be seen there, which may be why it looked fixed.
Steps to reproduce
-
Create a note with this text:
--- problem1: Single quote ' and YAML syntax highlighter problem2: "Escaping quotes \" and YAML syntax highligher" after: plain --- text -
Switch the note to Source mode.
Did you read and follow the Troubleshooting Guide ? [Yes/No]
Yes. It reproduces in a fresh vault with no plugins, theme or snippets.
Expected result
Both values are styled the way YAML reads them:
problem1is a plain scalar. The'in the middle of it does not start a string, so nothing on that line is styled as a string.problem2is one double-quoted string.\"is an escaped quote, so the string runs to the last"on the line.
Actual result
problem1:Single quoteis plain, then everything from the'to the end of the line,' and YAML syntax highlighter, is styled as a string (cm-string).problem2: the string ends at the escaped quote."Escaping quotes \"is styled as a string,and YAML syntax highligheris plain, and the final"is styled as the start of a new string.after: plainon the next line is unaffected.
Reading view gets this right. The front matter it renders for the same note is highlighted with problem1 plain and the whole of problem2 as one string.
Workaround for links in front matter: my plugin Frontmatter Markdown Links reads quoted values the way YAML does, both escapes included, so the links it shows in Source mode are not thrown off by this. The highlighting itself is still wrong.
Environment
SYSTEM INFO:
Obsidian version: 1.14.5
Installer version: 1.14.5
Operating system: Windows 11 Pro 10.0.26300
Login status: not logged in
Language: en
Insider build toggle: off
Live preview: on
Base theme: adapt to system
Community theme: none
Snippets enabled: 0
Restricted mode: off
Plugins installed: 0
Plugins enabled: 0
RECOMMENDATIONS:
none