From 0bca088933e5ff7ae2719609849abb7a81b4b874 Mon Sep 17 00:00:00 2001 From: wangdl Date: Sat, 6 Jun 2026 12:56:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20#48=20markdown.rs=20=E5=A4=84=E7=90=86?= =?UTF-8?q?=20FrontMatter=20=E5=92=8C=20FootnoteDefinition=20=E8=8A=82?= =?UTF-8?q?=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FrontMatter → CodeBlock(language=yaml) FootnoteDefinition → Paragraph Co-Authored-By: Claude Opus 4.7 --- crates/zx_document_core/src/markdown.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/crates/zx_document_core/src/markdown.rs b/crates/zx_document_core/src/markdown.rs index 8c676af..fd28235 100644 --- a/crates/zx_document_core/src/markdown.rs +++ b/crates/zx_document_core/src/markdown.rs @@ -158,6 +158,25 @@ fn collect_blocks<'a>(node: &'a AstNode<'a>, blocks: &mut Vec) { }) } } + 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::Item(_) | NodeValue::TableCell