docs: def _emit_text_then_stack(self, text):
          """Pop the current stack, write *text*, and then write the stack."""
          stack = self._pop()
          self._emit_text(text)
          if stack:
              self._emit_all(stack)
          self._head -= 1