Skip to content

skip yaml (front matter)? #209

@ec1oud

Description

@ec1oud

Markdown can have yaml headers (yeah it's not in commonmark, maybe not a good idea either... but it happened). I think maybe md4c should skip parsing of "front matter" but also make it available for further parsing with a yaml parser. I.e. if the first line of the file is just three hyphens, that's a special case, not a thematic break, and everything from there until the next line with three hyphens can be assumed to be front matter. (I guess someone was thinking that nobody starts a document with a thematic break, so it can be treated as a special case.) But I'm not sure where's the most-formal specification (to verify that it must begin on the first line, must be three hyphens, and so on).

https://docs.github.com/en/contributing/writing-for-github-docs/using-yaml-frontmatter
https://jekyllrb.com/docs/front-matter/
readthedocs/commonmark.py#208
https://assemble.io/docs/YAML-front-matter.html

ATM I'm trying to figure out what Qt should do with this, since it's currently a mess if you give such a document to https://doc-snapshots.qt.io/qt6-6.7/qml-qtquick-textdocument.html#source-prop I figured if md4c would give me that chunk, I can stash it away somehow so that QTextMarkdownWriter can re-write it verbatim when the file is saved; but Qt doesn't have a yaml parser, so an application that cares about that might need to subclass QTextDocument, retrieve the saved front-matter string, and parse it with https://github.com/jbeder/yaml-cpp or something like that. But QTD won't even skip it yet, so it's going to be a bit less convenient for now.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions