Cimbali / markdown-viewer

Markdown (.md) file viewer WebExtension for your browser.
Other
156 stars 29 forks source link

Support YAML front matters #97

Open af4jm opened 1 year ago

af4jm commented 1 year ago

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)
Cimbali commented 1 year ago

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.

Cimbali commented 1 year ago

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

af4jm commented 2 weeks ago

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