org.commonmark.ext.front.matter.YamlFrontMatterExtension Maven / Gradle / Ivy
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();
}
}