Report diagnostics and lay out cases environments

This commit is contained in:
gloamxun committed 2026-10-26 00:35:08 +08:00
1 parent a28e8926c7
commit 971190df26
6 files changed
+281 -10

No files matched your search

+18 -5
View File
@@ -6423,6 +6423,7 @@ const SUPPORTED_ENVIRONMENTS: &[&str] = &[
"equation",
"align",
"gather",
"cases",
"thebibliography",
"theorem",
"lemma",
@@ -7190,6 +7191,15 @@ mod source_tests {
assert_eq!(geometry_counter(&geometry, "steps"), 4);
}
#[test]
fn cases_environments_paint_rows_and_a_brace() {
let json = preview_json("\\[\\begin{cases} x & x>0 \\\\ 0 & \\text{else} \\end{cases}\\]")
.expect("cases preview");
assert!(json.contains(">{</text>"), "{json}");
assert!(json.contains(">x</text>"), "{json}");
assert!(!json.contains("unsupported environment `cases`"), "{json}");
}
#[test]
fn preview_warnings_flag_unsupported_environments() {
let source = r"\begin{document}
@@ -7197,17 +7207,20 @@ mod source_tests {
a &= b
\end{align}
\[\begin{cases}
x & x > 0 \\
0 & \text{otherwise}
\end{cases}\]
\[\begin{multline}
x = 1 \\
y = 2
\end{multline}\]
\begin{tabularx}{\textwidth}{lX}
a & b
\end{tabularx}
\end{document}";
let json = preview_json(source).expect("preview");
assert!(json.contains("unsupported environment `cases`"), "{json}");
assert!(
json.contains("unsupported environment `multline`"),
"{json}"
);
assert!(
json.contains("unsupported environment `tabularx`"),
"{json}"