
com.vladsch.flexmark.ext.gfm.strikethrough.SubscriptExtension Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of flexmark-ext-gfm-strikethrough Show documentation
Show all versions of flexmark-ext-gfm-strikethrough Show documentation
flexmark-java extension for GFM strikethrough using ~~ (GitHub Flavored Markdown)
The newest version!
package com.vladsch.flexmark.ext.gfm.strikethrough;
import com.vladsch.flexmark.ext.gfm.strikethrough.internal.StrikethroughJiraRenderer;
import com.vladsch.flexmark.ext.gfm.strikethrough.internal.StrikethroughNodeRenderer;
import com.vladsch.flexmark.ext.gfm.strikethrough.internal.StrikethroughYouTrackRenderer;
import com.vladsch.flexmark.ext.gfm.strikethrough.internal.SubscriptDelimiterProcessor;
import com.vladsch.flexmark.html.HtmlRenderer;
import com.vladsch.flexmark.parser.Parser;
import com.vladsch.flexmark.util.data.MutableDataHolder;
import com.vladsch.flexmark.util.data.NullableDataKey;
import org.jetbrains.annotations.NotNull;
/**
* Extension for GFM strikethrough using ~~ (GitHub Flavored Markdown).
*
* Create it with {@link #create()} and then configure it on the builders
*
*
* The parsed strikethrough text regions are turned into {@link Strikethrough} nodes.
*
*/
public class SubscriptExtension implements Parser.ParserExtension, HtmlRenderer.HtmlRendererExtension {
final public static NullableDataKey SUBSCRIPT_STYLE_HTML_OPEN = StrikethroughSubscriptExtension.SUBSCRIPT_STYLE_HTML_OPEN;
final public static NullableDataKey SUBSCRIPT_STYLE_HTML_CLOSE = StrikethroughSubscriptExtension.SUBSCRIPT_STYLE_HTML_CLOSE;
private SubscriptExtension() {
}
public static SubscriptExtension create() {
return new SubscriptExtension();
}
@Override
public void rendererOptions(@NotNull MutableDataHolder options) {
}
@Override
public void parserOptions(MutableDataHolder options) {
}
@Override
public void extend(Parser.Builder parserBuilder) {
parserBuilder.customDelimiterProcessor(new SubscriptDelimiterProcessor());
}
@Override
public void extend(@NotNull HtmlRenderer.Builder htmlRendererBuilder, @NotNull String rendererType) {
if (htmlRendererBuilder.isRendererType("HTML")) {
htmlRendererBuilder.nodeRendererFactory(new StrikethroughNodeRenderer.Factory());
} else if (htmlRendererBuilder.isRendererType("YOUTRACK")) {
htmlRendererBuilder.nodeRendererFactory(new StrikethroughYouTrackRenderer.Factory());
} else if (htmlRendererBuilder.isRendererType("JIRA")) {
htmlRendererBuilder.nodeRendererFactory(new StrikethroughJiraRenderer.Factory());
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy