pdoc
pdoc copied to clipboard
Mangled code block when using --docformat google
Problem Description
When using --docformat google, content inside my triple-backtick code block is being mangled.
Steps to reproduce the behavior:
- Attach the following docstring to a function:
"""
Lorem dolor sit amet.
```
ABC:
DEF
GHI
```
"""
-
Compile using
--docformat google -
Resulting <pre><code> element contains:
###### ABC:
> DEF
GHI
When expected content is:
ABC:
DEF
GHI
See reproducer file:
2025-02-11 - pdoc code block.zip
Note that when the colon is removed after "ABC", it does not get mangled. The text is not dependent on "ABC", it can be anything.
System Information
pdoc: 15.0.1 Python: 3.12.8 Platform: macOS-15.3-arm64-arm-64bit
Clearly a bug in https://github.com/mitmproxy/pdoc/blob/main/pdoc/docstrings.py, contributions welcome! 😃