All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.commonmark.ext.ins.InsExtension Maven / Gradle / Ivy

There is a newer version: 0.17.0
Show newest version
package org.commonmark.ext.ins;

import org.commonmark.Extension;
import org.commonmark.ext.ins.internal.InsDelimiterProcessor;
import org.commonmark.ext.ins.internal.InsNodeRenderer;
import org.commonmark.renderer.html.HtmlNodeRendererContext;
import org.commonmark.renderer.html.HtmlNodeRendererFactory;
import org.commonmark.parser.Parser;
import org.commonmark.renderer.html.HtmlRenderer;
import org.commonmark.renderer.NodeRenderer;

/**
 * Extension for ins using ++
 * 

* 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 ins text regions are turned into {@link Ins} nodes. *

*/ public class InsExtension implements Parser.ParserExtension, HtmlRenderer.HtmlRendererExtension { private InsExtension() { } public static Extension create() { return new InsExtension(); } @Override public void extend(Parser.Builder parserBuilder) { parserBuilder.customDelimiterProcessor(new InsDelimiterProcessor()); } @Override public void extend(HtmlRenderer.Builder rendererBuilder) { rendererBuilder.nodeRendererFactory(new HtmlNodeRendererFactory() { @Override public NodeRenderer create(HtmlNodeRendererContext context) { return new InsNodeRenderer(context); } }); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy