Skip to content

Add Notion-like WYSIWYG editor for Markdown snippets#8

Merged
martinezharo merged 2 commits into
mainfrom
claude/markdown-preview-toggle-crcw3v
Jun 27, 2026
Merged

Add Notion-like WYSIWYG editor for Markdown snippets#8
martinezharo merged 2 commits into
mainfrom
claude/markdown-preview-toggle-crcw3v

Conversation

@martinezharo

Copy link
Copy Markdown
Owner

Adds a rich text editing experience for Markdown snippets alongside the existing source code editor. Users can now toggle between a Notion-style WYSIWYG preview and the raw Markdown source, with a preference setting to choose the default view.

Key Changes

  • New MarkdownEditor component (MarkdownEditorInner.tsx): A TipTap-based WYSIWYG editor with:

    • Floating formatting toolbar (bold, italic, strikethrough, code, headings, lists, quotes, links)
    • Syntax-highlighted code blocks using lowlight
    • GFM task list support
    • Markdown serialization for round-trip editing
    • Notion-like affordances (click-to-focus, placeholder text)
  • Editor styling (globals.css): Comprehensive .klipcode-md styles for document typography, including:

    • Semantic heading hierarchy with borders and spacing
    • Link styling with subtle underlines
    • Code block and inline code formatting
    • Task list checkboxes
    • VS Code Dark+ and Light+ syntax highlighting themes
  • SnippetEditor integration:

    • Added preview/source toggle button in the breadcrumb toolbar (Eye/Code2 icons)
    • Conditional rendering: shows MarkdownEditor when preview is active, falls back to CodeMirror for source
    • Respects read-only state (trashed snippets)
  • User preferences: New markdownPreviewByDefault setting in PreferencesDialog to control initial view mode for Markdown snippets

  • Localization: Added English and Spanish strings for preview toggle labels and placeholder text

  • Code splitting: MarkdownEditor uses lazy loading with Suspense to defer TipTap/ProseMirror bundle until needed

Implementation Details

  • The editor uses tiptap-markdown to serialize edits back to Markdown, keeping snippets as plain .md files
  • Syntax highlighting covers ~35 common languages via lowlight's common bundle
  • The floating menu appears only when text is selected and only in editable mode
  • Placeholder text is configurable via the copy prop
  • All theme colors use CSS variables for automatic light/dark mode support

https://claude.ai/code/session_018oYBHxerqBaL63TVZPKGy8

claude added 2 commits June 26, 2026 21:22
Markdown snippets can now render as a friendly, Notion-style document
instead of source code. A toggle button sits next to the format/copy
controls in the editor toolbar (Markdown snippets only) to switch between
the rendered preview and the raw source.

The default side is controlled by a new "Markdown preview" preference
(on by default) in the Preferences dialog, persisted in localStorage.

- preferences: add markdownPreviewByDefault (default true)
- MarkdownPreview: lazy-loaded react-markdown + remark-gfm renderer,
  themed Notion-style, kept out of the main bundle
- SnippetEditor: preview/source toggle + conditional render; breadcrumbs
  and aside untouched
- i18n: en/es strings for the toggle and preference

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018oYBHxerqBaL63TVZPKGy8
Replace the read-only Markdown preview with a TipTap WYSIWYG editor so
Markdown snippets can be written and edited inline (not just read), with a
Notion-style experience: a floating selection toolbar, Markdown input
shortcuts, task lists, and a clean document layout. Fenced code blocks are
syntax highlighted via lowlight (highlight.js) using a VS Code palette.

Edits serialize back to Markdown (tiptap-markdown) so the snippet stays a
plain .md document; the toggle still flips between this rich view and the
raw source CodeMirror. Breadcrumbs and aside are untouched.

The "Markdown rich editor" preference now defaults to OFF (snippets open in
source view unless the user opts in).

- preferences: markdownPreviewByDefault now defaults to false
- MarkdownEditor/MarkdownEditorInner: lazy-loaded TipTap editor, kept out of
  the main bundle; read-only when the snippet is trashed
- globals.css: Notion-like document styling + highlight.js token colors
  (dark + light)
- drop react-markdown/remark-gfm in favour of the editable editor
- i18n: updated en/es strings for the toggle, placeholder and preference

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018oYBHxerqBaL63TVZPKGy8
@cloudflare-workers-and-pages

Copy link
Copy Markdown
Contributor

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
klipcode 2226678 Commit Preview URL

Branch Preview URL
Jun 26 2026, 09:45 PM

@martinezharo martinezharo merged commit 2226678 into main Jun 27, 2026
2 checks passed
@martinezharo martinezharo deleted the claude/markdown-preview-toggle-crcw3v branch July 2, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants