Skip to content

Commit 4ed86d5

Browse files
committed
test(cli-rs): keep dollar math as text, as TS draws only math fences
OpenTUI #2072 lets Markdown parse $$…$$ and $…$ as math, off by default. TS's latex plugin draws only fenced latex and math blocks, so the client keeps the option off; this pins it with the plugin's math renderer registered.
1 parent b69ff66 commit 4ed86d5

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

  • packages/cli-rs/crates/latex/src

‎packages/cli-rs/crates/latex/src/tests.rs‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,18 @@ fn transcript_fences_match_typescript() {
123123
}
124124
}
125125

126+
/// TS draws only fenced `latex` and `math` blocks: `$$…$$` and `$…$` stay text, so the client leaves the
127+
/// Markdown math extension (OpenTUI #2072) off even though this plugin renders `math`.
128+
#[test]
129+
fn dollar_math_stays_text() {
130+
let (app, theme) = app(60, 8);
131+
let text = markdown(&app, &theme, false).set_markdown("$$\\frac{1}{2}$$\n\nInline $\\frac{a}{b}$ too.");
132+
app.root().add(&text);
133+
let frame = app.render().text();
134+
assert!(frame.contains("$$\\frac{1}{2}$$") && frame.contains("$\\frac{a}{b}$"), "{frame}");
135+
assert!(!frame.contains("───"), "{frame}");
136+
}
137+
126138
/// Streams `chunks` into one document, returning the frame text after each.
127139
fn stream(chunks: &[&str], stop: bool) -> Vec<String> {
128140
let (app, theme) = app(40, 10);

0 commit comments

Comments
 (0)