Open jayvdb opened 7 years ago
I too encounterd with this problem
This can be fixed be changing var pattern
to
var pattern = '^(' +
optionalByteOrderMark +
'(= yaml =|---)' +
'$([\\s\\S]*?)' +
'^(?:\\2|\\.\\.\\.)\\s*' +
'$' +
(process.platform === 'win32' ? '\\r?' : '') +
'(?:\\n)?)'
Hello from @github 👋🏼 The blog team is using this library, thank you so much!
Just wondering if you'd accept a pull request that fixes it? I can't promise when but I'd be happy to submit one, or try to find someone else you would.
Probably was fixed by https://github.com/jxson/front-matter/pull/54
We ran into it today, using the latest version (4.0.2), so I think it's not quite fixed?
Here is a test case to reproduce the problem
const frontMatter = require("front-matter"); // v4.0.2
const markdownContent = `---
foo: bar
---
content`;
console.log(frontMatter(markdownContent));
// {
// attributes: {},
// body: '--- \nfoo: bar\n---\n\ncontent',
// bodyBegin: 1
// }
Hi @gr2m,
I'll definitely take pull requests, especially if it includes a test ;)
YAML spec allows spaces after the
---
The regex used by this package prevents that.