Locate the cut point that ends the Executive Brief body — the start of
the next top-level boundary heading after afterHeading. A boundary is
any <h2> whose id either starts with the canonical section- prefix
or exactly matches one of EXECUTIVE_BRIEF_BOUNDARY_ID_MARKERS
(Reader Guide / Tradecraft / Analysis Index / Supplementary appendices).
Critically, this only matches top-level section anchors — never the
brief's own internal <h2> sub-headings (## BLUF, ## 60-Second Read,
…), which carry slugified ids without the section- prefix. That is why
we cannot simply look for the next <h2.
Uses indexOf/lastIndexOf exclusively (no regex) to stay within
CodeQL's safe-regex envelope.
Parameters
html: string
Full article body HTML
afterHeading: number
Index immediately after the Executive Brief </h2>
Returns number
Index of the next boundary <h2, or -1 when the Executive
Brief is the last block in the body.
Locate the cut point that ends the Executive Brief body — the start of the next top-level boundary heading after
afterHeading. A boundary is any<h2>whoseideither starts with the canonicalsection-prefix or exactly matches one of EXECUTIVE_BRIEF_BOUNDARY_ID_MARKERS (Reader Guide / Tradecraft / Analysis Index / Supplementary appendices).Critically, this only matches top-level section anchors — never the brief's own internal
<h2>sub-headings (## BLUF,## 60-Second Read, …), which carry slugified ids without thesection-prefix. That is why we cannot simply look for the next<h2.Uses
indexOf/lastIndexOfexclusively (no regex) to stay within CodeQL's safe-regex envelope.