Skip to content

Commit

Permalink
Fix bug in YAML frontmatter parsing
Browse files Browse the repository at this point in the history
The way we split the Markdown source was resulting in any other
occurrence of `---` breaking the build. Fix this by specifying
`maxsplit=2` to limit the number of splits.
  • Loading branch information
leouieda committed Oct 26, 2021
1 parent 4c63174 commit 8a50690
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nene/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ def load_markdown(path):
"path": str(path.with_suffix(".html")),
"source": str(path),
}
text = path.read_text(encoding="utf-8")
front_matter, markdown = text.split("---")[1:]
text = path.read_text(encoding="utf-8").strip()
_, front_matter, markdown = text.split("---", maxsplit=2)
page.update(yaml.safe_load(front_matter.strip()))
page["markdown"] = markdown
return page
Expand Down

0 comments on commit 8a50690

Please sign in to comment.