File tree 2 files changed +6
-2
lines changed
2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,9 @@ export const linkPlugin = (
33
33
// internal anchor links
34
34
! url . startsWith ( '#' ) &&
35
35
// mail links
36
- ! url . startsWith ( 'mailto:' )
36
+ ! url . startsWith ( 'mailto:' ) &&
37
+ // links to files (other than html/md)
38
+ ! / \. (? ! h t m l | m d ) \w + ( $ | \? ) / i. test ( url )
37
39
) {
38
40
normalizeHref ( hrefAttr )
39
41
}
@@ -56,7 +58,7 @@ export const linkPlugin = (
56
58
const [ , path , hash ] = indexMatch
57
59
url = path + hash
58
60
} else {
59
- let cleanUrl = url . replace ( / \# . * $ / , '' ) . replace ( / \? .* $ / , '' )
61
+ let cleanUrl = url . replace ( / [ ? # ] .* $ / , '' )
60
62
// .md -> .html
61
63
if ( cleanUrl . endsWith ( '.md' ) ) {
62
64
cleanUrl = cleanUrl . replace ( / \. m d $ / , '.html' )
Original file line number Diff line number Diff line change @@ -107,6 +107,8 @@ export function createMarkdownToVueRenderFn(
107
107
if ( data . links ) {
108
108
const dir = path . dirname ( file )
109
109
for ( let url of data . links ) {
110
+ if ( / \. (? ! h t m l | m d ) \w + ( $ | \? ) / i. test ( url ) ) continue
111
+
110
112
if ( url . replace ( EXTERNAL_URL_RE , '' ) . startsWith ( '//localhost:' ) ) {
111
113
recordDeadLink ( url )
112
114
continue
You can’t perform that action at this time.
0 commit comments