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>
Events now publish successfully but don't appear in feed yet. Fixed the
"Failed to execute 'postMessage' on 'Window'" error by ensuring all
event data is properly serialized before passing between components.
Changes:
- Remove non-serializable tree property from exported events
- Convert all NDKEvent properties to primitives in eventToPublishableObject
- Add JSON deep cloning in handlePublish to ensure full serializability
- Add debug logging to track event structure and serialization issues
Status: Publishing works (events are sent to relays) but feed display
needs investigation for relay read/write configuration mismatch.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>