File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -112,3 +112,10 @@ fn bench_hash_path_long(b: &mut test::Bencher) {
112
112
113
113
black_box ( hasher. finish ( ) ) ;
114
114
}
115
+
116
+ #[ bench]
117
+ fn bench_path_starts_with ( b : & mut test:: Bencher ) {
118
+ let path = Path :: new ( "a/b/c/d/././e//f/g/" ) ;
119
+ let prefix = "a/b//c/d/e" ;
120
+ b. iter ( || black_box ( path) . starts_with ( black_box ( prefix) ) ) ;
121
+ }
Original file line number Diff line number Diff line change @@ -997,6 +997,7 @@ fn preprocess_link(
997
997
}
998
998
} ;
999
999
1000
+ let is_shortcut_style = ori_link. kind == LinkType :: ShortcutUnknown ;
1000
1001
// If there's no backticks, be lenient and revert to the old behavior.
1001
1002
// This is to prevent churn by linting on stuff that isn't meant to be a link.
1002
1003
// only shortcut links have simple enough syntax that they
@@ -1014,10 +1015,15 @@ fn preprocess_link(
1014
1015
// | no backtick | ignore if url-like | never ignore |
1015
1016
// |-------------------------------------------------------|
1016
1017
let ignore_urllike =
1017
- can_be_url || ( ori_link . kind == LinkType :: ShortcutUnknown && !ori_link. link . contains ( '`' ) ) ;
1018
+ can_be_url || ( is_shortcut_style && !ori_link. link . contains ( '`' ) ) ;
1018
1019
if ignore_urllike && should_ignore_link ( path_str) {
1019
1020
return None ;
1020
1021
}
1022
+ // ignore github flavored markdown special blockquotes,
1023
+ // such as [!NOTE] and [!IMPORTANT]
1024
+ if is_shortcut_style && ori_link. link . starts_with ( '!' ) && ori_link. link [ 1 ..] . chars ( ) . all ( |c| c. is_ascii_alphabetic ( ) ) {
1025
+ return None ;
1026
+ }
1021
1027
1022
1028
// Strip generics from the path.
1023
1029
let path_str = match strip_generics_from_path ( path_str) {
You can’t perform that action at this time.
0 commit comments