ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Markdown​Preview​Enhanced

Live Markdown preview in the browser for Sublime Text 4 — SSE updates, KaTeX, Mermaid, ECharts, and presentation mode.

Details

Installs

  • Total 5K
  • Win 2K
  • Mac 2K
  • Linux 626
Oct 7 Oct 6 Oct 5 Oct 4 Oct 3 Oct 2 Oct 1 Sep 30 Sep 29 Sep 28 Sep 27 Sep 26 Sep 25 Sep 24 Sep 23 Sep 22 Sep 21 Sep 20 Sep 19 Sep 18 Sep 17 Sep 16 Sep 15 Sep 14 Sep 13 Sep 12 Sep 11 Sep 10 Sep 9 Sep 8 Sep 7 Sep 6 Sep 5 Sep 4 Sep 3 Sep 2 Sep 1 Aug 31 Aug 30 Aug 29 Aug 28 Aug 27 Aug 26 Aug 25 Aug 24 Aug 23
Windows 19 38 27 22 25 16 29 47 65 48 28 32 31 56 60 107 68 35 20 35 35 38 45 44 26 20 36 41 42 41 32 17 12 36 36 36 31 42 10 11 29 24 32 29 28 14
Mac 38 47 46 19 23 49 40 62 65 62 21 32 55 73 91 103 102 35 30 34 37 45 45 54 16 14 53 49 45 51 49 29 16 42 41 37 36 37 10 13 28 40 36 39 42 18
Linux 9 16 7 12 4 13 19 10 24 15 8 9 14 17 15 19 14 8 14 9 9 13 15 14 4 6 17 14 13 16 11 6 12 6 10 3 11 6 0 6 8 10 7 9 9 2

Readme

Source
raw.​githubusercontent.​com

MarkdownPreviewEnhanced

English | 中文

Browser live Markdown preview for Sublime Text 4. No extra installs.

Features

Preview Markdown
✅ Live preview in the browser ✅ GitHub-style HTML / CSS
✅ SSE in-place update (no reload) ✅ Syntax highlighting
✅ One file ↔ one preview tab ✅ GFM task lists
✅ Editor ↔ preview tab switch ✅ Footnotes
✅ Scroll sync (editor ↔ preview) ✅ GFM emoji (:smile:)
✅ TOC + preview tab list ✅ YAML frontmatter
✅ Presentation mode (16:9 slides) ✅ KaTeX ($…$ / $$…$$)
✅ Dark mode (follows system, persisted) ✅ Mermaid diagrams (click to zoom)
✅ Copy as rich text (📋 / command) ✅ ECharts
✅ Paste as markdown (⇧⌘V / right-click) ✅ Callouts (> [!NOTE])
✅ Code block copy button ✅ ~~del~~ ==mark== ^sup^ ~sub~
✅ Relative images (./img/a.png) ✅ Task list checkbox sync (click in preview)
✅ Export HTML / PNG / PDF ✅ Image click zoom
✅ Custom CSS & favicon ✅ No extra installs
✅ macOS / Windows / Linux

Install

Command Palette → Package Control: Install Package → MarkdownPreviewEnhanced

Or clone this repo to Packages/MarkdownPreviewEnhanced/ (repo root = package root).

Usage

Open a .md file, then press Cmd+Shift+M (Windows / Linux: Ctrl+Shift+M) to open / focus the preview.

This is the only other default key binding (issue #6 - don't shadow common shortcuts). Close, Refresh, Presentation Mode, Export HTML and Export PDF are available from the Command Palette; add your own bindings in User/Default (OSX).sublime-keymap if wanted.

Paste as markdown

Copy content from a web page, then in a .md file press Cmd+Shift+V (Windows / Linux: Ctrl+Shift+V) or right-click -> Paste as Markdown. The clipboard HTML is converted to markdown (headings, bold/italic, links, lists, code blocks, GFM tables) and inserted at the cursor. If the clipboard has no HTML (e.g. plain text copied from a terminal), it falls back to a normal paste. On Linux the command needs xclip or wl-clipboard. Set paste_download_images to true to download remote images locally into media/ (off by default).

Edit the file — the browser updates in place (SSE), scroll is kept. Press the shortcut again to focus the existing tab (does not stack another tab). Switching a preview tab in the browser focuses the matching Sublime view, and the other way around.

If you paste a preview URL into a new browser tab, the old tab for that file is replaced (Chrome may block window.close() on tabs you created yourself; those show a banner instead). The local server stays up while any preview tab is open, and stops shortly after the last one closes.

Preview sidebar toolbar: 📋 copy as rich text, 🖼️ PNG snapshot, 💾 standalone HTML, 📽️ presentation, 🌙 / ☀️ dark mode, ☕ tip.

Hover any code block in the preview for a Copy button. Copy as rich text puts the rendered HTML on the clipboard (browser button, or MarkdownPreviewEnhanced: Copy as Rich Text in the Command Palette) so it can be pasted into mail, Word, or Confluence with styling intact. On Linux the command needs xclip or wl-copy; the browser button works everywhere.

Dark mode follows prefers-color-scheme until you toggle it; the choice is stored in the browser. Mermaid uses its dark theme with the page. Click a Mermaid diagram to enlarge it (drag to pan, scroll wheel to zoom, Esc to close). Clicking a line in Sublime scrolls that block to the middle of the preview (including lines inside a Mermaid fence).

Plain images in the preview open the same zoom overlay on click. GFM task-list checkboxes are clickable: toggling one writes - [ ] / - [x] back to the file (local-server mode). GitHub-style callouts (> [!NOTE] / TIP / IMPORTANT / WARNING / CAUTION, optional custom title after the type), strikethrough ~~text~~, highlight ==text==, superscript ^text^ and subscript ~text~ render in preview and exports.

Presentation mode

Open from the 📽️ button or MarkdownPreviewEnhanced: Presentation Mode. Slides are built from the same rendered HTML as live preview (headings, code, tables, KaTeX, Mermaid, ECharts). A new slide starts at every h1–h4. Navigate with arrow keys, click the left/right edges, or the HUD. Canvas is 16:9, scaled to the window.

Settings

Preferences → Package Settings → MarkdownPreviewEnhanced → Settings

Setting Default Description
mermaid_theme "default" Export / file-mode diagrams: default / dark / forest / neutral. Live preview follows the page theme.
output_dir "" Empty = Sublime cache
use_local_server true SSE, images, scroll sync
server_port 8765 Tries the next ports if busy
server_idle_seconds 0 Idle auto-stop; 0 = until Close / Sublime exit
browser "auto" auto / chrome / safari / firefox / edge / …
debounce_ms 500 Re-render delay while typing
show_toc true TOC sidebar
enable_katex true $...$ / $$...$$
enable_emoji true GFM emoji shortcodes (:smile:)
enable_task_lists true - [ ] / - [x]
enable_footnotes true [^1]
strip_frontmatter true Strip leading --- YAML
scroll_sync true Editor ↔ preview (needs local server)
paste_download_images false Paste as markdown: download remote images to media/
paste_images_dir "media" Subdirectory for downloaded images (relative to md file)
custom_css "" Extra CSS file path (~ ok)
embed_images true Export HTML/PDF: embed local images as base64 so output is fully portable
favicon "" Empty = bundled icon; "none" = no icon; otherwise a local path or http(s) URL

Per-view override:

Error: language “jsonc” is not supported
{
    "markdown_preview_enhanced.mermaid_theme": "forest"
}

Requires Sublime Text 4 (Build 4107+). Math, diagrams, and highlighting are vendored — nothing else to install.

Build / PR notes: CONTRIBUTING.md

Support

If this package is useful:

WeChat 赞赏码

License

MIT — LICENSE