Class YamlFrontMatterExtension
- All Implemented Interfaces:
org.commonmark.Extension,org.commonmark.parser.Parser.ParserExtension,org.commonmark.renderer.markdown.MarkdownRenderer.MarkdownRendererExtension
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.
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.commonmark.Extensioncreate()static org.commonmark.Extensioncreate(FrontMatterParser.Factory parser) voidextend(org.commonmark.parser.Parser.Builder parserBuilder) voidextend(org.commonmark.renderer.markdown.MarkdownRenderer.Builder rendererBuilder)
-
Method Details
-
extend
public void extend(org.commonmark.parser.Parser.Builder parserBuilder) - Specified by:
extendin interfaceorg.commonmark.parser.Parser.ParserExtension
-
create
public static org.commonmark.Extension create() -
create
-
extend
public void extend(org.commonmark.renderer.markdown.MarkdownRenderer.Builder rendererBuilder) - Specified by:
extendin interfaceorg.commonmark.renderer.markdown.MarkdownRenderer.MarkdownRendererExtension
-