Steps to reproduce the problem (provide example Markdown if applicable):
I want to strip markdown to plain text.
This is my code:
String markdownFilter(String markdown) {
Renderer textRender = TextContentRenderer.builder()
.extensions(Arrays.asList(
StrikethroughExtension.create(),
AutolinkExtension.create(),
InsExtension.create(),
HeadingAnchorExtension.create())
).build();
Parser parser = Parser.builder().build();
String plainText = markdown;
try {
plainText = textRender.render(parser.parse(markdown));
} catch (Exception e) {
log.error("markdown to plain text failed: " + markdown, e);
}
return plainText;
}
I tested ~makdown~, ++markdown++, # markdown.
Expected behavior:
return markdown, markdown, markdown, separately.
Actual behavior:
return~markdown~, ++markdown++, markdown, separately.
~markdown~, ++markdown++ don't change.
# markdown stripped to markdown.
I noticed these words in README.md:
Extensions need to extend the parser, or the HTML renderer, or both.
So do extensions support text render? If not, how can I strip strike through and other extensions?
(Also see what the reference implementation does: https://spec.commonmark.org/dingus/)
Steps to reproduce the problem (provide example Markdown if applicable):
I want to strip markdown to plain text.
This is my code:
I tested
~makdown~,++markdown++,# markdown.Expected behavior:
return
markdown,markdown,markdown, separately.Actual behavior:
return
~markdown~,++markdown++,markdown, separately.~markdown~,++markdown++don't change.# markdownstripped tomarkdown.I noticed these words in README.md:
So do extensions support text render? If not, how can I strip strike through and other extensions?
(Also see what the reference implementation does: https://spec.commonmark.org/dingus/)