Skip to content

Commit c5a34c7

Browse files
fix: skip invalid code block metadata without key-value pairs (#561)
This ensures compatibility with transformers like `transformerMetaHighlight`, which may include metadata without key-value formatting. Previously, metadata entries without an = would cause [key, value] to be undefined, potentially introducing invalid entries into the map. We now skip such entries to ensure only valid key-value pairs are parsed.
1 parent 9d96bbd commit c5a34c7

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/utils/transformers/fileName.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export const transformerFileName = ({
2929

3030
for (const item of raw) {
3131
const [key, value] = item.split("=");
32+
if (!key || !value) continue;
3233
metaMap.set(key, value.replace(/["'`]/g, ""));
3334
}
3435

0 commit comments

Comments
 (0)