mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-06 21:36:15 +00:00
YAML front matter #44
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mcnameej on GitHub (Jul 14, 2016).
Enhancement request
Add support for YAML front matter.
The immediate need is for markdig to recognize and ignore any front matter. Don't try to parse it as Markdown text. Perhaps in the future markdig may find some use for the data.
If you can provide some hints about where this would need to happen in the markdig code, I might be able to add it myself and submit a PR.
(For what it's worth, I'm no fan of YAML, but it seems to be the most common way of adding metadata to Markdown files.)
@xoofx commented on GitHub (Jul 14, 2016):
I'm wondering in which particular usecase you would need this? Typically, a frontmatter is handled at a higher level by the compositing engine (e.g Jekyll, Hugo...etc.) and they use a YAML parser to pre-parse the frontmatter (without interpreting the md document), because a YAML parser is able to understand the document split
---, they stop on the second one as they know that the rest of the document will be of the type of the file extension. As a frontmatter is often used for other type of files (HTML, even css...etc.), you don't want to add frontmatter handling to the HTML parser or the CSS parser... so it should be basically the same for md.@mcnameej commented on GitHub (Jul 14, 2016):
It's all about the Visual Studio MarkdownEditor, which uses markdig. I want to be able to edit MD files that have YAML front matter, while not having it disrupt the preview in VS.
@xoofx commented on GitHub (Jul 14, 2016):
Thanks, that makes more sense in this case. Without handling pure YAML parsing (it would simply try to find the
---pattern at the beginning of a line), it should not be much difficult to add this... though there are no extension that work only at a pre-processor level, so it will require a bit more thinking on how to integrate this.@xoofx commented on GitHub (Sep 19, 2016):
The feature is implemented in commit
f0ea008