Skip to content

Commit 35c0adb

Browse files
fix validate script to handle multi-line YAML frontmatter
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent afb52d9 commit 35c0adb

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

scripts/validate.mjs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,15 @@ function parseFrontmatter(content) {
4141

4242
const block = normalized.slice(4, closing);
4343
const fields = {};
44+
let currentKey = null;
4445
for (const line of block.split("\n")) {
45-
const match = line.match(/^(\w[\w-]*):\s*(.+)$/);
46-
if (match) fields[match[1]] = match[2].trim();
46+
const match = line.match(/^(\w[\w-]*):\s*(.*)$/);
47+
if (match) {
48+
currentKey = match[1];
49+
fields[currentKey] = match[2].trim();
50+
} else if (currentKey && /^\s+\S/.test(line)) {
51+
fields[currentKey] += " " + line.trim();
52+
}
4753
}
4854
return fields;
4955
}

0 commit comments

Comments
 (0)