feat(markup): code-as-docs narration surface (G1–G4) and drop --- body end

Treat --- as Markdown HR everywhere, end side-effect helpers with empty returns,
and accept soft emphasis, float literals, and dynamic footnote keys so LLM-friendly
.mq.md stays runnable. Ship the weekend coffee example plus gold fixtures.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-09-14 10:16:48 +08:00
1 parent b5c07385e9
commit 5e74ff39f2
28 files changed
+799 -99

No files matched your search

+6 -1
View File
@@ -1341,7 +1341,11 @@ fn expr_prec(expr: &Expr, parent_prec: u8) -> String {
format!("{{{}}}", parts.join(", "))
}
Expr::Index { base, label } => {
format!("{}[^{}]", expr_prec(base, 8), label)
let key = match label {
crate::ast::IndexKey::Lit(s) => s.clone(),
crate::ast::IndexKey::Var(n) => format!("`{n}`"),
};
format!("{}[^{}]", expr_prec(base, 8), key)
}
Expr::Formula(e) => format!("$$ {} $$", e.as_display()),
Expr::Code(c) => format!("```{} …```", c.lang),
@@ -1436,6 +1440,7 @@ fn lit_display(lit: &Literal) -> String {
Literal::Bool(true) => "True".into(),
Literal::Bool(false) => "False".into(),
Literal::Int(n) => n.to_string(),
Literal::Num(n) => crate::formula::format_num(*n),
Literal::Text(t) => t.clone(),
}
}