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
{{ message }}
Repository navigation
newlines not preserved in google param description #61
When a parameter contains new lines between the first line and the rest, those new lines are collapsed into a single new line.
defasdf():
'''asdf Arguments: x (int): asdfkjaslfdk ajskdfljalsdk '''print(dcp.compose(dcp.parse(asdf.__doc__)))
Renders:
asdf
Args:
x (int): asdfkjaslfdk
ajskdfljalsdk
And this happens even if there's more lines (3, 4, etc.)
But it should restore it faithfully:
asdf
Args:
x (int): asdfkjaslfdk
ajskdfljalsdk
Solution
The problem happens because inspect.cleandoc strips the leading whitespace between the first line and the rest of the description. So the solution is to separate out the leading blank lines and then add them back in after calling cleandoc.
Thanks for the report and for tracking down where the blank line got lost. Parsing already keeps the blank line since #137, so x's description is asdfkjaslfdk\n\najskdfljalsdk. Composing still wrote that blank line as indent spaces; this is fixed in #196, now on main, which makes it an empty line in Google, Numpydoc and Epydoc, so the example comes back exactly as written.
Activity
rr- commentedon Nov 7, 2026
Thanks for the report and for tracking down where the blank line got lost. Parsing already keeps the blank line since #137, so
x's description isasdfkjaslfdk\n\najskdfljalsdk. Composing still wrote that blank line as indent spaces; this is fixed in #196, now on main, which makes it an empty line in Google, Numpydoc and Epydoc, so the example comes back exactly as written.