diff --git a/src/Markdig.Tests/Specs/Specs.cs b/src/Markdig.Tests/Specs/Specs.cs
index a837021a..720a2f98 100644
--- a/src/Markdig.Tests/Specs/Specs.cs
+++ b/src/Markdig.Tests/Specs/Specs.cs
@@ -20630,6 +20630,7 @@ namespace Markdig.Tests
// The following CommonMark:
// ---
// this: is a frontmatter
+ //
// ...
// This is a text
//
@@ -20637,7 +20638,7 @@ namespace Markdig.Tests
//
This is a text
Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 4, "Extensions YAML frontmatter discard");
- TestParser.TestSpec("---\nthis: is a frontmatter\n...\nThis is a text", "This is a text
", "yaml");
+ TestParser.TestSpec("---\nthis: is a frontmatter\n\n...\nThis is a text", "This is a text
", "yaml");
}
}
// If the end front matter marker (`...` or `---`) is not present, it will render the `---` has a `
`:
diff --git a/src/Markdig.Tests/Specs/YamlSpecs.md b/src/Markdig.Tests/Specs/YamlSpecs.md
index 951eafde..2233efcd 100644
--- a/src/Markdig.Tests/Specs/YamlSpecs.md
+++ b/src/Markdig.Tests/Specs/YamlSpecs.md
@@ -47,6 +47,7 @@ It can end with three dots `...`:
```````````````````````````````` example
---
this: is a frontmatter
+
...
This is a text
.
diff --git a/src/Markdig/Extensions/Yaml/YamlFrontMatterParser.cs b/src/Markdig/Extensions/Yaml/YamlFrontMatterParser.cs
index 252eddf2..062b1099 100644
--- a/src/Markdig/Extensions/Yaml/YamlFrontMatterParser.cs
+++ b/src/Markdig/Extensions/Yaml/YamlFrontMatterParser.cs
@@ -82,10 +82,10 @@ namespace Markdig.Extensions.Yaml
{
c = fullLine.NextChar();
}
- nc = fullLine.NextChar(); // skip \n
+ nc = fullLine.PeekChar();
if (nc == '-')
{
- if (fullLine.NextChar() == '-' && fullLine.NextChar() == '-' && (fullLine.NextChar() == '\0' || fullLine.SkipSpacesToEndOfLineOrEndOfDocument()))
+ if (fullLine.NextChar() == '-' && fullLine.NextChar() == '-' && fullLine.NextChar() == '-' && (fullLine.NextChar() == '\0' || fullLine.SkipSpacesToEndOfLineOrEndOfDocument()))
{
hasFullYamlFrontMatter = true;
break;
@@ -93,7 +93,7 @@ namespace Markdig.Extensions.Yaml
}
else if (nc == '.')
{
- if (fullLine.NextChar() == '.' && fullLine.NextChar() == '.' && (fullLine.NextChar() == '\0' || fullLine.SkipSpacesToEndOfLineOrEndOfDocument()))
+ if (fullLine.NextChar() == '.' && fullLine.NextChar() == '.' && fullLine.NextChar() == '.' && (fullLine.NextChar() == '\0' || fullLine.SkipSpacesToEndOfLineOrEndOfDocument()))
{
hasFullYamlFrontMatter = true;
break;