diff --git a/autoapi/extension.py b/autoapi/extension.py index fc4a8c9..c6ee05a 100644 --- a/autoapi/extension.py +++ b/autoapi/extension.py @@ -167,6 +167,7 @@ def setup(app): app.add_config_value('autoapi_add_toctree_entry', True, 'html') app.add_config_value('autoapi_add_api_root_toctree', False, 'html') app.add_config_value('autoapi_template_dir', None, 'html') + app.add_config_value('autoapi_include_summaries', False, 'html') app.add_stylesheet('autoapi.css') directives.register_directive('autoapi-nested-parse', NestedParse) directives.register_directive('autoapisummary', AutoapiSummary) diff --git a/autoapi/mappers/base.py b/autoapi/mappers/base.py index afaacb8..c2d0974 100644 --- a/autoapi/mappers/base.py +++ b/autoapi/mappers/base.py @@ -290,7 +290,9 @@ class SphinxMapperBase(object): def output_rst(self, root, source_suffix): for id, obj in self.objects.items(): - rst = obj.render() + rst = obj.render( + include_summaries=self.app.config.autoapi_include_summaries, + ) if not rst: continue diff --git a/autoapi/templates/python/module.rst b/autoapi/templates/python/module.rst index ab34408..f72ca90 100644 --- a/autoapi/templates/python/module.rst +++ b/autoapi/templates/python/module.rst @@ -41,6 +41,7 @@ Submodules {{ obj.type|title }} Contents {{ "-" * obj.type|length }}--------- +{% if include_summaries %} {% block classes %}{% if obj.classes %} Classes ~~~~~~~ @@ -71,6 +72,7 @@ Functions {{ function.id }} {%- endfor %} {% endif %}{% endblock %} +{% endif %} {%- for obj_item in obj.children %} diff --git a/docs/config.rst b/docs/config.rst index 7bb9d6a..cd1d9b8 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -57,6 +57,12 @@ Customization Options Relative path to output the AutoAPI files into +.. confval:: autoapi_include_summaries + + Default: ``False`` + + Whether include autosummary directives in generated module documentation. + Debugging Options -----------------