Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 6, 2025

GitHub UI uses angle bracket syntax [text](<file name.md>) for links with spaces, but the plugin failed to match these against actual files, breaking links on GitHub Pages.

Changes

  • Added strip_angle_brackets method to remove wrapping angle brackets from link paths before processing
  • Updated link_parts to apply stripping to captured paths from both inline and reference-style links
  • Added test coverage for raw spaces, angle bracket syntax, and URL-encoded combinations

Supported formats

All now convert to proper Jekyll URLs (/file%20name.html):

[link](page with space.md)           # Raw spaces
[link](<page with space.md>)         # Angle brackets (now fixed)
[link](page%20with%20space.md)       # URL-encoded
[ref]: <page with space.md>          # Reference style (now fixed)

The fix uses regex \A<(.+)>\z with anchors to safely strip only fully-wrapped paths.

Original prompt

This section details on the original issue you should resolve

<issue_title>Adding links to .md with space in the name</issue_title>
<issue_description>I've tried several strategies, but none truely works.
Here is the repo/file that demonstrates the issue: https://github.com/EugeneLoy/ghp-test/blob/main/README.md
Url to Github pages of this repo is: https://eugeneloy.github.io/ghp-test/

[1] works fine, since there is no space in filename.
[2] works on Github pages url, but does not work in Github UI, since it does not adhere to GFM (I guess).
[3] - [7] all fail to work on Github pages url (some of them work in Github UI though).

I am not sure whether this behavior is a bug or what I want can be classified as feature request, but I would like to know how to achieve links to .md files with spaces in filenames that work both in Github UI and on Github pages. If there are some workarounds that can achieve this - I would also like to know.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Fix links to .md files with spaces in filenames Support angle bracket syntax for links to files with spaces Nov 6, 2025
Copilot AI requested a review from benbalter November 6, 2025 22:36
Copilot finished work on behalf of benbalter November 6, 2025 22:36
@benbalter benbalter marked this pull request as ready for review November 6, 2025 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adding links to .md with space in the name

2 participants