AsteriskDelimiterProcessor and UnderscoreDelimiterProcessor not applying Markdown formatting after upgrading to commonmark-java 0.25.1
Hi,
I cloned the Markwon repository since it hasn't been updated for about 4 years, and decided to update its core dependency commonmark-java from version 0.13.0 to 0.25.1.
My fork is here:
https://github.com/AlirezaGhanbarinia/Markdown
After the upgrade, I noticed an issue with AsteriskDelimiterProcessor and UnderscoreDelimiterProcessor — they correctly detect the delimiters (* and _), but the corresponding Markdown emphasis formatting is not applied in the output anymore.
Example:
private static Node parseMarkdown(String input) {
Parser parser = Parser.builder()
.customDelimiterProcessor(new AsteriskDelimiterProcessor())
.customDelimiterProcessor(new UnderscoreDelimiterProcessor())
.build();
return parser.parse(input);
}
Input:
This is *italic* and this is _also italic_
Behavior:
Delimiters are detected (confirmed via debugging in the processors) But the emphasis rendering is not applied to the final rendered output Expected:
Text between * and _ should be italicized as before with commonmark-java 0.13.0 I suspect there have been API or processing changes in commonmark-java between 0.13.0 and 0.25.1 that require adjustments to how custom delimiters are registered/handled.
Has anyone encountered this issue after upgrading to commonmark-java 0.25.x?
Thanks in advance for any help.
Delimiters are detected (confirmed via debugging in the processors) But the emphasis rendering is not applied to the final rendered output
So the resulting Node contains the emphasis nodes as expected? That would suggest that parsing works as expected, but rendering is the problem. Can you point me to the rendering code?
Yes, the resulting tree does contain the Emphasis nodes.
In my fork of Markwon here: 👉 https://github.com/AlirezaGhanbarinia/Markdown
Inside the markwon-inline-parser module, in the class MarkwonInlineParser, the emphasis nodes are correctly detected in the parseInline method.
However, they are not rendered. You can reproduce this easily:
Clone the repo
Build it
Check the Latex theme example where there is a sample for Asterisk and Underscore.
With commonmark-java:0.13.0 both parsing and rendering worked correctly. But after upgrading to 0.25.1 (and applying the necessary changes to make it compile), the rendering stopped working.
So my question is: 👉 What has changed in commonmark-java rendering between 0.13.x and 0.25.x that requires updating the way Markwon handles Emphasis nodes? 👉 What should I change in my code so that rendering works again?
Sorry I haven't had a chance to look at this yet. Could you try to narrow it down? E.g. does 0.17.0 work, etc?