You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug A clear and concise description of what the bug is.
With default parser settings in flexmark 0.64.8 I'm getting an internal accumulator bug with the following minimal input. It's not valid markdown but my understanding is that it should be supported or at least give a more useful error.
x\n \n`\n x\n`
FAIL: java.lang.IllegalStateException: Accumulated range [5, 6) overlaps Transformed Range[2]: [5, 6)
java.lang.IllegalStateException: Accumulated range [5, 6) overlaps Transformed Range[2]: [5, 6)
at com.vladsch.flexmark.util.sequence.builder.SegmentBuilderBase.processParts(SegmentBuilderBase.java:431)
at com.vladsch.flexmark.util.sequence.builder.SegmentBuilderBase.append(SegmentBuilderBase.java:538)
at com.vladsch.flexmark.util.sequence.builder.SegmentBuilderBase.append(SegmentBuilderBase.java:16)
at com.vladsch.flexmark.util.sequence.builder.tree.SegmentTree.addSegments(SegmentTree.java:325)
Expected behavior A clear and concise description of what you expected to happen with sample output that would be desired, where it makes sense.
Ideally I would get a best effort at the text without markdown when calling TextCollectingVisitor().collectAndGetText, but largely just reporting the internal error.
Code to reproduce
import com.vladsch.flexmark.parser.Parser;
import com.vladsch.flexmark.util.ast.Node;
import com.vladsch.flexmark.util.ast.TextCollectingVisitor;
public class FlexmarkDefaultCheck {
public static void main(String[] args) {
String s = "x\n \n`\n x\n`";
try {
Parser p = Parser.builder().build();
Node doc = p.parse(s);
String out = new TextCollectingVisitor().collectAndGetText(doc);
System.out.println("OK");
System.out.println(out.replace("\n", "\\n"));
} catch (Throwable t) {
t.printStackTrace();
System.exit(1);
}
}
}
Activity
[-]Parser error (Repro included)[/-][+]Default Parser error (Repro included)[/+]