docs: convert raw URLs in generated docs and docstrings to hyperlinks - #3987
Merged
rickeylev merged 1 commit intoAug 1, 2026
Merged
Conversation
Plain text URLs in documentation and docstrings were not clickable in
the rendered HTML output. This converts raw URLs into MyST autolinks,
Markdown links, and adds a custom {pep} role for Python Enhancement Proposals.
rickeylev
enabled auto-merge
August 1, 2026 19:07
dougthor42
approved these changes
Aug 1, 2026
|
|
||
|
|
||
| def _pep_role(name, rawtext, text, lineno, inliner, options={}, content=[]): | ||
| match = re.search(r"\d+", text) |
Collaborator
There was a problem hiding this comment.
I'm not familiar with what Sphinx/MyST passes as text to this function - is it the full text of the markdown file? Or just what's inside the role backticks?
If the former, this pattern is overly broad, yeah?
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.
Plain text URLs in documentation Markdown files and Starlark/Python docstrings were rendered as non-clickable text in the generated HTML output, making navigation cumbersome.
To fix this, raw URLs are converted into MyST autolinks (https://...), Markdown links, and {gh-issue} roles. A custom {pep} Sphinx role is also introduced in docs/conf.py to dynamically resolve PEP numbers to https://peps.python.org/pep-XXXX/, and existing PEP references in docstrings are updated to use {pep}.