void popToMark() {
      if (this.tagLevel == 0) {
        return;
      }
      String tag;
      while ((tag = this.popTag(true)) != MARK) {
        this.emitClose(tag);
      }
    }
mark tag boundaries within the stack, without needing to mess with typing too much.
text-minimessage/src/main/java/net/kyori/adventure/text/minimessage/MiniMessageSerializer.java