GetFrontMatterLines bug

This commit is contained in:
2023-07-21 14:39:50 -07:00
parent 6c711945b1
commit 4bbcf04c1d
23 changed files with 70 additions and 77 deletions

View File

@ -18,12 +18,18 @@ internal abstract class MarkDown
foreach (string jsonLine in jsonLines)
{
afterTrim = jsonLine.Trim();
if (afterTrim.Length < 3)
if (string.IsNullOrEmpty(afterTrim) || afterTrim.First() is '{' or '}')
continue;
segments = afterTrim.Split(": ");
if (segments.Length != 2)
{
results.Clear();
break;
}
if (afterTrim[^1] != ',')
results.Add(afterTrim[1..].Replace("\": \"", ": \""));
results.Add(afterTrim[1..].Replace("\": ", ": "));
else
results.Add(afterTrim[1..^1].Replace("\": \"", ": \""));
results.Add(afterTrim[1..^1].Replace("\": ", ": "));
}
if (results.Any())
{