Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly detect frontmatter to avoid mangling document (fixes #180, fixes #189) #190

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

gregdan3
Copy link

@gregdan3 gregdan3 commented Sep 17, 2023

The previous format would incorrectly capture:

  • A single horizontal rule at the top of the file
  • Three literal dashes with arbitrary content after them. This was detected as a frontmatter, and an extra HR would be inserted after as a result.

The new format requires that there are two sets of triple dashes on their own lines, where the first is the first text in the document. This is necessarily the bounding box of a frontmatter, though the inner yml could be invalid and then would appear in the document instead.

There are still two more newline related issues I've noticed:

  • An extra newline is inserted between the TOC and content on both top and bottom. This is fairly innocuous.
  • If the TOC is first or last item in the document, two spare newlines will be added on the contentless side every generation. Presumably caused by the section being empty but still in the section list. Went ahead and fixed this too!

@gregdan3 gregdan3 changed the title Correctly detect frontmatter to avoid mangling document (fixes #180, #189) Correctly detect frontmatter to avoid mangling document (fixes #180, fixes #189) Sep 17, 2023
The previous format would incorrectly capture:
- A single horizontal rule at the top of the file
- Three literal dashes with arbitrary content after them.
This was detected as a frontmatter, and an extra HR would be inserted after as a result.

The new format requires that there are two sets of triple dashes on their own lines, where the first is the first text in the document.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant