@@ -997,6 +997,7 @@ fn preprocess_link(
997997 }
998998 } ;
999999
1000+ let is_shortcut_style = ori_link. kind == LinkType :: ShortcutUnknown ;
10001001 // If there's no backticks, be lenient and revert to the old behavior.
10011002 // This is to prevent churn by linting on stuff that isn't meant to be a link.
10021003 // only shortcut links have simple enough syntax that they
@@ -1013,11 +1014,24 @@ fn preprocess_link(
10131014 // | has backtick | never ignore | never ignore |
10141015 // | no backtick | ignore if url-like | never ignore |
10151016 // |-------------------------------------------------------|
1016- let ignore_urllike =
1017- can_be_url || ( ori_link. kind == LinkType :: ShortcutUnknown && !ori_link. link . contains ( '`' ) ) ;
1017+ let ignore_urllike = can_be_url || ( is_shortcut_style && !ori_link. link . contains ( '`' ) ) ;
10181018 if ignore_urllike && should_ignore_link ( path_str) {
10191019 return None ;
10201020 }
1021+ // Ignore GitHub-flavored Markdown (GFM) admonitions, such as [!NOTE] and [!IMPORTANT]
1022+ //
1023+ // rustdoc does not support GFM,
1024+ // however it is a common pattern to add `#[doc = include_str!("../README.md")]` to the root of a crate,
1025+ // so we want to at least accept GFM, even if it doesn't render perfectly.
1026+ //
1027+ // we make sure to allow `[!]` as a link to the never type.
1028+ if is_shortcut_style
1029+ && let Some ( suffix) = ori_link. link . starts_with ( '!' )
1030+ && !suffix. is_empty ( )
1031+ && suffix. chars ( ) . all ( |c| c. is_ascii_alphabetic ( ) )
1032+ {
1033+ return None ;
1034+ }
10211035
10221036 // Strip generics from the path.
10231037 let path_str = match strip_generics_from_path ( path_str) {
0 commit comments