diff options
| author | Raymond Luo <ray.luo@nyu.edu> | 2022-06-20 23:15:27 -0400 |
|---|---|---|
| committer | Raymond Luo <ray.luo@nyu.edu> | 2022-06-20 23:15:27 -0400 |
| commit | b7e3f525bddacdea61405c2fddad5ee1a0b5d4b3 (patch) | |
| tree | 44070a288c0e7d385fabfb1d860ab983c5588a3a | |
| parent | c6f776c5f9aa7d850be24d0288700905e833dc9e (diff) | |
| download | rust-b7e3f525bddacdea61405c2fddad5ee1a0b5d4b3.tar.gz rust-b7e3f525bddacdea61405c2fddad5ee1a0b5d4b3.zip | |
handle autolink as edge case
| -rw-r--r-- | crates/ide/src/doc_links.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs index a78358f20fd..993e12f4a3e 100644 --- a/crates/ide/src/doc_links.rs +++ b/crates/ide/src/doc_links.rs @@ -382,13 +382,21 @@ fn map_links<'e>( )) } Event::Text(s) if in_link => { - let (_, link_target_s, link_name) = callback(&end_link_target.take().unwrap(), &s); + let (link_type, link_target_s, link_name) = + callback(&end_link_target.take().unwrap(), &s); end_link_target = Some(CowStr::Boxed(link_target_s.into())); + if !matches!(end_link_type, Some(link) if link == LinkType::Autolink) { + end_link_type = link_type; + } Event::Text(CowStr::Boxed(link_name.into())) } Event::Code(s) if in_link => { - let (_, link_target_s, link_name) = callback(&end_link_target.take().unwrap(), &s); + let (link_type, link_target_s, link_name) = + callback(&end_link_target.take().unwrap(), &s); end_link_target = Some(CowStr::Boxed(link_target_s.into())); + if !matches!(end_link_type, Some(link) if link == LinkType::Autolink) { + end_link_type = link_type; + } Event::Code(CowStr::Boxed(link_name.into())) } _ => evt, |
