Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.0, 6.7.0 RC
-
bffddc6a9 (dev) 3bd4c1b670b8b973e8a782bcaec7078027f6ea36, 81f174d79 (dev)
Description
The tradition of prepending "front matter" like
--- key: value ---
in front of markdown began with https://jekyllrb.com/docs/front-matter/ it seems. But now the idea has spread, so that it begins to be seen as the normal way to add metadata to markdown files.
https://docs.github.com/en/contributing/writing-for-github-docs/using-yaml-frontmatter
https://github.com/readthedocs/commonmark.py/issues/208
https://assemble.io/docs/YAML-front-matter.html
I raised this as an issue for md4c: https://github.com/mity/md4c/issues/209 but the author there thinks that front matter should always be stripped out (because it's not really markdown) before giving it to the markdown parser. So perhaps we should do that; and I think we should also keep it intact in QTD somehow, so that QTextMarkdownWriter can re-write it verbatim when the file is saved. It's not directly useful to Qt because we don't have a yaml parser; but it may be useful to applications.
Currently, the parser sees one thematic break (horizontal rules) and for some reason turns the yaml into an H2 heading (at least in the case that there's only one line of yaml). So it at least needs to be stripped out to avoid mis-parsing.