pdoc3 / pdoc

:snake: :arrow_right: :scroll: Auto-generate API documentation for Python projects
https://pdoc3.github.io/pdoc/
GNU Affero General Public License v3.0
1.13k stars 145 forks source link

Continuation char in doctests lead to unsightly gaps in HTML generated documentation #406

Closed bje- closed 2 years ago

bje- commented 2 years ago

Expected Behavior

Whitespace after the backslash should be ignored until the first non-whitespace character is encountered.

Actual Behavior

Too much whitespace is shown in the generated documentation. See the first docstring for the Battery class, for example. Source code can be expanded from the top right of this page for reference.

Additional info

kernc commented 2 years ago

Whitespace after the backslash should be ignored until the first non-whitespace character is encountered.

I'm quite sure backslash is meant to cancel only the first following newline character, not all whitespace. Compare:

>>> '\
...              foo'

'             foo'

Have you tried marking your doctest/example like so:

>>> b = Battery(polygons.WILDCARD, 400, 2,
...             discharge_hours=hours, rte=1)
>>> b.stored = 400

?