xrefcheck
xrefcheck copied to clipboard
[BUG] Spaces in local links
Description
Say we have a file named a b.md.
The naive attempt to link to this file would be to use [link](a b.md), but the commonmark spec says that's not a valid link, see example 487. That will just be rendered as a plain text literal, not as a link.
The spec clarifies:
The destination can only contain spaces if it is enclosed in pointy brackets:
Which means there are two correct ways to refer to this file:
- By using pointy brackets:
[link](<a b.md>) - By percent-encoding the space:
[link](a%20.md)
Xrefcheck says (1) is indeed valid, but it reports (2) as a broken link (which it isn't).
To Reproduce
Steps to reproduce the behavior:
$ touch 'a b.md'
$ echo "[link](a%20b.md)" > test.md
$ xrefcheck --include-untracked
Configuration file not found, using default config for GitHub repositories
=== Invalid references found ===
➥ In file test.md
bad reference (relative) at src:1:1-16:
- text: "link"
- link: a%20b.md
- anchor: -
File does not exist:
a%20b.md
Invalid references dumped, 1 in total.
Expected behavior
Expected the steps above to succeed without errors
Environment
- d1f465048eb2d9f345dbcfcc645a07440c7ebe80
:pogchamp: Interesting spot!