pdoc
pdoc copied to clipboard
External hyperlink produces garbled HTML when end of URL happens to overlap with name of identifier
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:
- Create
issue/__init__.pylike this:def com(): """ [something](https://example.com) """ pass - Run
pdoc issueto generate documentation - Observe the generated documentation for the
comfunction. It produces HTML that looks like this:
which visually renders as:<a href="https://example<a href=" #com"="">.com</a>">something
where the.com">something.comtext seems to link to the invalid URLhttps://example<a href=.
System Information
pdoc: 15.0.4
Python: 3.11.12
Platform: macOS-15.3.1-arm64-arm-64bit