I'm trying to use Sphinx to auto-generate API documentation for a Python library, and I can't make it properly format the example code snippets in the docstrings - they do get indented but lines of the same indentation get concatenated (https://weka-io.github.io/easypy)
I understand that the problem is that the format I'm using to mark the code blocks is Markdown (indent them by 4 spaces) but Sphinx is expecting reStructuredText (code-block::
)
I've tried googling for a solution and it recommended using recommonmark - but it seems to be for using .md
files as the source. I'm using sphinx-apidoc
to generate the "source" .rst
files from the Python code - so it's not going to work (unless there is a way to make sphinx-apidoc
generate .md
files instead)
So - how do I make Sphinx treat just the Python docstrings as Markdown, leaving the elaborate reStructuredText framework as is for everything else?