Skip to content

Mangled code block when using --docformat google #775

Open

Description

@michael1006

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

Activity

  1. mhils commented on Feb 12, 2025

    @mhils
    Member

    Clearly a bug in https://github.com/mitmproxy/pdoc/blob/main/pdoc/docstrings.py, contributions welcome! 😃

  2. added a commit that references this issue on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions