mirror of
https://github.com/vale981/recommonmark
synced 2025-03-05 10:01:39 -05:00
Merge pull request #160 from tbeadle/auto_toc_maxdepth
Allow the Auto TOC maxdepth to be configurable.
This commit is contained in:
commit
c4d575bd7b
2 changed files with 6 additions and 1 deletions
|
@ -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.
|
||||
|
|
|
@ -41,6 +41,7 @@ class AutoStructify(transforms.Transform):
|
|||
|
||||
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,
|
||||
|
@ -180,7 +181,10 @@ class AutoStructify(transforms.Transform):
|
|||
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):
|
||||
|
|
Loading…
Add table
Reference in a new issue