Skip to content

Hybrid Markdown Rendering System - Live Preview with Syntax Visibility #26

Closed

Description

@malibio

Implement real-time hybrid markdown rendering where textareas show both syntax characters AND formatting simultaneously during editing, following Logseq's proven implementation pattern.

Implementation Approach - CodeMirror 6

Based on technical analysis, this feature will be implemented using CodeMirror 6 instead of the original textarea approach. CodeMirror 6 provides:

  • Built-in hybrid markdown rendering (syntax + formatting simultaneously)
  • Professional cursor management (no jumping issues)
  • Real-time syntax detection and styling
  • Lightweight, modular architecture
  • Foundation for future rich decorations (Hover previews for node references #34)

Implementation Breakdown

This issue has been broken into manageable sub-issues for iterative development:

Branching Strategy: Single branch approach - all sub-issues will be implemented on feature/issue-26-hybrid-markdown and included in one comprehensive PR.

Dependencies

None - This is a self-contained feature that can be implemented independently.

Related Issues

Sub-Issues

Self-Contained Scope

  • Complete hybrid markdown rendering system using CodeMirror 6
  • Real-time font size changes based on markdown syntax detection
  • Local state management with upgrade path to shared state
  • Mock integration points for future rich features
  • Comprehensive testing with demo scenarios
  • Documentation and usage examples
  • Architectural decision documentation capturing learnings and decisions

Overall Requirements

  • Real-time Rendering: Typing # Header immediately shows large font while preserving #
  • Syntax Preservation: All markdown characters remain visible during editing
  • Font Size Matching: Edit mode font sizes identical to display mode rendering
  • Performance: No lag or cursor jumping during real-time updates
  • Integration Ready: Clean interfaces for mock element positioning and decorations
  • Knowledge Capture: Document architectural decisions and implementation learnings

Overall Acceptance Criteria

  • Typing # Header shows large font immediately while keeping # visible
  • Removing # returns to normal font size immediately
  • All heading levels (H1-H6) work correctly with proper font sizes
  • Cursor position preserved during font size changes
  • No visual lag or glitches during real-time updates
  • Integration with existing save-on-change detection works
  • Performance remains smooth (< 50ms for style updates)
  • CSS classes applied correctly to editor elements
  • Display mode shows identical styling to edit mode
  • All linting and formatting checks pass
  • Architectural decisions documented for future reference

Definition of Done

Activity

  1. changed the title [-]Hybrid Markdown Editor - Live Preview with Syntax Visibility[/-] [+][FEATURE] Complete Hybrid Markdown Rendering System[/+] on Aug 10, 2025
  2. changed the title [-][FEATURE] Complete Hybrid Markdown Rendering System[/-] [+]Hybrid Markdown Rendering System - Live Preview with Syntax Visibility[/+] on Aug 10, 2025
  3. added a commit that references this issue on Aug 11, 2025
  4. assigned and unassigned on Aug 11, 2025
  5. added 4 commits that reference this issue on Aug 11, 2025
  6. malibio commented on Aug 16, 2025

    @malibio
    CollaboratorAuthor

    🔄 Architecture Decision Update

    After comprehensive research including Logseq analysis and ProseMirror evaluation, we've determined that NodeSpace's existing enhanced contenteditable approach is architecturally superior for our hierarchical editing requirements.

    Key Findings:

    • ✅ NodeSpace's indented node indicators cannot be properly implemented in ProseMirror
    • ✅ Enhanced contenteditable with Logseq's dual-representation patterns provides the optimal solution
    • ✅ CodeMirror approach would lose our unique hierarchical value proposition

    Superseded by: Epic #69 Text Editor Architecture Enhancement, which implements hybrid markdown rendering using our enhanced contenteditable foundation with Logseq-inspired dual-representation patterns.

    Approach: Instead of CodeMirror, we're enhancing our existing contenteditable with:

    • Dual-representation pattern (source ↔ AST ↔ display) from Logseq
    • Real-time markdown rendering while preserving syntax visibility
    • Rich backlinking support with contextual decorations
    • Preserved hierarchical node indicators that make NodeSpace unique

    See updated architecture in: Text Editor Architecture Refactor

  7. added a commit that references this issue on Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions