apple/swift-markdown

Plans to support Markdown Metadata / YAML Front Matter?

Opened this issue ยท 3 comments

Many Markdown parsing engines have adopted Metadata parsing as well, which is usually written as a YAML block at the top of a document, popularized by Jekyll (as far as I'm aware): https://jekyllrb.com/docs/front-matter/

As an example, the popular Swift Markdown library Ink also includes automatic parsing.

Xcode also uniquely highlights YAML at the top of a Markdown file.

I'm wondering if there are plans to support this within the swift-markdown repository, and if not, what the proper way would be to extend the swift-markdown library for doing this? Currently, I'm fetching the document, stripping the YAML from it, then parsing the YAML and Markdown separately.

Thanks!

I'm also interested in this for my blog. I find swift-markdown a great libray to parse and manipulate markdown in a structured way, so I was hoping to replace the current markdown parser I use for this. It would be very interesting if it supported front-matter out of the box.

Right now, at least in my tests, it gets parsed as a ThematicBreak followed by Heading level: 2.

I would highly welcome this feature

I'm also keen to see this addition โ€“ thank you!