Patrick Wolf
Patrick Wolf

Reputation: 2569

How to generate one page per module with sphinx

We are using Sphinx to generate our Python documentation.

This is the command line we use:

sphinx-apidoc -F -o %WORKSPACE%\docs_rst %PACKAGE%

sphinx-build -b html %WORKSPACE%\docs_rst %WORKSPACE%\docs

The problem is that we get one page per package. What we would really need though is one page per module as the page gets way too long otherwise.

How would I set this up please?

Upvotes: 15

Views: 4526

Answers (2)

JesseReichler
JesseReichler

Reputation: 266

I have submitted a patch to Sphinx to do exactly what you are asking for -- it adds a commandline option to apidoc that will put each module on its own page.

Patch can be viewed here: https://bitbucket.org/birkenfeld/sphinx/pull-request/161/added-option-to-apidoc-to-write-each

It's currently pending a merge into Sphinx, the command will add a separate tag that will work thusly:

sphinx-apidoc -o [output_dir] [package_dir] --separate

Upvotes: 25

Kevin Horn
Kevin Horn

Reputation: 4295

You might be able to do something like this using the autosummary extension and the sphinx-autogen script (possibly using custom templates).

Upvotes: 1

Related Questions