Pandoc-Markdown-Style YAML-Frontmatter

I am using quite a lot of pandoc-markdown including it’s YAML-frontmatters. I am also using a variety of text editors to edit these files. One of these is abricotine, which is based on CodeMirror.

It would therefore be great to see improved support for pandoc’s YAML-frontmatters in CodeMirror. I thought I’d first ask in the forums to see how my suggestions are received. I would be willing take this to github (feature request, maybe eventually a pull request), if you guys like the ideas. Here’s a quick description of what I am missing in CodeMirror’s YAML-frontmatter support.

Closing Frontmatters

Pandoc allows frontmatters to be closed with either --- or .... Thus, the following is a valid frontmatter for pandoc:

author: John Doe
title: Some Title

Markdown text goes *here*.

Some markdown editors don’t include any frontmatter support (such as ghostwriter, for instance). I therefore like to use the ... syntax for closing frontmatters, so they don’t mistake the last line for a heading. Unfortunately, using abricotine (an editor based on CodeMirror), the above code is interpreted as a document containing only a frontmatter. I believe that just allowing to close frontmatters with ... wouldn’t hurt, since ... isn’t valid YAML anyway and would therefore not occur in frontmatters that don’t use this pandoc-markdown feature.

Including Frontmatters Anywhere

Pandoc also allows frontmatters to be included anywhere in the document. Thus, the following is also a valid frontmatter in pandoc-markdown:

Some initial paragraph in markdown.

author: Jane Doe
title: Some Title

Some more markdown.

I’m not entirely sure, if adding this feature to codemirror might be overkill, since it might possibly conflict with some other markdown dialects. The above code could easily be taken to mean the following:

<p>Some initial paragraph in markdown.</p>
<hr />
<p>author: Jane Doe</p>
<h2>title: Some Title</h2>
<p>Some more markdown.</p>

Maybe it’s possible to add inline YAML-frontmatters (YAML-midmatters, if you will, or maybe even YAML-backmatters) as an optional feature or something? Any suggestions on this are appreciated.

A PR to allow dots would probably be okay. I’m not sure about allowing this anywhere, since as you say that might kick in unintentionally.

Great, thanks! I opened a pull request regarding closing frontmatters with ...: