Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maxdepth in package toctrees by sphinx-apidoc #2108

Open
arski opened this issue Nov 6, 2015 · 2 comments
Open

maxdepth in package toctrees by sphinx-apidoc #2108

arski opened this issue Nov 6, 2015 · 2 comments

Comments

@arski
Copy link

arski commented Nov 6, 2015

Hi,

I know sphinx-apidoc already has the -d option to set the maxdepth in the main modules TOC. However, I was wondering if this or another option could be used to add :maxdepth: to the toctree of each package, i.e. after

text += '.. toctree::\n\n'

Alternatively, how hard would it be to add a default maxdepth setting to Spinx itself, so that it would be configurable in conf.py?

Cheers

@jluttine
Copy link

Any workaround for this? The documentation generated with apidoc is a bit of a mess because it is not possible to adjust the depth of package toctrees. So a package page becomes full of submodules of subpackages of subpackages of subpackages.

@sblask
Copy link

sblask commented Jan 11, 2017

I had the same problem and as I run sphinx-apidoc from a separate script anyway, I fix it like this:

# sphinx-apidoc doesn't allow setting maxdepth on subpackages
sed -i "s/.. toctree::/.. toctree::\n   :maxdepth: 1/g" ${SCRIPT_DIRECTORY}/_generated/*
# sphinx toctree is very indentation sensitive, make it uniform
sed -i "s/    /   /g" ${SCRIPT_DIRECTORY}/_generated/*

ltalirz added a commit to ltalirz/aiida-core that referenced this issue Mar 9, 2018
Unfortunately, sphinx-apidoc currently does not allow to adjust the
tocdepth of the subpackage tocs (sphinx-doc/sphinx#2108)
ltalirz added a commit to ltalirz/aiida-core that referenced this issue Mar 23, 2018
Unfortunately, sphinx-apidoc currently does not allow to adjust the
tocdepth of the subpackage tocs (sphinx-doc/sphinx#2108)
@AA-Turner AA-Turner added this to the some future version milestone Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants