Expand punctuation and symbol commands

This commit is contained in:
gloamxun committed 2026-10-26 20:32:18 +08:00
1 parent 3a089c6175
commit b7d18dff37
3 files changed
+21 -2

No files matched your search

+19
View File
@@ -7590,6 +7590,15 @@ fn text_symbol(rest: &str) -> Option<(&'static str, usize)> {
("\\textbraceleft", "{"),
("\\textbraceright", "}"),
("\\textasciigrave", "`"),
("\\textpm", "\u{b1}"),
("\\textminus", "\u{2212}"),
("\\texttimes", "\u{d7}"),
("\\textdiv", "\u{f7}"),
("\\textperiodcentered", "\u{b7}"),
("\\textsection", "\u{a7}"),
("\\textparagraph", "\u{b6}"),
("\\textdagger", "\u{2020}"),
("\\textdaggerdbl", "\u{2021}"),
("\\textbackslash", "\\"),
("\\textasciitilde", "~"),
("\\textasciicircum", "^"),
@@ -13771,6 +13780,16 @@ A definition.
assert!(b - a > 1_200_000, "gap {}", b - a);
}
#[test]
fn punctuation_symbols_expand() {
let preview =
preview_json("\\textpm \\textminus \\texttimes \\textdiv \\textsection \\textdagger")
.expect("preview");
assert!(!preview.contains("textpm"));
assert!(!preview.contains("textdagger"));
assert!(preview.contains("\"warnings\":[]"), "warnings: {preview}");
}
#[test]
fn more_text_symbols_expand() {
let preview = preview_json(