Revert "Preserve literal characters in adjacent code HTML fallback"

This reverts commit 9359650240.
This commit is contained in:
kevin
2026-09-18 21:32:23 +08:00
parent 9359650240
commit 4866bd8543
2 changed files with 4 additions and 18 deletions
+4
View File
@@ -465,6 +465,10 @@ impl<'a> Writer<'a> {
'&' => self.output.push_str("&amp;"),
'<' => self.output.push_str("&lt;"),
'>' => self.output.push_str("&gt;"),
'\\' | '`' | '*' | '_' | '[' | ']' | '|' | '~' => {
self.output.push('\\');
self.output.push(ch);
}
_ => self.output.push(ch),
}
}
-18
View File
@@ -82,24 +82,6 @@ fn inline_code_breaks_keep_separation_at_code_span_edges() {
);
}
#[test]
fn adjacent_code_html_fallback_keeps_literal_code_text() {
let source = r"<code>a*b_`\[x] &amp; &lt;tag&gt;</code><code>z</code>";
for preformatted_code in [false, true] {
let output = markdown_with(
source,
Options {
preformatted_code,
..Options::default()
},
);
assert_eq!(
rendered_html(&output),
"<p><code>a*b_`\\[x] &amp; &lt;tag&gt;</code><code>z</code></p>\n"
);
}
}
#[test]
fn inline_code_breaks_obey_the_depth_limit() {
let html = "<code>git<span><br></span>status</code>";