ber;
  }
  

  // Function to update TOC when tab changes
  function updateActiveTabTOC() {
    const maxTabsetNumber = getMaxTabsetNumber();
    const activeTab = document.querySelector(`.tab-pane[id^="tabset-${maxTabsetNumber}"].active`);
    const tocContainer = document.querySelector('#quarto-margin-sidebar-toc');
    if (activeTab) {
      generateTOC(`#${activeTab.id}`, '#quarto-margin-sidebar-toc');
    }
  }

  // Create and insert TOC container if it doesn't exist
  function createTOCContainer() {
