Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-120722

markdown with yaml front matter is parsed wrong

    XMLWordPrintable

Details

    • 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.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            srutledg Shawn Rutledge
            srutledg Shawn Rutledge
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes