class_docstr: Step through document and build TOC. 
class_docstr_tok: ["Step","through","document","and","build","TOC","."]
code: def __init__(self, md: Markdown, config: dict[str, Any]):
      super().__init__(md)
  
      self.marker: str = config["marker"]
      self.title: str = config["title"]
      self.base_level = int(config["baselevel"]) - 1
      self.slugify = config["slugify"]
      self.sep = config["separator"]
      self.toc_class = config["toc_class"]
      self.title_class: str = config["title_class"]
      self.use_anchors: bool = parseBoolValue(config["anchorlink"])
      self.anchorlink_class: str = config["anchorlink_class"]
      self.use_permalinks = parseBoolValue(config["permalink"], False)
      if self.use_permalinks is None:
          self.use_permalinks = config["permalink"]
      self.permalink_class: str = config["permalink_class"]
      self.permalink_title: str = config["permalink_title"]
      self.permalink_leading: bool | None = parseBoolValue(
          config["permalink_leading"], False
      )
      self.header_rgx = re.compile("[Hh][123456]")
      if (
          isinstance(config["toc_depth"], str)
          and "-" in config["toc_depth"]
      ):
          self.toc_top, self.toc_bottom = [
              int(x) for x in config["toc_depth"].split("-")
          ]
      else:
          self.toc_top = 1
          self.toc_bottom = int(config["toc_depth"])
  
imports: from __future__ import annotations
  from .None import Extension
  from ..treeprocessors import Treeprocessor
  from ..util import code_escape, parseBoolValue, AMP_SUBSTITUTE, HTML_PLACEHOLDER_RE, AtomicString
  from ..treeprocessors import UnescapeTreeprocessor
  import re
  import html
  import unicodedata
  import xml.etree.ElementTree
  from typing import TYPE_CHECKING, Any, Iterator, MutableSet
label_desc: Use image node_id 1 to create a new TocTreeprocessor object from inherited base classes: Treeprocessor with example: obj = TocTreeprocessor(md, config)