mitmproxy / mitmproxy/pdoc

Mangled code block when using --docformat google

Open
#775 1 comment 0 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

When using --docformat google, content inside my triple-backtick code block is being mangled.

Steps to reproduce the behavior:
  1. Attach the following docstring to a function:
    """
    Lorem dolor sit amet.

    ```
    ABC:
        DEF
    GHI
    ```
    """
  1. Compile using --docformat google

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

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 with the attached reproducer and compile it using --docformat google. Trace how the Google docstring content becomes the generated

 element, then verify that the block preserves “ABC:\n    DEF\nGHI” rather than the mangled output.

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
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.