mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 07:33:07 +08:00
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.
This commit is contained in:
committed by
GitHub
parent
9d96bbd57f
commit
c5a34c7838
@@ -29,6 +29,7 @@ export const transformerFileName = ({
|
||||
|
||||
for (const item of raw) {
|
||||
const [key, value] = item.split("=");
|
||||
if (!key || !value) continue;
|
||||
metaMap.set(key, value.replace(/["'`]/g, ""));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user