diff --git a/src/Markdig.Tests/TestSourcePosition.cs b/src/Markdig.Tests/TestSourcePosition.cs index 2cfa61e1..27212653 100644 --- a/src/Markdig.Tests/TestSourcePosition.cs +++ b/src/Markdig.Tests/TestSourcePosition.cs @@ -533,13 +533,17 @@ public void TestHtmlEntityInline() [Test] public void TestAbbreviations() { - Check("*[HTML]: Hypertext Markup Language\r\n\r\nLater in a text we are using HTML and it becomes an abbr tag HTML", @" + Check("*[HTML]: Hypertext Markup Language\r\n\r\nLater in a text we are using HTML and it becomes an abbr tag HTML\r\n\r\nHTML abbreviation at the beginning of a line", @" paragraph ( 2, 0) 38-102 container ( 2, 0) 38-102 literal ( 2, 0) 38-66 abbreviation ( 2,29) 67-70 literal ( 2,33) 71-98 abbreviation ( 2,61) 99-102 +paragraph ( 4, 0) 107-150 +container ( 4, 0) 107-150 +abbreviation ( 4, 0) 107-110 +literal ( 4, 4) 111-150 ", "abbreviations"); } diff --git a/src/Markdig/Extensions/Abbreviations/AbbreviationParser.cs b/src/Markdig/Extensions/Abbreviations/AbbreviationParser.cs index 863e882f..9cfe5b10 100644 --- a/src/Markdig/Extensions/Abbreviations/AbbreviationParser.cs +++ b/src/Markdig/Extensions/Abbreviations/AbbreviationParser.cs @@ -89,6 +89,7 @@ private void DocumentOnProcessInlinesBegin(InlineProcessor inlineProcessor, Inli { var literal = (LiteralInline)processor.Inline!; var originalLiteral = literal; + var originalSpanEnd = literal.Span.End; ContainerInline? container = null; @@ -171,7 +172,7 @@ private void DocumentOnProcessInlinesBegin(InlineProcessor inlineProcessor, Inli // Process the remaining literal literal = new LiteralInline() { - Span = new SourceSpan(abbrInline.Span.End + 1, literal.Span.End), + Span = new SourceSpan(abbrInline.Span.End + 1, originalSpanEnd), Line = line, Column = column + match.Length, };