I can't seem to figure out how to document exceptions using Sphinx.
I've tried the following:
def some_funct(): """ :raises: ExceptionType: Some multi-line exception description. """ def some_funct(): """ :raises: ExceptionType, Some multi-line exception description. """ def some_funct(): """ :raises ExceptionType: Some multi-line exception description. """ def some_funct(): """ :raises: ExceptionType: Some multi-line exception description. """
Sphinx keeps saying:
"Field list ends without a blank line; unexpected unindent."
So how do I get rid of the message and what is the proper way to document possibly multiple exceptions with multiple-line documentation?
To support Markdown-based documentation, Sphinx can use MyST-Parser. MyST-Parser is a Docutils bridge to markdown-it-py, a Python package for parsing the CommonMark Markdown flavor.
You can use a backslash for line continuation:
def some_funct(): """ :raises ExceptionType: Some multi-line \ exception description. """
Update:
Indenting seems to work instead of escaping the newline:
def some_funct(): """ :raises ExceptionType: Some multi-line exception description. """
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