summary refs log tree commit diff
path: root/src/librustdoc/html/markdown.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-12-12 16:00:14 +0000
committerbors <bors@rust-lang.org>2022-12-12 16:00:14 +0000
commit69f9c33d71c871fc16ac445211281c6e7a340943 (patch)
tree348cdcec6049f68be8c2618d727b2facd1ccb857 /src/librustdoc/html/markdown.rs
parent0040709e39bfa159d099ee14628ad4ac72f91406 (diff)
parentc9aa73c3b141d04aeffe7ff359f0fe2d642ff2b1 (diff)
downloadrust-1.66.0.tar.gz
rust-1.66.0.zip
Auto merge of #105563 - pietroalbini:pa-stable-1.66.0, r=pietroalbini 1.66.0
[stable] Prepare 1.66.0 release

This PR prepares the artifacts for the 1.66.0 release. The following PRs have been backported:

* #104782
* #105023
* #104558
* #104610
* #103989
* #104650
* #105539
* #105477

r? `@ghost`
Diffstat (limited to 'src/librustdoc/html/markdown.rs')
-rw-r--r--src/librustdoc/html/markdown.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs
index 5ce62224d35..1e1c657b0bf 100644
--- a/src/librustdoc/html/markdown.rs
+++ b/src/librustdoc/html/markdown.rs
@@ -246,8 +246,6 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for CodeBlocks<'_, 'a, I> {
                 _ => {}
             }
         }
-        let lines = origtext.lines().filter_map(|l| map_line(l).for_html());
-        let text = lines.intersperse("\n".into()).collect::<String>();
 
         let parse_result = match kind {
             CodeBlockKind::Fenced(ref lang) => {
@@ -260,7 +258,7 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for CodeBlocks<'_, 'a, I> {
                                  <pre class=\"language-{}\"><code>{}</code></pre>\
                              </div>",
                             lang,
-                            Escape(&text),
+                            Escape(&origtext),
                         )
                         .into(),
                     ));
@@ -270,6 +268,9 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for CodeBlocks<'_, 'a, I> {
             CodeBlockKind::Indented => Default::default(),
         };
 
+        let lines = origtext.lines().filter_map(|l| map_line(l).for_html());
+        let text = lines.intersperse("\n".into()).collect::<String>();
+
         compile_fail = parse_result.compile_fail;
         should_panic = parse_result.should_panic;
         ignore = parse_result.ignore;