diff options
| author | Guillaume Gomez <guillaume.gomez@huawei.com> | 2022-04-20 20:11:18 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume.gomez@huawei.com> | 2022-04-20 20:28:15 +0200 |
| commit | f988f86cdc13f75386ea58bfa11a1b9cd632bac9 (patch) | |
| tree | e75620276d607bbea2616f41552ee29e483d0d40 | |
| parent | d39864d64e6e0762d418f6beeedb4510942fc828 (diff) | |
| download | rust-f988f86cdc13f75386ea58bfa11a1b9cd632bac9.tar.gz rust-f988f86cdc13f75386ea58bfa11a1b9cd632bac9.zip | |
Remove `<>` links to be potential intra-doc links
| -rw-r--r-- | src/librustdoc/html/markdown.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index eafe6f17d44..b0f7836a834 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -1312,7 +1312,19 @@ crate fn markdown_links<R>(md: &str, filter_map: impl Fn(MarkdownLink) -> Option let iter = Footnotes::new(HeadingLinks::new(p, None, &mut ids, HeadingOffset::H1)); for ev in iter { - if let Event::Start(Tag::Link(kind, dest, _)) = ev.0 { + if let Event::Start(Tag::Link( + // `<>` links cannot be intra-doc links so we skip them. + kind @ (LinkType::Inline + | LinkType::Reference + | LinkType::ReferenceUnknown + | LinkType::Collapsed + | LinkType::CollapsedUnknown + | LinkType::Shortcut + | LinkType::ShortcutUnknown), + dest, + _, + )) = ev.0 + { debug!("found link: {dest}"); let span = span_for_link(&dest, ev.1); filter_map(MarkdownLink { kind, link: dest.into_string(), range: span }) |
