feat(markup): prefer [key](collection) for map and list access

Add GFM link-shaped index as the primary get surface, keep footnote
index as transitional compatibility, and align the coffee example.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-09-14 10:44:18 +08:00
1 parent 5e74ff39f2
commit 4a1c9c48a2
12 files changed
+235 -23

No files matched your search

+2 -1
View File
@@ -1345,7 +1345,8 @@ fn expr_prec(expr: &Expr, parent_prec: u8) -> String {
crate::ast::IndexKey::Lit(s) => s.clone(),
crate::ast::IndexKey::Var(n) => format!("`{n}`"),
};
format!("{}[^{}]", expr_prec(base, 8), key)
// Preferred surface: GFM link shape (legacy footnote still accepted by parser).
format!("[{}]({})", key, expr_prec(base, 0))
}
Expr::Formula(e) => format!("$$ {} $$", e.as_display()),
Expr::Code(c) => format!("```{} …```", c.lang),