Keep underline text without the rule

This commit is contained in:
gloamxun committed 2026-10-26 20:31:45 +08:00
1 parent f147ccc8c5
commit 7d05268983
3 files changed
+12 -3

No files matched your search

+10 -1
View File
@@ -7061,7 +7061,7 @@ fn strip_box_commands(text: &str) -> String {
let mut out = String::new();
let mut rest = text;
loop {
let matches: Vec<(&str, usize)> = ["\\mbox{", "\\hbox{", "\\makebox["]
let matches: Vec<(&str, usize)> = ["\\mbox{", "\\hbox{", "\\makebox[", "\\underline{"]
.iter()
.filter_map(|command| rest.find(command).map(|index| (*command, index)))
.collect();
@@ -13754,6 +13754,15 @@ A definition.
assert!(preview.contains("\"warnings\":[]"));
}
#[test]
fn underline_keeps_its_text() {
let text = strip_box_commands("A \\underline{B} C");
assert_eq!(text, "A B C");
let preview = preview_json("A \\underline{B} C").expect("preview");
assert!(preview.contains(">B</text>"));
assert!(!preview.contains("underline"));
}
#[test]
fn box_commands_keep_their_text() {
let preview =