Skip to content

Commit a49f72e

Browse files
committed
fix a problem when parsing with ---\n---\n
1 parent 8756f29 commit a49f72e

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

Microsoft.Toolkit.Parsers/Markdown/Blocks/YamlHeaderBlock.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ internal static YamlHeaderBlock Parse(string markdown, int start, int end, out i
7878
else if (end - pos >= 3 && markdown.Substring(pos, 3) == "---")
7979
{
8080
lockedFinalUnderline = true;
81-
realEndIndex = pos + 3;
8281
break;
8382
}
8483
else if (startOfNextLine == pos + 1)
@@ -134,6 +133,7 @@ internal static YamlHeaderBlock Parse(string markdown, int start, int end, out i
134133
return null;
135134
}
136135

136+
realEndIndex = pos + 3;
137137
return result;
138138
}
139139

UnitTests/UnitTests.UWP/Markdown/Parse/HorizontalRuleTests.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,18 @@ public void HorizontalRule_Negative_FourStars()
107107
new ParagraphBlock().AddChildren(
108108
new TextRunInline { Text = "before ** after" }));
109109
}
110+
111+
[TestMethod]
112+
[TestCategory("Parse - block")]
113+
public void HorizontalRule_DoubleLine()
114+
{
115+
AssertEqual(
116+
CollapseWhitespace(@"
117+
---
118+
---
119+
"),
120+
new HorizontalRuleBlock(),
121+
new HorizontalRuleBlock());
122+
}
110123
}
111124
}

0 commit comments

Comments
 (0)