fomar files

This commit is contained in:
Kyle Lin 2023-07-01 01:29:40 +08:00
parent fe17ae3af6
commit 78c85f439f
2 changed files with 17 additions and 5 deletions

View File

@ -410,7 +410,14 @@ fn parse_links<'md>(doc: &'md str) -> Vec<Box<str>> {
while let Some(event) = event_iter.next() {
match event {
Event::Start(Tag::Link(link_type, dest, _)) if may_be_doc_link(link_type) => {
if matches!(link_type, LinkType::Inline | LinkType::ReferenceUnknown | LinkType::Reference) {
if matches!(
link_type,
LinkType::Inline
| LinkType::ReferenceUnknown
| LinkType::Reference
| LinkType::Shortcut
| LinkType::ShortcutUnknown
) {
if let Some(display_text) = collect_link_data(&mut event_iter) {
links.push(display_text);
}

View File

@ -34,7 +34,7 @@ pub(crate) fn visit_item(cx: &DocContext<'_>, item: &Item) {
if item.link_names(&cx.cache).is_empty() {
// If there's no link names in this item,
// then we skip resolution querying to
// then we skip resolution querying to
// avoid from panicking.
return;
}
@ -80,7 +80,8 @@ fn check_redundant_explicit_link<'md>(
if (explicit_len >= display_len
&& &explicit_link[(explicit_len - display_len)..] == display_link)
|| (display_len >= explicit_len
&& &display_link[(display_len - explicit_len)..] == explicit_link) {
&& &display_link[(display_len - explicit_len)..] == explicit_link)
{
match link_type {
LinkType::Inline | LinkType::ReferenceUnknown => {
check_inline_or_reference_unknown_redundancy(
@ -92,7 +93,11 @@ fn check_redundant_explicit_link<'md>(
link_range,
dest.to_string(),
link_data,
if link_type == LinkType::Inline { (b'(', b')') } else { (b'[', b']') },
if link_type == LinkType::Inline {
(b'(', b')')
} else {
(b'[', b']')
},
);
}
LinkType::Reference => {
@ -110,7 +115,7 @@ fn check_redundant_explicit_link<'md>(
_ => {}
}
}
},
}
_ => {}
}
}