Skip to content
This repository has been archived by the owner on Mar 25, 2022. It is now read-only.

Commit

Permalink
Merge pull request #160 from tbeadle/auto_toc_maxdepth
Browse files Browse the repository at this point in the history
Allow the Auto TOC maxdepth to be configurable.
  • Loading branch information
ericholscher committed Aug 9, 2019
2 parents 04580ae + 4bd0eab commit c4d575b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -105,6 +105,7 @@ See https://github.com/rtfd/recommonmark/blob/master/docs/conf.py for a full exa
AutoStructify comes with the following options. See [http://recommonmark.readthedocs.org/en/latest/auto_structify.html](http://recommonmark.readthedocs.org/en/latest/auto_structify.html) for more information about the specific features.

* __enable_auto_toc_tree__: enable the Auto Toc Tree feature.
* __auto_toc_maxdepth__: The max depth of the Auto Toc. Defaults to 1.
* __auto_toc_tree_section__: when True, Auto Toc Tree will only be enabled on section that matches the title.
* __enable_auto_doc_ref__: enable the Auto Doc Ref feature. **Deprecated**
* __enable_math__: enable the Math Formula feature.
Expand Down
6 changes: 5 additions & 1 deletion recommonmark/transform.py
Expand Up @@ -41,6 +41,7 @@ def __init__(self, *args, **kwargs):

default_config = {
'enable_auto_doc_ref': False,
'auto_toc_maxdepth': 1,
'auto_toc_tree_section': None,
'enable_auto_toc_tree': True,
'enable_eval_rst': True,
Expand Down Expand Up @@ -180,7 +181,10 @@ def auto_toc_tree(self, node): # pylint: disable=too-many-branches
self.current_level)
return self.state_machine.run_directive(
'toctree',
options={'maxdepth': 1, 'numbered': numbered},
options={
'maxdepth': self.config['auto_toc_maxdepth'],
'numbered': numbered,
},
content=['%s <%s>' % (k, v) for k, v in refs])

def auto_inline_code(self, node):
Expand Down

0 comments on commit c4d575b

Please sign in to comment.