Fixes multiple issues with AsciiDoc hierarchical parsing and preview rendering:
**Content Extraction:**
- Fixed content extraction to include child headers at all parse levels
- Level 3 parsing now properly includes ==== sub headers in === parent content
- Unified content extraction logic stops only at sibling/parent headers
**Event Generation:**
- Fixed collectSectionsAtLevel to include Level 2-N sections for proper hierarchy
- Level 3 parsing creates index events for == sections, content events for === sections
- Maintains NKBIP-01 compliance: parent sections get both index+content events
**Preview Rendering:**
- Fixed heading removal to target specific section titles, not first header found
- === subheader now renders correctly as h3 in preview
- Nested content properly displays in parent sections
**Example Structure (Level 3 parsing):**
```
= title
== test 1 → Index Event (30040) + Content Event (30041)
text
=== subheader → Content Event (30041)
content + nested
==== sub subheader
nested content
== note 2 → Index Event (30040) + Content Event (30041)
text
```
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Extract shared result processing logic into processPublishResults utility
- Add ProcessedPublishResults interface for type safety
- Create helper functions for error handling and event logging
- Reduce publishing handler code from ~200 to ~50 lines each
- Maintain all existing functionality while improving maintainability
Both handlePublishArticle and handlePublishScatteredNotes now use:
- processPublishResults() for consistent result processing
- createErrorResult() for standardized error handling
- logEventSummary() for centralized debug logging
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>