fix(agent): skip YAML setext lookalikes in document-scope parser

This commit is contained in:
cflmy committed 2026-11-18 09:40:50 +08:00
1 parent 88490e3092
commit 02a4f2d20d
1 file changed
+7 -1
+7 -1
View File
@@ -97,7 +97,13 @@ pub fn project(args: &Value) -> Result<Value, String> {
.and_then(Value::as_u64)
.unwrap_or(1600)
.clamp(32, 16000) as usize;
let marks = headings(&source);
// YAML frontmatter may look like a setext Markdown heading; never treat it
// as a Marqdo class or function boundary.
let front_end = frontmatter_end(&source);
let marks: Vec<Section> = headings(&source)
.into_iter()
.filter(|heading| heading.start >= front_end)
.collect();
let results: Vec<(usize, usize)> = match scope {
"file" => {
let end = marks.first().map_or(source.len(), |h| h.start);