class_docstr: Step through document and build TOC. 
class_docstr_tok: ["Step","through","document","and","build","TOC","."]
docstr: Replace marker with elem. 
docstr_tok: ["Replace","marker","with","elem","."]
code: def replace_marker(
      self, root: etree.Element, elem: etree.Element
  ) -> None:
      """Replace marker with elem."""
      for p, c in self.iterparent(root):
          text = "".join(c.itertext()).strip()
          if not text:
              continue
  
          # To keep the output from screwing up the
          # validation by putting a `<div>` inside of a `<p>`
          # we actually replace the `<p>` in its entirety.
  
          # The `<p>` element may contain more than a single text content
          # (`nl2br` can introduce a `<br>`). In this situation, `c.text` returns
          # the very first content, ignore children contents or tail content.
          # `len(c) == 0` is here to ensure there is only text in the `<p>`.
          if c.text and c.text.strip() == self.marker and len(c) == 0:
              for i in range(len(p)):
                  if p[i] == c:
                      p[i] = elem
                      break
  
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 3 for calling the TocTreeprocessor obj's underlying member method code with example usage: obj.replace_marker(root, elem) without return types