Skip to content

adding support for relative external links#347

Merged
paul90 merged 2 commits intomainfrom
external-links
Aug 27, 2025
Merged

adding support for relative external links#347
paul90 merged 2 commits intomainfrom
external-links

Conversation

@paul90
Copy link
Member

@paul90 paul90 commented Aug 21, 2025

As mentioned on 20 Aug, adding support for using relative URLs in an external link. This removes the need for an external link to start with a protocol, though relative URLs must start with a /.

Replace rel="nofollow", as it has no real meaning, with rel="noopener", so the new tab/window will not share browsing context.

Use non-capturing groups for thing being matched (protocol), but we don't use in the replacement function, and remove them from the function's signature.

There is a remote risk that there is text match somewhere that will match as an external link, when it shouldn't. Probably a risk worth taking? Thoughts.

for relative URLs.

protocol is not used, so make a non-capturing group

wrap protocol group with a non-capturing group that matchs on protocol,
or a leading '/', to add support for relative external links.
@paul90 paul90 requested review from WardCunningham and dobbs August 21, 2025 11:06
Copy link
Member

@WardCunningham WardCunningham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the zoom walkthrough.

@paul90 paul90 merged commit 1cc8c65 into main Aug 27, 2025
3 checks passed
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.

2 participants