Skip to content

Commit

Permalink
Merge pull request #779 from toothache/fix_math_span
Browse files Browse the repository at this point in the history
Fix math source span
  • Loading branch information
xoofx committed Mar 14, 2024
2 parents b62a12d + 3c7edaa commit d434f00
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/Markdig.Tests/TestSourcePosition.cs
Expand Up @@ -699,13 +699,14 @@ public void TestAttributesForHeading()
public void TestMathematicsInline()
{
// 01 23456789AB
Check("0\n012 $abcd$", @"
paragraph ( 0, 0) 0-11
Check("0\n012 $abcd$ 321", @"
paragraph ( 0, 0) 0-15
literal ( 0, 0) 0-0
linebreak ( 0, 1) 1-1
literal ( 1, 0) 2-5
math ( 1, 4) 6-11
attributes ( 0, 0) 0--1
literal ( 1,10) 12-15
", "mathematics");
}

Expand Down
2 changes: 1 addition & 1 deletion src/Markdig/Extensions/Mathematics/MathInlineParser.cs
Expand Up @@ -152,7 +152,7 @@ public override bool Match(InlineProcessor processor, ref StringSlice slice)
// Create a new MathInline
var inline = new MathInline()
{
Span = new SourceSpan(processor.GetSourcePosition(startPosition, out int line, out int column), processor.GetSourcePosition(slice.End)),
Span = new SourceSpan(processor.GetSourcePosition(startPosition, out int line, out int column), processor.GetSourcePosition(end)),
Line = line,
Column = column,
Delimiter = match,
Expand Down

0 comments on commit d434f00

Please sign in to comment.