diff --git a/moli-html2md/src/writer.rs b/moli-html2md/src/writer.rs index ddd4448423..6684a58f56 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("&"), '<' => self.output.push_str("<"), '>' => self.output.push_str(">"), + '\\' | '`' | '*' | '_' | '[' | ']' | '|' | '~' => { + 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 07e9cc90ef..51fe74785a 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"a*b_`\[x] & <tag>z"; - for preformatted_code in [false, true] { - let output = markdown_with( - source, - Options { - preformatted_code, - ..Options::default() - }, - ); - assert_eq!( - rendered_html(&output), - "

a*b_`\\[x] & <tag>z

\n" - ); - } -} - #[test] fn inline_code_breaks_obey_the_depth_limit() { let html = "git
status
";