fix: preserve inline frontmatter values
This commit is contained in:
1 parent
1e2ab8bf1e
commit
31c6f178f3
2 files changed
+11
-2
No files matched your search
@@ -123,7 +123,15 @@ export function parseFrontmatterBlock(content: string): ParsedFrontmatter {
|
||||
if (endIndex === -1) return {};
|
||||
const block = normalized.slice(4, endIndex);
|
||||
|
||||
const lineParsed = parseLineFrontmatter(block);
|
||||
const yamlParsed = parseYamlFrontmatter(block);
|
||||
if (yamlParsed !== null) return yamlParsed;
|
||||
return parseLineFrontmatter(block);
|
||||
if (yamlParsed === null) return lineParsed;
|
||||
|
||||
const merged: ParsedFrontmatter = { ...yamlParsed };
|
||||
for (const [key, value] of Object.entries(lineParsed)) {
|
||||
if (value.startsWith("{") || value.startsWith("[")) {
|
||||
merged[key] = value;
|
||||
}
|
||||
}
|
||||
return merged;
|
||||
}
|
||||
Reference in new issue
Block a user