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

com.vladsch.flexmark.superscript.SuperscriptExtension Maven / Gradle / Ivy

There is a newer version: 0.64.8
Show newest version
package com.vladsch.flexmark.superscript;

import com.vladsch.flexmark.Extension;
import com.vladsch.flexmark.html.HtmlRenderer;
import com.vladsch.flexmark.parser.Parser;
import com.vladsch.flexmark.superscript.internal.SuperscriptDelimiterProcessor;
import com.vladsch.flexmark.superscript.internal.SuperscriptJiraRenderer;
import com.vladsch.flexmark.superscript.internal.SuperscriptNodeRenderer;
import com.vladsch.flexmark.util.options.DataKey;
import com.vladsch.flexmark.util.options.MutableDataHolder;

/**
 * Extension for superscripts
 * 

* Create it with {@link #create()} and then configure it on the builders * ({@link com.vladsch.flexmark.parser.Parser.Builder#extensions(Iterable)}, * {@link com.vladsch.flexmark.html.HtmlRenderer.Builder#extensions(Iterable)}). *

*

* The parsed superscript text is turned into {@link Superscript} nodes. *

*/ public class SuperscriptExtension implements Parser.ParserExtension, HtmlRenderer.HtmlRendererExtension { public static final DataKey SUPERSCRIPT_STYLE_HTML_OPEN = new DataKey("SUPERSCRIPT_STYLE_HTML_OPEN", (String)null); public static final DataKey SUPERSCRIPT_STYLE_HTML_CLOSE = new DataKey("SUPERSCRIPT_STYLE_HTML_CLOSE", (String)null); private SuperscriptExtension() { } public static Extension create() { return new SuperscriptExtension(); } @Override public void rendererOptions(final MutableDataHolder options) { } @Override public void parserOptions(final MutableDataHolder options) { } @Override public void extend(Parser.Builder parserBuilder) { parserBuilder.customDelimiterProcessor(new SuperscriptDelimiterProcessor()); } @Override public void extend(HtmlRenderer.Builder rendererBuilder, String rendererType) { if (rendererType.equals("HTML")) { rendererBuilder.nodeRendererFactory(new SuperscriptNodeRenderer.Factory()); } else if (rendererType.equals("JIRA") || rendererType.equals("YOUTRACK")) { rendererBuilder.nodeRendererFactory(new SuperscriptJiraRenderer.Factory()); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy