mitmproxy / mitmproxy/pdoc

External hyperlink produces garbled HTML when end of URL happens to overlap with name of identifier

Open
#817 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
2.5k
Forks
228
PR merge metrics
No merged PRs in 30d

Description

Problem Description

pdoc produces incorrect HTML when trying to link to a URL whenever the end of the URL happens to be a . followed by any identifier that appears in the project. This results in HTML that displays incorrectly and links to the wrong place. This seems to happen regardless of whether the link is written via Markdown syntax or reStructuredText syntax.

Steps to reproduce the behavior:
  1. Create issue/__init__.py like this:
    def com():
        """
        [something](https://example.com)
        """
        pass
    
  2. Run pdoc issue to generate documentation
  3. Observe the generated documentation for the com function. It produces HTML that looks like this:
    <a href="https://example<a href=" #com"="">.com</a>"&gt;something
    
    which visually renders as:
    .com">something
    
    where the .com text seems to link to the invalid URL https://example<a href=.
System Information
pdoc: 15.0.4
Python: 3.11.12
Platform: macOS-15.3.1-arm64-arm-64bit

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the reported pdoc issue reproduction and compare the generated HTML with the expected external link. Trace how the Markdown and reStructuredText hyperlink forms are processed, then verify that URLs ending in .com are preserved as external links without identifier linking or malformed HTML.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
66/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.