File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff 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,
You can’t perform that action at this time.
0 commit comments