You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's definitely not a commonly-used feature,1 but when Pandoc's standard YAML-metadata extension is enabled, it actually supports metadata being included further into the document:
---frontmatter: ping---
Text
---
middlematter: ping
---
Even more text
Pandoc is probably one of the few tools which does support this interleaving (oddly enough, Github supports it when it's closed with --- but not with ..., even though both are legal for the first block) and the dashes could technically be legally interpreted as a horizontal rule, so it might need to be gated behind second option in addition to g:vim_markdown_frontmatter to support people writing for those other tools who did intend for middlematter: ping to be a second body paragraph after a horizontal rule.
I'm not well-versed in writing Vim syntax (my efforts at editing the existing definition have only resulted in the start-of-file block breaking in one manner or another, and have had no effect on the second block) so I can't offer worked code, but the rules would probably need to be:
If the --- are the entire first line of the document
or are preceded by a blank line (to separate it from a setext heading) and are followed by a non-blank line (to separate it from a horizontal rule)2
then highlight as YAML until the closing --- or ...; otherwise highlight only the dashes as a horizontal rule.
Footnotes
The only reason I'm wanting to is because I'm trying to include computer-processable data alongside the human-readable Markdown describing it, and would prefer to write both beside each other in the same section rather than having multiple screens of metadata at the start of the file, and then multiple more screens of unrelated text before the place it's finally talked about. ↩
This limitation isn't mentioned in the Pandoc manual, but is the only reasonable way to determine how to highlight things without a lot of lookahead; and in fact Pandoc is implemented to require that non-blank line itself, that's just not in the documentation. (It also actually requires a non-blank line after the dashes even in the first block of the file, but since we're highlighting Markdown+YAML here and not specifically Pandoc, we should probably keep the current lenient syntax for start-of-file frontmatter in case other implementations aren't as picky there.) ↩
The text was updated successfully, but these errors were encountered:
This might be a better fit on vim-pandoc-syntax which specifically targets PFM while this plugin hasn't even really worked out what it does target, but in any case contributions are welcome.
It's definitely not a commonly-used feature,1 but when Pandoc's standard YAML-metadata extension is enabled, it actually supports metadata being included further into the document:
Pandoc is probably one of the few tools which does support this interleaving (oddly enough, Github supports it when it's closed with
---
but not with...
, even though both are legal for the first block) and the dashes could technically be legally interpreted as a horizontal rule, so it might need to be gated behind second option in addition tog:vim_markdown_frontmatter
to support people writing for those other tools who did intend formiddlematter: ping
to be a second body paragraph after a horizontal rule.I'm not well-versed in writing Vim syntax (my efforts at editing the existing definition have only resulted in the start-of-file block breaking in one manner or another, and have had no effect on the second block) so I can't offer worked code, but the rules would probably need to be:
---
are the entire first line of the document---
or...
; otherwise highlight only the dashes as a horizontal rule.Footnotes
The only reason I'm wanting to is because I'm trying to include computer-processable data alongside the human-readable Markdown describing it, and would prefer to write both beside each other in the same section rather than having multiple screens of metadata at the start of the file, and then multiple more screens of unrelated text before the place it's finally talked about. ↩
This limitation isn't mentioned in the Pandoc manual, but is the only reasonable way to determine how to highlight things without a lot of lookahead; and in fact Pandoc is implemented to require that non-blank line itself, that's just not in the documentation. (It also actually requires a non-blank line after the dashes even in the first block of the file, but since we're highlighting Markdown+YAML here and not specifically Pandoc, we should probably keep the current lenient syntax for start-of-file frontmatter in case other implementations aren't as picky there.) ↩
The text was updated successfully, but these errors were encountered: