NiklasRosenstein / python-docspec

Docspec is a JSON object specification for representing API documentation of programming languages.
https://niklasrosenstein.github.io/python-docspec/
Other
16 stars 6 forks source link

Significant leading whitespace is removed #77

Closed ahopkins closed 2 years ago

ahopkins commented 2 years ago

Describe the bug Leading whitespace in a docstring that is significant (for example inside a codeblock) is removed.

To Reproduce

def is_auto_exec(func) -> bool:
    """Check if a method should be auto-executed.

    Example:

        Any of the following are acceptable:

        ```python
            async def method_ellipsis(self) -> None:
                ...

            async def method_pass(self) -> None:
                pass

            async def method_docstring(self) -> None:
                '''This is a docstring'''
Args:
    func: The function or method being checked

Returns:
    bool: Whether the function is empty and should be auto-executed
"""


**Expected behavior**
The whitespace inside of the python code block is preserved

**Screenshots**
![image](https://user-images.githubusercontent.com/166269/184850037-9cca14e5-1011-4b8a-95f6-9398a8e9b93b.png)
ahopkins commented 2 years ago

So, I realize that if I remove the indent from the block inside Example it works as expected.