Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit b7e3f52

Browse files
committed
handle autolink as edge case
1 parent c6f776c commit b7e3f52

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

crates/ide/src/doc_links.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,13 +382,21 @@ fn map_links<'e>(
382382
))
383383
}
384384
Event::Text(s) if in_link => {
385-
let (_, link_target_s, link_name) = callback(&end_link_target.take().unwrap(), &s);
385+
let (link_type, link_target_s, link_name) =
386+
callback(&end_link_target.take().unwrap(), &s);
386387
end_link_target = Some(CowStr::Boxed(link_target_s.into()));
388+
if !matches!(end_link_type, Some(link) if link == LinkType::Autolink) {
389+
end_link_type = link_type;
390+
}
387391
Event::Text(CowStr::Boxed(link_name.into()))
388392
}
389393
Event::Code(s) if in_link => {
390-
let (_, link_target_s, link_name) = callback(&end_link_target.take().unwrap(), &s);
394+
let (link_type, link_target_s, link_name) =
395+
callback(&end_link_target.take().unwrap(), &s);
391396
end_link_target = Some(CowStr::Boxed(link_target_s.into()));
397+
if !matches!(end_link_type, Some(link) if link == LinkType::Autolink) {
398+
end_link_type = link_type;
399+
}
392400
Event::Code(CowStr::Boxed(link_name.into()))
393401
}
394402
_ => evt,

0 commit comments

Comments
 (0)