commonmark-java icon indicating copy to clipboard operation
commonmark-java copied to clipboard

SourceSpans not set on Link nodes produced by AutolinkExtension

Open roman-r-m opened this issue 3 years ago • 1 comments

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.

roman-r-m avatar Jul 24 '21 21:07 roman-r-m

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.

robinst avatar Aug 30 '21 06:08 robinst

Prepared a fix in PR https://github.com/commonmark/commonmark-java/pull/270

robinst avatar Oct 19 '22 12:10 robinst

Fix released in 0.20.0: https://github.com/commonmark/commonmark-java/blob/main/CHANGELOG.md#0200---2022-10-20

robinst avatar Oct 20 '22 02:10 robinst