Skip to content

🐛 FIX: Preserve IPv6 host brackets in normalized URLs - #459

Open
Jinyong-Li wants to merge 1 commit into
executablebooks:masterfrom
Jinyong-Li:fix/ipv6-link-brackets
Open

Jinyong-Li wants to merge 1 commit into
executablebooks:masterfrom
Jinyong-Li:fix/ipv6-link-brackets

Conversation

@Jinyong-Li

Copy link
Copy Markdown

Summary

Rendering [app](http://[::1]:8000/) currently produces an href of http://%5B::1%5D:8000/. The brackets delimit the IPv6 host and need to survive URL normalization.

Encode the URL components before mdurl.format() adds the host brackets. This keeps brackets in paths, queries and fragments percent-encoded. The regression cases cover inline links, scheme-relative links, autolinks and images.

This ports the behavior from markdown-it/markdown-it#1204.

Testing

  • The four new URL fixtures fail on the base commit and pass with this change.
  • tox -e py312 -x 'testenv.pass_env+=PYTHONUTF8' -- tests/ -q with PYTHONUTF8=1 on Windows passed all 1,036 tests.
  • pre-commit run --all-files passed, including Ruff and mypy.

Copilot AI balanced review requested due to automatic review settings November 6, 2026 23:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

This branch has not been deployed

No deployments
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