| 444 | TreeProcessorClass = TocTreeprocessor |
| 445 | |
| 446 | def __init__(self, **kwargs): |
| 447 | self.config = { |
| 448 | 'marker': [ |
| 449 | '[TOC]', |
| 450 | 'Text to find and replace with Table of Contents. Set to an empty string to disable. ' |
| 451 | 'Default: `[TOC]`.' |
| 452 | ], |
| 453 | 'title': [ |
| 454 | '', 'Title to insert into TOC `<div>`. Default: an empty string.' |
| 455 | ], |
| 456 | 'title_class': [ |
| 457 | 'toctitle', 'CSS class used for the title. Default: `toctitle`.' |
| 458 | ], |
| 459 | 'toc_class': [ |
| 460 | 'toc', 'CSS class(es) used for the link. Default: `toclink`.' |
| 461 | ], |
| 462 | 'anchorlink': [ |
| 463 | False, 'True if header should be a self link. Default: `False`.' |
| 464 | ], |
| 465 | 'anchorlink_class': [ |
| 466 | 'toclink', 'CSS class(es) used for the link. Defaults: `toclink`.' |
| 467 | ], |
| 468 | 'permalink': [ |
| 469 | 0, 'True or link text if a Sphinx-style permalink should be added. Default: `False`.' |
| 470 | ], |
| 471 | 'permalink_class': [ |
| 472 | 'headerlink', 'CSS class(es) used for the link. Default: `headerlink`.' |
| 473 | ], |
| 474 | 'permalink_title': [ |
| 475 | 'Permanent link', 'Title attribute of the permalink. Default: `Permanent link`.' |
| 476 | ], |
| 477 | 'permalink_leading': [ |
| 478 | False, |
| 479 | 'True if permalinks should be placed at start of the header, rather than end. Default: False.' |
| 480 | ], |
| 481 | 'baselevel': ['1', 'Base level for headers. Default: `1`.'], |
| 482 | 'slugify': [ |
| 483 | slugify, 'Function to generate anchors based on header text. Default: `slugify`.' |
| 484 | ], |
| 485 | 'separator': ['-', 'Word separator. Default: `-`.'], |
| 486 | 'toc_depth': [ |
| 487 | 6, |
| 488 | 'Define the range of section levels to include in the Table of Contents. A single integer ' |
| 489 | '(b) defines the bottom section level (<h1>..<hb>) only. A string consisting of two digits ' |
| 490 | 'separated by a hyphen in between (`2-5`) defines the top (t) and the bottom (b) (<ht>..<hb>). ' |
| 491 | 'Default: `6` (bottom).' |
| 492 | ], |
| 493 | } |
| 494 | """ Default configuration options. """ |
| 495 | |
| 496 | super().__init__(**kwargs) |
| 497 | |
| 498 | def extendMarkdown(self, md): |
| 499 | """ Register the processor. |