Skip to content

Commit

Permalink
Don't take into account hashtag prepended lines if not in rust code b…
Browse files Browse the repository at this point in the history
…lock
  • Loading branch information
GuillaumeGomez authored and pietroalbini committed Dec 12, 2022
1 parent 47141d6 commit 76184b1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/librustdoc/html/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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(),
));
Expand All @@ -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;
Expand Down

0 comments on commit 76184b1

Please sign in to comment.