fix: parsing issues
This commit is contained in:
@@ -61,7 +61,13 @@ const marked = new Marked()
|
||||
const match = rule.exec(src);
|
||||
if (match) {
|
||||
const yamlContent = match[1]?.trim() || '';
|
||||
const props = yaml.load(yamlContent) as Record<string, unknown> || {};
|
||||
let props: Record<string, unknown> = {};
|
||||
try {
|
||||
props = (yaml.load(yamlContent) as Record<string, unknown>) || {};
|
||||
} catch (e) {
|
||||
console.error("YAML Parse Error in code-block-yaml-tag:", e);
|
||||
props = { error: "Invalid YAML content" };
|
||||
}
|
||||
|
||||
// 提取 tag 名称,默认为 tag-unknown
|
||||
const tagName = (props.tag as string) || 'tag-unknown';
|
||||
|
||||
Reference in New Issue
Block a user