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:
1 parent
b5c07385e9
commit
5e74ff39f2
28 files changed
+799
-99
No files matched your search
+14
-3
@@ -145,11 +145,11 @@ pub enum Expr {
|
||||
List(Vec<Expr>),
|
||||
/// Object literal / horizontal table (`map` value).
|
||||
Map(Vec<(String, Expr)>),
|
||||
/// Footnote index: `` `xs`[^1] `` / `` `m`[^key] `` (see tables-maps-footnotes).
|
||||
/// Footnote index: `` `xs`[^1] `` / `` `m`[^key] `` / `` `m`[^`var`] `` (dynamic key).
|
||||
Index {
|
||||
base: Box<Expr>,
|
||||
/// Label inside `[^…]` (digits → 1-based list index, or map key text including digit keys).
|
||||
label: String,
|
||||
/// Label inside `[^…]` (digits → 1-based list index, or map key; see [`IndexKey`]).
|
||||
label: IndexKey,
|
||||
},
|
||||
/// Parsed `$$…$$` formula tree (from assignment RHS).
|
||||
Formula(FormulaExpr),
|
||||
@@ -166,11 +166,22 @@ pub enum InterpPart {
|
||||
Index { base: String, labels: Vec<String> },
|
||||
}
|
||||
|
||||
/// Footnote / map key after `[^…]`.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum IndexKey {
|
||||
/// Static text: `[^拿铁]` / `[^1]`.
|
||||
Lit(String),
|
||||
/// Dynamic: `` [^`品名`] `` — evaluate variable, then stringify as key.
|
||||
Var(String),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum Literal {
|
||||
None,
|
||||
Bool(bool),
|
||||
Int(i64),
|
||||
/// Decimal literal (`0.85`, `3.14`).
|
||||
Num(f64),
|
||||
Text(String),
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user