Skip to content

Proposal: add Markdown preview mode #923

Description

Proposal

Add an optional, read-only Markdown preview mode to Edit for .md documents.

Edit already provides Markdown syntax highlighting, but reading rendered documentation still requires leaving the terminal or installing another tool. A native preview would let users switch between source editing and rendered reading without changing applications.

Prototype

I built a working zero-dependency prototype on top of Edit's existing immediate-mode TUI:

  • View > Markdown Preview
  • Alt+P toggles source and preview modes
  • headings, paragraphs, lists, blockquotes, rules, fenced/inline code, emphasis, strikethrough, and links
  • per-document preview state and cache
  • Unicode-aware wrapping and keyboard/page scrolling
  • no new crate dependencies

The release binary changes from 427,520 bytes to 446,976 bytes: +19,456 bytes / +4.55%.

Responsiveness safeguards

The implementation preserves Edit's large-file goals:

  • previews are limited to 1 MiB;
  • individual lines are limited to 32 KiB, matching the existing LSH safeguard;
  • unchanged documents use an O(1) generation fast path;
  • undo generation reuse is validated against raw source bytes;
  • malformed link and backtick inputs have bounded forward scanning.

Scope

This is intentionally a lightweight Markdown subset, not a complete CommonMark implementation. Links are displayed but not activated, and oversized documents show a localized unavailable message.

Would this feature fit Edit's core scope, or should it wait for the planned plugin architecture?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions