Skip to content

armgit / moli

Public Imported from GitHub
0

Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust

Revert "Preserve literal characters in adjacent code HTML fallback"

kevin9848a96c1c96
diff --git a/moli-html2md/src/writer.rs b/moli-html2md/src/writer.rs
index ddd444842..6684a58f5 100644
--- a/moli-html2md/src/writer.rs
+++ b/moli-html2md/src/writer.rs
@@ -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),
}
}
diff --git a/moli-html2md/tests/inline_boundaries.rs b/moli-html2md/tests/inline_boundaries.rs
index 07e9cc90e..51fe74785 100644
--- a/moli-html2md/tests/inline_boundaries.rs
+++ b/moli-html2md/tests/inline_boundaries.rs
@@ -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>";