524 B
524 B
// Type A에서 검증된 제목+본문 그룹핑
function groupHeadingWithParagraph(nodes, index) {
const node = nodes[index];
if(!node) return { group: [], consumed: 0 };
const next = nodes[index + 1];
if(!node.tagName) return { group: [node], consumed: 1 };
const tag = node.tagName.toUpperCase();
if((tag === 'H2' || tag === 'H3') && next && next.tagName && next.tagName.toUpperCase() === 'P') {
return { group: [node