Files
_Geulbeot/02. Prompts/문서생성/domain/도메인_문서생성_에서_검증된_v01.md

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