I'm trying to generate documentation using pdoc, where my docstrings look like this:
"""
I am a description of what a method does
:param param1: an integer
:param param2: a str
"""
I found this question: How to preserve line breaks when generating python docs using sphinx but the suggestion of prefixing each line with | did not work for me (it just showed up like this)
| :param param1: an integer | :param param2: a str
any ideas short of using \n at the end of every line?
So, I've been having the same issue. Just figured it out. Pdoc uses markdown. You want to use a softbreak in mark down to tell it to create a newline while still keeping things grouped. A soft break is achieved by putting two trailing spaces at the end of the line you want to end with a new line.
You can check out this tutorial to see what I mean. http://www.markdowntutorial.com/lesson/7/
Additionally, be aware of what editor you are using. It might be removing trailing spaces! Trailing spaces removed on Python heredoc lines in PyCharm
"""
I am a description of what a method does
:param param1: an integer <-- line ends right here with two spaces
:param param2: a str
"""
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With