code: protected void stopStacking()
      {
          if (this.isStacking) {
              // Stop stacking in this listener
              setLookaheadDepth(0);
              this.isStacking = false;
  
              // Flush all stacked events BUT flush them in the Lookahead Listener at the beginning of the stack, in order
              // to replay them and thus not break the ordering of them since there are begin/end methods in
              // XWikiSyntaxChainingRenderer that will check for the next event (e.g. onNewLine()).
              LookaheadChainingListener listener =
                  (LookaheadChainingListener) getListenerChain().getListener(LookaheadChainingListener.class);
              QueueListener previousEvents = getPreviousEvents();
              if (shouldInsertGroupBlock()) {
                  previousEvents.offerFirst(previousEvents.new Event(EventType.BEGIN_GROUP,
                      Collections.emptyMap()));
                  // Note: we need to insert before the last element since that one is the element closing the stacking
                  // (e.g. end item list for a list item) and it's already on the stack.
                  previousEvents.add(previousEvents.size() - 1,
                      previousEvents.new Event(EventType.END_GROUP, Collections.emptyMap()));
              }
              listener.transferStart(previousEvents);
          }
      }
docs: Stop stacking events and move them back to the {@link LookaheadChainingListener} to replay them.