Class YamlFrontMatterExtension
- All Implemented Interfaces:
Extension,Parser.ParserExtension,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.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateYamlFrontMatterExtension(FrontMatterParser.Factory frontMatterParserFactory) -
Method Summary
Modifier and TypeMethodDescriptionstatic Extensioncreate()static Extensioncreate(FrontMatterParser.Factory parser) voidextend(Parser.Builder parserBuilder) voidextend(MarkdownRenderer.Builder rendererBuilder) Extend Markdown rendering, usually by registering custom node renderers usingMarkdownRenderer.Builder.nodeRendererFactory(org.commonmark.renderer.markdown.MarkdownNodeRendererFactory).
-
Field Details
-
frontMatterParserFactory
-
-
Constructor Details
-
YamlFrontMatterExtension
-
-
Method Details
-
extend
- Specified by:
extendin interfaceParser.ParserExtension
-
create
-
create
-
extend
Description copied from interface:MarkdownRenderer.MarkdownRendererExtensionExtend Markdown rendering, usually by registering custom node renderers usingMarkdownRenderer.Builder.nodeRendererFactory(org.commonmark.renderer.markdown.MarkdownNodeRendererFactory).- Specified by:
extendin interfaceMarkdownRenderer.MarkdownRendererExtension- Parameters:
rendererBuilder- the renderer builder to extend
-