Markdown preview and editor upgrades #55

Closed
opened 2026-10-22 21:25:05 -04:00 by jared · 0 comments
Owner

Markdown preview. It now renders in a shadow root in the page, not in a sandboxed iframe. DOMPurify drops scripts, <style>, forms, frames, style= and javascript: links, and the shadow root keeps the page's CSS out. The TDS colour variables still reach it, so light and dark switch live.

  • Typography: GitHub-like, in a proportional font.
  • Headings: GitHub-style ids (-1 for repeats) with a hover # anchor, plus an Outline sidebar when the preview is wide enough and the file has 3 or more headings.
  • Code blocks: syntax colours from CodeMirror's own parsers (bash, js/ts, python, yaml, json, toml, ini, nginx, diff, css, html/xml, go, rust, sql, dockerfile, lua, perl, ruby, markdown), a language label and a Copy button.
  • GitHub callouts: > [!NOTE], TIP, IMPORTANT, WARNING and CAUTION.
  • Other content: task lists, tables, <kbd>, <details>, and front matter shown as a small table.
  • Links:
    • #anchors scroll within the preview.
    • Relative links open the file in DevDesk; other.md#section scrolls to that section.
    • Folders are revealed in the explorer.
    • Web and mailto links open in a new tab.
  • Images: relative images (up to 30) are fetched through the session and shown.
  • Split: for Markdown, Source and a live preview side by side. The preview updates as you type, follows the source's scroll, and the choice is remembered per tab.

Editor

  • Status bar: Ln/Col, number of cursors, selected characters, indentation (detected), line endings, encoding and language.
  • VS Code habits: Alt+click adds a cursor, Alt+drag selects a column, brackets and quotes close themselves, indentation follows input, and Ctrl+G goes to a line.
  • Tabs: right-click for Close, Close others, Close to the right, Close saved, Close all, Keep open, Copy path, Copy relative path, Reveal in explorer, Mention to Claude and Download. Drag a tab to reorder.
**Markdown preview.** It now renders in a shadow root in the page, not in a sandboxed iframe. DOMPurify drops scripts, `<style>`, forms, frames, `style=` and `javascript:` links, and the shadow root keeps the page's CSS out. The TDS colour variables still reach it, so light and dark switch live. - **Typography:** GitHub-like, in a proportional font. - **Headings:** GitHub-style ids (`-1` for repeats) with a hover `#` anchor, plus an **Outline** sidebar when the preview is wide enough and the file has 3 or more headings. - **Code blocks:** syntax colours from CodeMirror's own parsers (bash, js/ts, python, yaml, json, toml, ini, nginx, diff, css, html/xml, go, rust, sql, dockerfile, lua, perl, ruby, markdown), a language label and a Copy button. - **GitHub callouts:** `> [!NOTE]`, TIP, IMPORTANT, WARNING and CAUTION. - **Other content:** task lists, tables, `<kbd>`, `<details>`, and front matter shown as a small table. - **Links:** - `#anchors` scroll within the preview. - Relative links open the file in DevDesk; `other.md#section` scrolls to that section. - Folders are revealed in the explorer. - Web and mailto links open in a new tab. - **Images:** relative images (up to 30) are fetched through the session and shown. - **Split:** for Markdown, Source and a live preview side by side. The preview updates as you type, follows the source's scroll, and the choice is remembered per tab. **Editor** - **Status bar:** Ln/Col, number of cursors, selected characters, indentation (detected), line endings, encoding and language. - **VS Code habits:** Alt+click adds a cursor, Alt+drag selects a column, brackets and quotes close themselves, indentation follows input, and Ctrl+G goes to a line. - **Tabs:** right-click for Close, Close others, Close to the right, Close saved, Close all, Keep open, Copy path, Copy relative path, Reveal in explorer, Mention to Claude and Download. Drag a tab to reorder.
jared closed this issue 2026-10-22 21:25:44 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/devdesk#55