Auto merge of #127127 - notriddle:notriddle/pulldown-cmark-0.11, r=GuillaumeGomez
rustdoc: update to pulldown-cmark 0.11 r? rustdoc This pull request updates rustdoc to the latest version of pulldown-cmark. Along with adding new markdown extensions (which this PR doesn't enable), the new pulldown-cmark version also fixes a large number of bugs. Because all text files successfully parse as markdown, these bugfixes change the output, which can break people's existing docs. A crater run, https://github.com/rust-lang/rust/pull/121659, has already been run for this change. The first commit upgrades and fixes rustdoc. The second commit adds a lint for the footnote and block quote parser changes, which break the largest numbers of docs in the Crater run. The strikethrough change was mitigated in pulldown-cmark itself. Unblocks https://github.com/rust-lang/rust-clippy/pull/12876
This commit is contained in:
commit
66b4f0021b
16 changed files with 385 additions and 94 deletions
|
@ -1,4 +1,6 @@
|
|||
use pulldown_cmark::{BrokenLink, CowStr, Event, LinkType, Options, Parser, Tag};
|
||||
use pulldown_cmark::{
|
||||
BrokenLink, BrokenLinkCallback, CowStr, Event, LinkType, Options, Parser, Tag,
|
||||
};
|
||||
use rustc_ast as ast;
|
||||
use rustc_ast::util::comments::beautify_doc_string;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
|
@ -427,7 +429,9 @@ fn parse_links<'md>(doc: &'md str) -> Vec<Box<str>> {
|
|||
|
||||
while let Some(event) = event_iter.next() {
|
||||
match event {
|
||||
Event::Start(Tag::Link(link_type, dest, _)) if may_be_doc_link(link_type) => {
|
||||
Event::Start(Tag::Link { link_type, dest_url, title: _, id: _ })
|
||||
if may_be_doc_link(link_type) =>
|
||||
{
|
||||
if matches!(
|
||||
link_type,
|
||||
LinkType::Inline
|
||||
|
@ -441,7 +445,7 @@ fn parse_links<'md>(doc: &'md str) -> Vec<Box<str>> {
|
|||
}
|
||||
}
|
||||
|
||||
links.push(preprocess_link(&dest));
|
||||
links.push(preprocess_link(&dest_url));
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
@ -451,8 +455,8 @@ fn parse_links<'md>(doc: &'md str) -> Vec<Box<str>> {
|
|||
}
|
||||
|
||||
/// Collects additional data of link.
|
||||
fn collect_link_data<'input, 'callback>(
|
||||
event_iter: &mut Parser<'input, 'callback>,
|
||||
fn collect_link_data<'input, F: BrokenLinkCallback<'input>>(
|
||||
event_iter: &mut Parser<'input, F>,
|
||||
) -> Option<Box<str>> {
|
||||
let mut display_text: Option<String> = None;
|
||||
let mut append_text = |text: CowStr<'_>| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue