pierre_j
pierre_j

Reputation: 983

Make Sphinx generate reStructuredText pages from Python docstrings

I have a free private github repo. I would like to have in a docs folder the docstrings turned into rst files. This is what sphinx does, but generate html instead of rst.

For all rst files generated this way (let's imagine one rst file per python module), I intend to hyperlink it from the readme to have access to the code documentation this way (without having to rely on github pages, which I have no access to, given I have a free account).

Please, is this possible? Ideally, I would need a way to tell sphinx autodoc extension to generate documentation in rst instead of html, but I haven't found a way for this.

Is there another lib for this?

Thanks for any help, Bests,

Upvotes: 1

Views: 1003

Answers (1)

pierre_j
pierre_j

Reputation: 983

As proposed in comment from @mzjn, I used sphinxcontrib-restbuilder for this purpose. Hyperlinks work, this is perfect for my need.

I applied it on the sphinx documentation of a public project of mine, and uploaded it on this github repo for those willing to have a look.

Click on index.rst and follow the read. There do be some glitches. The API is documented in api.rst. This is really this part that is of interest for me. I think it is nice enough.

enter image description here

Upvotes: 1

Related Questions