commonmark-java
commonmark-java copied to clipboard
SourceSpans not set on Link nodes produced by AutolinkExtension
Steps to reproduce the problem (provide example Markdown if applicable):
some text http://www.github.com and more text
Expected behavior:
When the parser is created with .includeSourceSpans(IncludeSourceSpans.BLOCKS_AND_INLINES)
I'd expect all nodes to have source spans. In the above example, only the Paragraph node does.
Yep, the autolink extension currently doesn't handle source positions correctly, that's a bug.
The fix needs to be made somewhere here, along with tests: https://github.com/commonmark/commonmark-java/blob/main/commonmark-ext-autolink/src/main/java/org/commonmark/ext/autolink/internal/AutolinkPostProcessor.java#L34
I'll try to get a fix included in the next release.
Prepared a fix in PR https://github.com/commonmark/commonmark-java/pull/270
Fix released in 0.20.0: https://github.com/commonmark/commonmark-java/blob/main/CHANGELOG.md#0200---2022-10-20