org.commonmark.ext.front.matter.YamlFrontMatterExtension Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commonmark-ext-yaml-front-matter Show documentation
Show all versions of commonmark-ext-yaml-front-matter Show documentation
commonmark-java extension for YAML front matter
package org.commonmark.ext.front.matter;
import org.commonmark.Extension;
import org.commonmark.ext.front.matter.internal.YamlFrontMatterBlockParser;
import org.commonmark.parser.Parser;
import org.commonmark.renderer.html.HtmlRenderer;
/**
* Extension for YAML-like metadata.
*
* Create it with {@link #create()} and then configure it on the builders
* ({@link org.commonmark.parser.Parser.Builder#extensions(Iterable)},
* {@link HtmlRenderer.Builder#extensions(Iterable)}).
*
*
* The parsed metadata is turned into {@link YamlFrontMatterNode}. You can access the metadata using {@link YamlFrontMatterVisitor}.
*
*/
public class YamlFrontMatterExtension implements Parser.ParserExtension {
private YamlFrontMatterExtension() {
}
@Override
public void extend(Parser.Builder parserBuilder) {
parserBuilder.customBlockParserFactory(new YamlFrontMatterBlockParser.Factory());
}
public static Extension create() {
return new YamlFrontMatterExtension();
}
}