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

test() doesn't check that frontmatter is at the front #92

Open
jgclark opened this issue Apr 3, 2023 · 0 comments
Open

test() doesn't check that frontmatter is at the front #92

jgclark opened this issue Apr 3, 2023 · 0 comments

Comments

@jgclark
Copy link

jgclark commented Apr 3, 2023

You describe frontmatter in the way that I understand it: it must come at the top of a file.

However, test() doesn't check that the YAML block comes at the start of the passed string:

return regex.test(string)

because regex isn't defined as being at the start of the string:

front-matter/index.js

Lines 4 to 11 in 71f4ea0

var pattern = '^(' +
optionalByteOrderMark +
'(= yaml =|---)' +
'$([\\s\\S]*?)' +
'^(?:\\2|\\.\\.\\.)\\s*' +
'$' +
(platform === 'win32' ? '\\r?' : '') +
'(?:\\n)?)'

Please either change test() to respect this constraint, or allow an extra parameter to be passed that defines whether this constraint is respected or not.

@jgclark jgclark changed the title test() doesn't check tha tht test() doesn't check that frontmatter is at the front Apr 3, 2023
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

No branches or pull requests

1 participant