flush = index => {
        const html = root[$flushHTML]();
        if (html) {
          hasSomething ||= html.children?.length > 0;
          htmlContentAreas[index].children.push(html);
        }
      }
This function is a generator because the conversion into
pages is done asynchronously and we want to save the state
of the function where we were in the previous iteration.