Skip to content

docs: convert raw URLs in generated docs and docstrings to hyperlinks - #3987

Merged
rickeylev merged 1 commit into
bazel-contrib:mainfrom
rickeylev:convert_doc_urls_hyperlinks
Aug 1, 2026
Merged

docs: convert raw URLs in generated docs and docstrings to hyperlinks#3987
rickeylev merged 1 commit into
bazel-contrib:mainfrom
rickeylev:convert_doc_urls_hyperlinks

Conversation

@rickeylev

Copy link
Copy Markdown
Collaborator

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}.

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.
Comment thread docs/conf.py


def _pep_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
match = re.search(r"\d+", text)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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?

@rickeylev
rickeylev added this pull request to the merge queue Aug 1, 2026
Merged via the queue into bazel-contrib:main with commit 3c9423a Aug 1, 2026
6 checks passed
@rickeylev
rickeylev deleted the convert_doc_urls_hyperlinks branch August 1, 2026 21:19
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