Skip to content

Commit

Permalink
Fix setx heading.
Browse files Browse the repository at this point in the history
  • Loading branch information
teethachee committed Mar 20, 2024
1 parent c3a51a6 commit 317ef6e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Markdig.Tests/TestSourcePosition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,18 @@ public void TestSetextHeading()
literal ( 0, 0) 0-0
heading ( 3, 0) 3-5
literal ( 3, 0) 3-3");

// 01 23456 7
Check("A\n=== \n", @"
heading ( 1, 0) 0-6
literal ( 1, 0) 0-0");

// 01 23456 7
Check("A\n===n\n", @"
paragraph ( 0, 0) 0-5
literal ( 0, 0) 0-0
linebreak ( 0, 1) 1-1
literal ( 1, 0) 2-5");
}

[Test]
Expand Down
5 changes: 5 additions & 0 deletions src/Markdig/Parsers/ParagraphBlockParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ private static char GetHeadingChar(ref StringSlice line, ref int count)
return headingChar;
}

if (!line.CurrentChar.IsSpaceOrTab())
{
return (char)0;
}

while (line.NextChar().IsSpaceOrTab())
{
}
Expand Down

0 comments on commit 317ef6e

Please sign in to comment.