export class TOC extends HTMLElement { static get is() { return 'd-toc'; } connectedCallback() { if (!this.getAttribute('prerendered')) { window.onload = () => { const article = document.querySelector('d-article'); const headings = article.querySelectorAll('h2, h3'); renderTOC(this, headings); }; } } } export function renderTOC(element, headings) { let ToC =`

Table of contents

'; element.innerHTML = ToC; }