Skip to content

Commit

Permalink
Fix math source span.
Browse files Browse the repository at this point in the history
  • Loading branch information
teethachee committed Mar 11, 2024
1 parent fcb56fb commit 3c7edaa
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 3c7edaa

Please sign in to comment.