Skip to content

Commit 4d8d55c

Browse files
committed
Fix indentation of arguments
1 parent 31c3985 commit 4d8d55c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

docstring_to_markdown/google.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import re
2+
from textwrap import dedent
23
from typing import Dict, List, Union
34

45
_GOOGLE_SECTIONS: List[str] = [
@@ -10,6 +11,7 @@
1011
"Examples",
1112
"Attributes",
1213
"Note",
14+
"Todo",
1315
]
1416

1517
ESCAPE_RULES = {
@@ -52,18 +54,21 @@ def _parse(self, content: str) -> None:
5254

5355
# Format section
5456
for part in parts:
57+
indentation = ""
58+
5559
if ":" in part[0]:
5660
spl = part[0].split(":")
5761

5862
arg = spl[0]
59-
description = ":".join(spl[1:])
63+
description = ":".join(spl[1:]).lstrip()
64+
indentation = (len(arg) + 6) * " "
6065

6166
self.content += "- `{}`: {}\n".format(arg, description)
6267
else:
6368
self.content += "- {}\n".format(part[0])
6469

6570
for line in part[1:]:
66-
self.content += " {}\n".format(line)
71+
self.content += "{}{}\n".format(indentation, line.lstrip())
6772

6873
self.content = self.content.rstrip("\n")
6974

0 commit comments

Comments
 (0)