class_docstr: Step through document and build TOC. 
class_docstr_tok: ["Step","through","document","and","build","TOC","."]
code: def add_permalink(self, c: etree.Element, elem_id: str) -> None:
      permalink = etree.Element("a")
      permalink.text = (
          "%spara;" % AMP_SUBSTITUTE
          if self.use_permalinks is True
          else self.use_permalinks
      )
      permalink.attrib["href"] = "#" + elem_id
      permalink.attrib["class"] = self.permalink_class
      if self.permalink_title:
          permalink.attrib["title"] = self.permalink_title
      if self.permalink_leading:
          permalink.tail = c.text
          c.text = ""
          c.insert(0, permalink)
      else:
          c.append(permalink)
  
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 6 for calling the TocTreeprocessor obj's underlying member method code with example usage: obj.add_permalink(c, elem_id) without return types