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

Don't match front matter in the middle of the file #354

Closed
mojavelinux opened this issue Sep 8, 2013 · 1 comment
Closed

Don't match front matter in the middle of the file #354

mojavelinux opened this issue Sep 8, 2013 · 1 comment
Labels
Milestone

Comments

@mojavelinux
Copy link
Member

The front matter parser is entirely too loose. The idea of front matter is that it's at the top of the file. The current implementation is looking for lines that look like front matter anywhere in the file.

The parser is also running .strip on the line before analyzing it, which causes it to match lines that have indented ---.

Both of these loose checks cause processing errors on Markdown (and other markup languages) that allow three hypens in the content.

The rules for locating front matter should be as follows:

  1. The first line must start with three hyphens (e.g., ---), followed only by whitespace
  2. The front matter ends when the next line that starts with three hyphens followed only be whitespace is found
  3. No other lines in the file will be scanned for front matter delimiters outside of these two matches
LightGuard added a commit that referenced this issue Sep 11, 2013
resolves #354 don't match front matter in the middle of the file
@mojavelinux
Copy link
Member Author

This was the cause of issue #335.

@LightGuard LightGuard added this to the 0.5.4 milestone Apr 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants