Skip to content

Commit 90c1815

Browse files
authored
Rollup merge of rust-lang#71928 - mibac138:strikethrough, r=GuillaumeGomez
Add strikethrough support to rustdoc Implements uncontroversial part of rust-lang#71183. r? @GuillaumeGomez
2 parents bb8d391 + bbda107 commit 90c1815

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

src/librustdoc/html/markdown.rs

+11-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ use pulldown_cmark::{html, CodeBlockKind, CowStr, Event, Options, Parser, Tag};
4444
mod tests;
4545

4646
fn opts() -> Options {
47-
Options::ENABLE_TABLES | Options::ENABLE_FOOTNOTES
47+
Options::ENABLE_TABLES | Options::ENABLE_FOOTNOTES | Options::ENABLE_STRIKETHROUGH
4848
}
4949

5050
/// When `to_string` is called, this struct will emit the HTML corresponding to
@@ -933,7 +933,11 @@ impl MarkdownSummaryLine<'_> {
933933
}
934934
};
935935

936-
let p = Parser::new_with_broken_link_callback(md, Options::empty(), Some(&replacer));
936+
let p = Parser::new_with_broken_link_callback(
937+
md,
938+
Options::ENABLE_STRIKETHROUGH,
939+
Some(&replacer),
940+
);
937941

938942
let mut s = String::new();
939943

@@ -975,7 +979,11 @@ pub fn plain_summary_line(md: &str) -> String {
975979
}
976980
}
977981
let mut s = String::with_capacity(md.len() * 3 / 2);
978-
let p = ParserWrapper { inner: Parser::new(md), is_in: 0, is_first: true };
982+
let p = ParserWrapper {
983+
inner: Parser::new_ext(md, Options::ENABLE_STRIKETHROUGH),
984+
is_in: 0,
985+
is_first: true,
986+
};
979987
p.filter(|t| !t.is_empty()).for_each(|i| s.push_str(&i));
980988
s
981989
}
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#![crate_name = "foo"]
2+
3+
// @has foo/fn.f.html
4+
// @has - //del "Y"
5+
/// ~~Y~~
6+
pub fn f() {}

0 commit comments

Comments
 (0)