Repository navigation
Recognize additional URL schemes in automatic links - #1675
Open
girinataraj wants to merge 2 commits into
Open
girinataraj wants to merge 2 commits into
girinataraj wants to merge 2 commits into
Conversation
added 2 commits
October 24, 2026 15:29
Match letter-led URL schemes instead of limiting automatic links to HTTP and FTP. Preserve the existing delimiter, destination matching, email handling, and raw HTML behavior. Add regression tests for scheme variants, query escaping, adjacent links, code spans, and incomplete or invalid links. Document the expanded syntax. Fixes Python-Markdown#1244
Verify that SSH and compound-scheme URLs with user information take precedence over email matching. Classify the syntax expansion as an added feature and wrap the documentation to the project limit. Follow up on Python-Markdown#1244.
Member
|
After reviewing the discussion in #1244 I can see you provided the fix I suggested. I am not yet convinced this is the best approach. I will have to think about it. |
Author
|
Understood. I’m happy to revise the implementation if you decide a different approach would fit the project better. |
Author
|
One more conservative option would be to preserve the existing HTTP/FTP matching and require a nonempty destination without whitespace for additional schemes. The current patch also recognizes Would that address your concern, or are you reconsidering broader scheme recognition in the default parser? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Automatic links currently recognize only HTTP and FTP schemes. Other schemes
are emitted as raw markup, or incorrectly matched as email addresses when the
URL contains user information. For example:
The before example above decodes the HTML entities used to obfuscate email
addresses for readability.
Replace the hard-coded scheme alternatives with a letter-led scheme pattern,
allowing letters, digits,
+,.and-after the first character. Keep theexisting
://delimiter, destination matching and link renderer. This followsthe URL expansion discussed in #1244; raw HTML handling and URI forms without
://, such as<urn:foo>, remain unchanged.Add tests for SSH and Git URLs with user information, scheme variants,
query-string escaping, link boundaries and code spans. Update the syntax
documentation and add an unreleased changelog entry under Added.
Fixes #1244.
Validation on Windows, CPython 3.12.14:
regression fails for both cases when run with the upstream pattern.
HTML Tidy and pinned Pygments environments were not exercised.
pre-existing E201/E202 errors in the untouched
markdown/postprocessors.py:90.Other Python versions and documentation/link/spelling builds were not run.
AI Assistance Disclosure
No AI tools were used in preparing this PR.
AI tools were used and I have disclosed which ones, and have fully reviewed and verified their output.
OpenAI Codex assisted with issue research, reproduction, implementation,
tests, documentation, changelog, commit message and this PR description.
A Codex sub-agent reviewed the local patch; no automated AI review has
been requested on this upstream PR.
AI tools were used to assist with the following:
Checklist