Skip to content

Commit

Permalink
Add strikethrough support to rustdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
mibac138 committed May 5, 2020
1 parent f8d394e commit 6f7e9a8
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/librustdoc/html/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use pulldown_cmark::{html, CodeBlockKind, CowStr, Event, Options, Parser, Tag};
mod tests;

fn opts() -> Options {
Options::ENABLE_TABLES | Options::ENABLE_FOOTNOTES
Options::ENABLE_TABLES | Options::ENABLE_FOOTNOTES | Options::ENABLE_STRIKETHROUGH
}

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

let p = Parser::new_with_broken_link_callback(md, Options::empty(), Some(&replacer));
let p = Parser::new_with_broken_link_callback(
md,
Options::ENABLE_STRIKETHROUGH,
Some(&replacer),
);

let mut s = String::new();

Expand Down Expand Up @@ -975,7 +979,11 @@ pub fn plain_summary_line(md: &str) -> String {
}
}
let mut s = String::with_capacity(md.len() * 3 / 2);
let p = ParserWrapper { inner: Parser::new(md), is_in: 0, is_first: true };
let p = ParserWrapper {
inner: Parser::new_ext(md, Options::ENABLE_STRIKETHROUGH),
is_in: 0,
is_first: true,
};
p.filter(|t| !t.is_empty()).for_each(|i| s.push_str(&i));
s
}
Expand Down

0 comments on commit 6f7e9a8

Please sign in to comment.