Skip to content

Smart Bullet-to-Node Conversion (- item → child node) #58

Closed

Description

@malibio

Phase 2.1: Smart Bullet-to-Node Conversion (- item → child node)

Parent Epic: #54
Depends on: #55, #56 (pattern detection)
Enables: #59, #60
Integrates with: #4

Overview

Implement intelligent conversion of markdown bullet points (- item) into actual NodeSpace child node relationships, eliminating visual bullets in favor of the existing physical hierarchy system. This is the key innovation that leverages NodeSpace's node architecture.

Parallel Development Note

✅ Can develop in parallel with #57 and #59 after pattern detection (#56) provides bullet pattern recognition. Focus on different user input scenarios enables independent development.

Context

This feature transforms markdown bullet syntax into NodeSpace's physical node hierarchy:

User types: "- Research competitors"
→ System detects "- " pattern (from #56)
→ Removes "- " from content  
→ Creates child node relationship
→ Content becomes: "Research competitors" (visually indented as child)

Result: Physical child node, no bullet symbol needed

Key Innovation: Physical Hierarchy Over Visual Bullets

Instead of showing bullet symbols, leverage NodeSpace's existing node visualization:

  • Connecting lines show parent-child relationships
  • Node circles indicate hierarchy levels
  • Indentation provides visual structure
  • No competing systems - one consistent mental model

Implementation Approach

Bullet Detection and Conversion

interface BulletConverter {
  // Detect bullet patterns in content
  detectBulletPattern(content: string): BulletMatch | null;
  
  // Convert bullet to node relationship
  convertToChildNode(content: string, parentNodeId: string): Promise<NodeCreation>;
  
  // Handle nested bullets
  processNestedBullets(content: string[]): NodeHierarchy;
}

interface BulletMatch {
  originalContent: string;    // "- Research competitors"
  cleanedContent: string;     // "Research competitors"  
  bulletType: 'dash' | 'asterisk' | 'plus';
  indentLevel: number;
}

Node Relationship Management

// Integration with existing NodeSpace hierarchy
interface NodeHierarchy {
  createChildRelationship(parentId: string, childContent: string): Promise<Node>;
  updateNodeIndentation(nodeId: string, level: number): void;
  preserveKeyboardShortcuts(): boolean; // Tab/Shift-Tab still work
}

Technical Architecture

Bullet Pattern Recognition

Uses pattern detection from #56 to identify:

const bulletPatterns = {
  /^- (.+)$/: 'dash-bullet',
  /^\* (.+)$/: 'asterisk-bullet', 
  /^\+ (.+)$/: 'plus-bullet',
  /^  - (.+)$/: 'nested-dash-bullet',  // 2-space indent
  /^    - (.+)$/: 'double-nested-dash-bullet'  // 4-space indent
};

Conversion Process

  1. Pattern Detection: Identify bullet syntax in content
  2. Content Cleaning: Remove bullet markers from text
  3. Relationship Creation: Create parent-child node relationship
  4. Visual Update: Apply NodeSpace indentation and connecting lines
  5. Preserve Functionality: Maintain Tab/Shift-Tab keyboard shortcuts

Integration with Existing Systems

Keyboard Handler Preservation

// Existing keyboard shortcuts remain functional
// Tab → indent node (make child of previous sibling) 
// Shift-Tab → outdent node (make sibling of parent)
// Enhanced: Now works seamlessly with bullet conversion

Node Visualization Enhancement

  • Physical indentation shows hierarchy levels
  • Connecting lines indicate parent-child relationships
  • Node circles provide visual hierarchy cues
  • No bullet symbols needed - clean, sophisticated appearance

User Experience Flow

Simple Bullet Conversion

User Experience:
1. User in existing text node: "Project tasks"
2. User presses Enter → creates new sibling node
3. User types: "- Research competitors"
4. System detects bullet pattern
5. Removes "- " from content
6. Converts new node to child of "Project tasks"
7. Result: Clean hierarchy with physical indentation

Visual Result:
Project tasks
├─ Research competitors  ← Child node, no bullet visible

Nested Bullet Handling

User Experience:
1. User types: "- Main task"
2. Presses Enter, types: "  - Subtask 1"  
3. Presses Enter, types: "  - Subtask 2"

System Processing:
1. Creates child node "Main task"
2. Creates child of "Main task" → "Subtask 1" 
3. Creates sibling of "Subtask 1" → "Subtask 2"

Visual Result:
Previous Node
├─ Main task
   ├─ Subtask 1
   └─ Subtask 2

Acceptance Criteria

Basic Bullet Conversion

  • - item creates child node relationship with cleaned content
  • * item and + item also work as bullet triggers
  • Content appears as "item" (no bullet symbol visible)
  • Visual indentation shows parent-child relationship
  • NodeSpace connecting lines display hierarchy correctly

Nested Bullet Support

  • - item (2-space indent) creates nested child relationships
  • - item (4-space indent) creates deeper nesting levels
  • Complex nested structures convert to proper node hierarchy
  • Visual representation matches logical hierarchy

Integration Requirements

  • Tab/Shift-Tab keyboard shortcuts continue to work
  • Bullet conversion integrates with existing Enter key behavior
  • Node creation events properly dispatched to parent systems
  • Undo/redo works correctly with bullet conversion
  • Copy/paste preserves node relationships

User Experience

  • Conversion feels instant and natural during typing
  • No visual flicker or layout shifts during conversion
  • Users can discover bullet syntax intuitively
  • Existing node manipulation features work with converted nodes
  • Visual hierarchy is clear and sophisticated (no bullet symbols)

Performance & Reliability

  • Bullet detection is fast and accurate
  • No performance degradation with complex hierarchies
  • Handles edge cases gracefully (malformed bullets, mixed indentation)
  • Cross-browser compatibility maintained

Testing Strategy

Unit Tests

  • Bullet pattern detection accuracy
  • Content cleaning algorithms
  • Node relationship creation
  • Nested hierarchy processing

Integration Tests

User Experience Tests

  • Real-time typing and conversion
  • Complex nested document creation
  • Mixed content scenarios (bullets + headers + regular text)
  • Accessibility and keyboard navigation

Coordination Requirements

Shared Interfaces

Define stable APIs for integration:

interface BulletConversionAPI {
  registerBulletPattern(pattern: RegExp, handler: ConversionHandler): void;
  onBulletDetected(callback: (match: BulletMatch) => void): void;
  convertBulletToNode(content: string, parentId: string): Promise<Node>;
}

Pattern Detection Integration

Node System Integration

  • Work with existing node creation/modification APIs
  • Preserve node event dispatching
  • Maintain keyboard shortcut compatibility

Resources & References

NodeSpace Architecture

  • BaseNode.svelte: Node rendering and interaction patterns
  • TextNode.svelte: Text content and editing integration
  • Node hierarchy system: Existing parent-child relationship management

Similar Implementations

  • Logseq: Block-based hierarchy with bullet conversion
  • RemNote: Bullet points that become structured relationships
  • Workflowy: Clean hierarchy visualization without bullet symbols

Design Patterns

  • Physical hierarchy: NodeSpace's existing visual node system
  • Content cleaning: Remove syntax while preserving meaning
  • Progressive enhancement: Enhance existing typing with smart conversion

Definition of Done

  • Users can type bullet syntax and get clean hierarchical nodes
  • All bullet types (-, *, +) work with nested indentation support
  • Visual hierarchy is clean and sophisticated using NodeSpace design patterns
  • Existing keyboard shortcuts (Tab/Shift-Tab) continue to work seamlessly
  • Performance is smooth with no typing delays or visual artifacts
  • Integration with pattern detection and ContentEditable systems is solid
  • Comprehensive test coverage including edge cases and user workflows
  • Ready to enable advanced features in Soft Newline + Markdown Detection (Shift-Enter intelligence) #59 and Multi-line Block Behavior (quotes, code blocks) #60

This bullet-to-node conversion is the key innovation that transforms markdown typing into NodeSpace's sophisticated physical hierarchy system, eliminating visual bullets in favor of elegant structural relationships.

🤖 Generated with Claude Code

Co-Authored-By: Claude [email protected]

Activity

  1. added
    enhancement
    on Aug 11, 2025
  2. self-assigned this
    on Aug 12, 2025
  3. malibio commented on Aug 16, 2025

    @malibio
    CollaboratorAuthor

    ✅ COMPLETED - Part of Epic #63 which has been successfully implemented. The ContentEditable foundation with smart markdown features is working correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions