Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Spaces in local links #279

Open
dcastro opened this issue Mar 24, 2023 · 1 comment
Open

[BUG] Spaces in local links #279

dcastro opened this issue Mar 24, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@dcastro
Copy link
Member

dcastro commented Mar 24, 2023

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:

  1. By using pointy brackets: [link](<a b.md>)
  2. 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

@Martoon-00
Copy link
Member

:pogchamp: Interesting spot!

@int-index int-index added the bug Something isn't working label Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants