kalekundert / autoclasstoc

Sphinx plugin to make easier-to-navigate class documentation.
MIT License
18 stars 7 forks source link

Private members are listed in the toc #1

Open funkyfuture opened 4 years ago

funkyfuture commented 4 years ago

ciao, thanks for implementing and publishing this extension!

i have this config in the conf.py:

autodoc_default_options = {
    "inherited-members": True,
    "members": True,
}

and within the autoclass directives in my docs, there's only the autoclasstoc directive. however, unlike i expected, private members of a class and its ancestors are appearing in the toc, not in the detailed list of members. am i missing something or does this qualify as a bug?

kalekundert commented 4 years ago

It's not a bug, but it's understandably confusing behavior. What's happening is that autoclasstoc doesn't read the same configuration values as autodoc. In other words, autodoc_default_options doesn't affect autoclasstoc at all. What you need to do is configure autoclasstoc_sections:

autoclasstoc_sections = ['public-methods']

The default is ['public-methods', 'private-methods'], so the above will change that to only show public methods.

Thinking about it more, though, it would be good to make the default behavior consistent with autodoc_default_options. I'll have to think about the best way to do it, but it shouldn't be too hard.