Skip to content

Commit ccde54f

Browse files
Updated the frontmatter regex to accept both LF and CRLF line endings, improving compatibility with Windows environments. (#1329)
1 parent 493984b commit ccde54f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/lib/frontmatter.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import yaml from 'yaml';
77
* @returns {{title: string, description: string, body: string, meta: object}}
88
*/
99
export function parseFrontmatter(content, path = '') {
10-
const FRONT_MATTER_REG = /^\s*---\n\s*([\s\S]*?)\s*\n---\n/i;
10+
// Accept both LF and CRLF line endings so frontmatter is detected on Windows
11+
const FRONT_MATTER_REG = /^\s*---\r?\n\s*([\s\S]*?)\s*\r?\n---\r?\n/i;
1112

1213
const matches = content.match(FRONT_MATTER_REG);
1314
if (!matches) {

0 commit comments

Comments
 (0)