(self, md: Markdown, config: dict[str, Any])
| 240 | """ Step through document and build TOC. """ |
| 241 | |
| 242 | def __init__(self, md: Markdown, config: dict[str, Any]): |
| 243 | super().__init__(md) |
| 244 | |
| 245 | self.marker: str = config["marker"] |
| 246 | self.title: str = config["title"] |
| 247 | self.base_level = int(config["baselevel"]) - 1 |
| 248 | self.slugify = config["slugify"] |
| 249 | self.sep = config["separator"] |
| 250 | self.toc_class = config["toc_class"] |
| 251 | self.title_class: str = config["title_class"] |
| 252 | self.use_anchors: bool = parseBoolValue(config["anchorlink"]) |
| 253 | self.anchorlink_class: str = config["anchorlink_class"] |
| 254 | self.use_permalinks = parseBoolValue(config["permalink"], False) |
| 255 | if self.use_permalinks is None: |
| 256 | self.use_permalinks = config["permalink"] |
| 257 | self.permalink_class: str = config["permalink_class"] |
| 258 | self.permalink_title: str = config["permalink_title"] |
| 259 | self.permalink_leading: bool | None = parseBoolValue(config["permalink_leading"], False) |
| 260 | self.header_rgx = re.compile("[Hh][123456]") |
| 261 | if isinstance(config["toc_depth"], str) and '-' in config["toc_depth"]: |
| 262 | self.toc_top, self.toc_bottom = [int(x) for x in config["toc_depth"].split('-')] |
| 263 | else: |
| 264 | self.toc_top = 1 |
| 265 | self.toc_bottom = int(config["toc_depth"]) |
| 266 | |
| 267 | def iterparent(self, node: etree.Element) -> Iterator[tuple[etree.Element, etree.Element]]: |
| 268 | """ Iterator wrapper to get allowed parent and child all at once. """ |
nothing calls this directly
no test coverage detected