You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using a Google-style code block retains its indentation and does not render correctly in markdown (VS Code and GitHub rendering).
Simple Python example (in src/module-test.py):
fromtypingimportUnion, Optional, Anydefstr_test(
in_str: Any,
num: int
) ->str:
""" Prints something to the screen and adds 'something' to the end. Args: in_str (Any): any string num: Number of times to add 'something' at the end in order to test how this darn thing works Returns: str: String with 'something' added Raises: Example: How to use: ```python # A comment msg = str_test("Hello", 2) print(msg) ``` """msg=str(in_str)
foriinrange(num):
msg=f"{msg} something"returnmsgif__name__=="__main__":
text=str_test("hello", 2)
print(text)
<a id="module-test"></a>
# module-test
<a id="module-test.str_test"></a>
#### str\_test
```python
def str_test(in_str: Any, num: int) -> str
```
Prints something to the screen and adds 'something' to the end.
**Arguments**:
- `in_str` _Any_ - any string
- `num` - Number of times to add 'something' at the end in order to test
how this darn thing works
**Returns**:
- `str` - String with 'something' added
**Raises**:
**Example**:
How to use:
```python
# A comment
msg = str_test("Hello", 2)
print(msg)
```
The extra indentation on the code block renders the backticks as follows:
I've tried many different combinations of with/without backticks and indentations. It either renders as shown above or does not render the code block at all (treated as markdown text).
Any idea on how to format the Google-style docstring to make the code block render correctly?
Expected behavior
Google-style docstring with "Examples:" section should render correctly in markdown.
The text was updated successfully, but these errors were encountered:
I had a quick solution, which I didn't put as a pull request as it seemed a bit hacky and I didn't check the tests, but for me it worked.
I simply added 4 lines to the google processor
Hope this helps in resolving the issue.
Environment
Describe the bug
Using a Google-style code block retains its indentation and does not render correctly in markdown (VS Code and GitHub rendering).
Simple Python example (in src/module-test.py):
Produce markdown with:
module-test.md has the following:
The extra indentation on the code block renders the backticks as follows:
I've tried many different combinations of with/without backticks and indentations. It either renders as shown above or does not render the code block at all (treated as markdown text).
Any idea on how to format the Google-style docstring to make the code block render correctly?
Expected behavior
Google-style docstring with "Examples:" section should render correctly in markdown.
The text was updated successfully, but these errors were encountered: