/** * Recover collapsed toggles from GitHub-flavored-markdown (GFM) clipboard HTML. * * buildin.ai and Notion serialize a toggle into their lossy `text/html` twin as * a single-item bullet list whose one `
Toggle title
body…
` title plus at least one NON-LIST block sibling qualifies. * Every ordinary bullet list differs — it is multi-item, holds a single block, * or nests its children as a sub-`
` title, with 2+ children of which at least one * non-title child is a non-list block. */ function toggleFromList(ul: HTMLUListElement): HTMLElement | null { if (ul.children.length !== 1) { return null; } const li = ul.firstElementChild; if (li === null || li.tagName !== 'LI') { return null; } // Bare (non-whitespace) text directly under the