fix: #48 markdown.rs 处理 FrontMatter 和 FootnoteDefinition 节点

FrontMatter → CodeBlock(language=yaml)
FootnoteDefinition → Paragraph

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
wangdl 2026-06-06 12:56:45 +08:00
parent fb67b1c13d
commit 0bca088933

View File

@ -158,6 +158,25 @@ fn collect_blocks<'a>(node: &'a AstNode<'a>, blocks: &mut Vec<DocumentBlock>) {
}) })
} }
} }
NodeValue::FrontMatter(content) => {
if content.trim().is_empty() {
None
} else {
Some(DocumentBlock::CodeBlock {
id: block_id(),
language: Some("yaml".into()),
code: content.clone(),
})
}
}
NodeValue::FootnoteDefinition(_) => {
let text = collect_text(child);
if text.is_empty() {
None
} else {
Some(DocumentBlock::Paragraph { id: block_id(), text })
}
}
NodeValue::Document NodeValue::Document
| NodeValue::Item(_) | NodeValue::Item(_)
| NodeValue::TableCell | NodeValue::TableCell