mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-29 06:23:25 +00:00
handle autolink as edge case
This commit is contained in:
parent
c6f776c5f9
commit
b7e3f525bd
1 changed files with 10 additions and 2 deletions
|
@ -382,13 +382,21 @@ fn map_links<'e>(
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
Event::Text(s) if in_link => {
|
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()));
|
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::Text(CowStr::Boxed(link_name.into()))
|
||||||
}
|
}
|
||||||
Event::Code(s) if in_link => {
|
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()));
|
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()))
|
Event::Code(CowStr::Boxed(link_name.into()))
|
||||||
}
|
}
|
||||||
_ => evt,
|
_ => evt,
|
||||||
|
|
Loading…
Reference in a new issue