Class YamlFrontMatterExtension

java.lang.Object
org.commonmark.ext.front.matter.YamlFrontMatterExtension
All Implemented Interfaces:
Extension, Parser.ParserExtension, MarkdownRenderer.MarkdownRendererExtension

public class YamlFrontMatterExtension extends Object implements Parser.ParserExtension, MarkdownRenderer.MarkdownRendererExtension
Extension for YAML-like metadata.

Create it with create() and then configure it on the builders (Parser.Builder.extensions(Iterable), HtmlRenderer.Builder.extensions(Iterable)).

By default, the extension parses the subset of YAML with a built-int YamlSubsetParser. The parsed metadata is turned into YamlFrontMatterNode. You can access the metadata using YamlFrontMatterVisitor.readData(Node).

Alternatively, you can create the extension with RawContentParser.Factory. It turns the YAML front matter into YamlFrontMatterRawContent node, which stores the entire front matter as a string. You can access the content with YamlFrontMatterVisitor.readRawContent(Node) to process it with other tools.

Implement FrontMatterParser interface and the corresponding factory to parse the front matter with a custom parser.