Skip to content

Commit 4971487

Browse files
committed
Fix argument list highlighting formatting
1 parent 87285b1 commit 4971487

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/lazydocs/generation.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,14 +574,20 @@ def _lines_isvalid(lines: list, start_index: int, blockindent: int,
574574
out.append("\n")
575575
out.append("**{}**\n".format(line.strip()))
576576
elif indent > blockindent and (arg_list or section_block):
577-
if arg_list and not literal_block and _RE_TYPED_ARGSTART.match(line):
577+
if all([arg_list,
578+
not literal_block,
579+
(indent <= argindent if argindent else indent),
580+
_RE_TYPED_ARGSTART.match(line)]):
578581
# start of new argument
579582
out.append(
580583
"- "
581584
+ _RE_TYPED_ARGSTART.sub(r"<b>`\1`</b> (\2): \3", line)
582585
)
583586
argindent = indent
584-
elif arg_list and not literal_block and _RE_ARGSTART.match(line):
587+
elif all([arg_list,
588+
not literal_block,
589+
(indent <= argindent if argindent else indent),
590+
_RE_ARGSTART.match(line)]):
585591
# start of an exception-type block
586592
out.append(
587593
"- "

0 commit comments

Comments
 (0)