Skip to content

Commit e81ad69

Browse files
Don't take into account hashtag prepended lines if not in rust code block
1 parent a161a7b commit e81ad69

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/librustdoc/html/markdown.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,6 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for CodeBlocks<'_, 'a, I> {
246246
_ => {}
247247
}
248248
}
249-
let lines = origtext.lines().filter_map(|l| map_line(l).for_html());
250-
let text = lines.intersperse("\n".into()).collect::<String>();
251249

252250
let parse_result = match kind {
253251
CodeBlockKind::Fenced(ref lang) => {
@@ -260,7 +258,7 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for CodeBlocks<'_, 'a, I> {
260258
<pre class=\"language-{}\"><code>{}</code></pre>\
261259
</div>",
262260
lang,
263-
Escape(&text),
261+
Escape(&origtext),
264262
)
265263
.into(),
266264
));
@@ -270,6 +268,9 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for CodeBlocks<'_, 'a, I> {
270268
CodeBlockKind::Indented => Default::default(),
271269
};
272270

271+
let lines = origtext.lines().filter_map(|l| map_line(l).for_html());
272+
let text = lines.intersperse("\n".into()).collect::<String>();
273+
273274
compile_fail = parse_result.compile_fail;
274275
should_panic = parse_result.should_panic;
275276
ignore = parse_result.ignore;

0 commit comments

Comments
 (0)