Fix blank line silently dropping YAML block arrays (AI)
A blank line between a block-array key and its "- item" lines matched neither the item nor the key regex, resetting arrayKey to null and causing the following items to be silently skipped. Blank lines are now ignored instead of ending the array. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ae9bcfec3a
commit
c3d8f0171c
1 file changed
+1
@@ -39,6 +39,7 @@ export function parseFrontmatter(raw) {
|
||||
const meta = {};
|
||||
let arrayKey = null;
|
||||
for (const line of match[1].split(/\r?\n/)) {
|
||||
if (!line.trim()) continue; // blank line — doesn't close a block array
|
||||
const item = line.match(/^\s*-\s+(.*)$/);
|
||||
if (item && arrayKey) { meta[arrayKey].push(parseScalar(item[1])); continue; }
|
||||
const field = line.match(/^([A-Za-z][A-Za-z0-9_-]*):(?:\s*(.*))?$/);
|
||||
|
||||
Reference in new issue
Block a user