Cimbali/markdown-viewer

Support YAML front matters

af4jm opened this issue · 3 comments

af4jm commented

YAML front matters (as used by assemble, hugo [static website renderers], zettlr, obsidian [editors/note-taking tools], and pandoc) should either be ignored, or treated as metadata (rendered possibly as a table, or possibly in the box with the Contents).

rendering it as a header also has the side effect that, because there is no <title> tag & the first header becomes the title, that the raw YAML (with line breaks stripped) becomes the text in the browser tab.

an example front matter & first header from a file that is notes from reading a book... in this case the ideal title would be Supernatural, Michael Heiser (2015) but it's actually citekey: heiserSupernaturalWhatBible2015 ebook: - https://read.amazon.com/?_encoding=UTF8&asin=B016LT2YHA

---
citekey: heiserSupernaturalWhatBible2015
ebook:
    - https://read.amazon.com/?_encoding=UTF8&asin=B016LT2YHA
---

# *Supernatural*, Michael Heiser (2015)

Where are YAML front matters defined? It’s definitely not plain markdown. If there is a renderer extension for it it’s easy enough to add.

ParkSB/markdown-it-front-matter would probably do the trick though it seems not to render the content of the front matters.

forgot about this, but there is a kind-of work-around that I found for this issue... I add a blank line before the --- that ends the front matter... then it at least doesn't get interpreted as a Markdown header, so the front matter renders as pain text between 2 line breaks... still not great, but better than borking it into a top-level header