File tree Expand file tree Collapse file tree 4 files changed +10
-6
lines changed
Expand file tree Collapse file tree 4 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -220,7 +220,7 @@ function validate(exposed, file) {
220220 // is especially useful because they might be non-markdown files. Here we
221221 // check if they exist.
222222 if ( ( real === undefined || real === null ) && ! hash && fs ) {
223- real = fs . existsSync ( reference )
223+ real = fs . existsSync ( path . join ( file . cwd , decodeURI ( reference ) ) )
224224 references [ reference ] = real
225225 }
226226
@@ -237,7 +237,7 @@ function validate(exposed, file) {
237237
238238 warning += ': `' + hash + '`'
239239 } else {
240- warning = 'Link to unknown file: `' + reference + '`'
240+ warning = 'Link to unknown file: `' + decodeURI ( reference ) + '`'
241241 ruleId = fileRuleId
242242 }
243243
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ Relative ![image reference][rel]
1212
1313Absolute ![ image reference] [ abs ]
1414
15+ Relative with whitespace ![ image reference] [ rel-whitespace ]
16+
1517<!-- Invalid: -->
1618
1719Relative ![ missing image] ( ./examples/missing.jpg )
@@ -33,3 +35,5 @@ Absolute ![missing image reference][abs-missing]
3335[ rel-missing ] : ./examples/missing.jpg
3436
3537[ abs-missing ] : https://github.com/wooorm/test/blob/master/examples/missing.jpg
38+
39+ [ rel-whitespace] : "./examples/image with space.jpg"
Original file line number Diff line number Diff line change @@ -511,11 +511,11 @@ test('remark-validate-links', function(t) {
511511 strip ( result . stderr ) ,
512512 [
513513 'images.md' ,
514- ' 17:10-17:50 warning Link to unknown file: `examples/missing.jpg` missing-file remark-validate-links' ,
515- ' 19:12-19:42 warning Link to unknown file: `examples/missing.jpg` missing-file remark-validate-links' ,
516- ' 21:10-21:91 warning Link to unknown file: `examples/missing.jpg` missing-file remark-validate-links' ,
517- ' 23:10-23:49 warning Link to unknown file: `examples/missing.jpg` missing-file remark-validate-links' ,
514+ ' 19:10-19:50 warning Link to unknown file: `examples/missing.jpg` missing-file remark-validate-links' ,
515+ ' 21:12-21:42 warning Link to unknown file: `examples/missing.jpg` missing-file remark-validate-links' ,
516+ ' 23:10-23:91 warning Link to unknown file: `examples/missing.jpg` missing-file remark-validate-links' ,
518517 ' 25:10-25:49 warning Link to unknown file: `examples/missing.jpg` missing-file remark-validate-links' ,
518+ ' 27:10-27:49 warning Link to unknown file: `examples/missing.jpg` missing-file remark-validate-links' ,
519519 '' ,
520520 '⚠ 5 warnings'
521521 ] . join ( '\n' ) ,
You can’t perform that action at this time.
0 commit comments