-
Notifications
You must be signed in to change notification settings - Fork 320
Closed
Labels
Description
Steps to reproduce the problem (provide example Markdown if applicable):
Run this example with IncludeSourceSpans.BLOCKS https://spec.commonmark.org/0.31.2/#example-210
import org.commonmark.node.Node;
import org.commonmark.parser.IncludeSourceSpans;
import org.commonmark.parser.Parser;
public class Main {
public static void main(String[] args) {
Parser parser = Parser.builder().includeSourceSpans(IncludeSourceSpans.BLOCKS).build();
String input = "[foo]: /url\n\"title\" ok";
Node node = parser.parse(input);
System.out.println("LinkReferenceDefinition spans: " + node.getFirstChild().getSourceSpans());
System.out.println("Paragraph(last child) spans: " + node.getLastChild().getSourceSpans());
}
}Expected behavior:
It should assign source spans to blocks
LinkReferenceDefinition spans: []
Paragraph(last child) spans: [SourceSpan{line=1, column=0, length=10}]
Actual behavior:
It only assigns source spans to a LinkReferenceDefinition which is not a block
LinkReferenceDefinition spans: [SourceSpan{line=0, column=0, length=11}, SourceSpan{line=1, column=0, length=10}]
Paragraph(last child) spans: []
PS [unrelated] a top level Document should probably only contain Blocks while LinkReferenceDefinition is a Node