fix(notebook): preserve arbitrary tree depth and nested groups in import/export #57

Merged
clanker merged 1 commit from fix/notebook-import-export-nesting into main 2026-09-03 16:35:09 +00:00
Member

Fixes notebook import/export so nested grouping and arbitrary depth hierarchies are accurately stored and restored:

  • Root-Cause Fixed: The markdown parser previously used a single lastTopLevelCardId variable, causing any card at depth >= 2 to be assigned to the Tier 1 parent instead of its immediate parent.
  • Indentation & Heading Stacks: Replaced binary indentation checks with a stack-based parser (headingStack and listStack) that maintains exact hierarchy across any nesting depth (Parent -> Child -> Grandchild -> Great-Grandchild).
  • Nested Custom Groups: Updated NotebookExportModal.tsx to export nested custom groups as indented list folders (- [Group Name]() (Custom custom)) rather than resetting depth and converting them to top-level ### headings.
  • Top-Level Item Ordering: Segregated root standalone cards to render before section headings so root cards are not swallowed by preceding headings.
  • Legacy JSON Migration: Added automatic migration for older JSON exports containing customGroup strings without parentId.
Fixes notebook import/export so nested grouping and arbitrary depth hierarchies are accurately stored and restored: - **Root-Cause Fixed**: The markdown parser previously used a single `lastTopLevelCardId` variable, causing any card at depth >= 2 to be assigned to the Tier 1 parent instead of its immediate parent. - **Indentation & Heading Stacks**: Replaced binary indentation checks with a stack-based parser (`headingStack` and `listStack`) that maintains exact hierarchy across any nesting depth (Parent -> Child -> Grandchild -> Great-Grandchild). - **Nested Custom Groups**: Updated `NotebookExportModal.tsx` to export nested custom groups as indented list folders (`- [Group Name]() (Custom custom)`) rather than resetting depth and converting them to top-level `###` headings. - **Top-Level Item Ordering**: Segregated root standalone cards to render before section headings so root cards are not swallowed by preceding headings. - **Legacy JSON Migration**: Added automatic migration for older JSON exports containing `customGroup` strings without `parentId`.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Home/Spheres4Dummies!57
No description provided.