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

Markdown​Preview​Enhanced

by CaffeineOddity ST4 Trending

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

Details

Installs

  • Total 7K
  • Win 3K
  • Mac 3K
  • Linux 867
Oct 31 Oct 30 Oct 29 Oct 28 Oct 27 Oct 26 Oct 25 Oct 24 Oct 23 Oct 22 Oct 21 Oct 20 Oct 19 Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 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
Windows 8 35 24 48 42 32 19 29 52 39 31 38 40 14 22 48 33 43 32 48 30 23 53 54 26 38 27 22 25 16 29 47 65 48 28 32 31 56 60 107 68 35 20 35 35 38
Mac 4 43 63 50 57 44 9 18 44 57 47 51 47 14 32 37 51 50 48 41 35 25 54 65 47 47 46 19 23 49 40 62 65 62 21 32 55 73 91 103 102 35 30 34 37 45
Linux 2 23 17 6 14 15 9 7 10 11 4 12 11 6 9 9 11 13 5 10 4 8 9 20 14 16 7 12 4 13 19 10 24 15 8 9 14 17 15 19 14 8 14 9 9 13

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 (title / date / tags banner)
✅ Presentation mode (16:9 slides, page breaks + notes) ✅ KaTeX ($…$ / $$…$$)
✅ Dark mode (follows system, persisted) ✅ Mermaid diagrams (click to zoom)
✅ Copy as rich text (📋 / command) ✅ ECharts
✅ Paste as markdown (right-click / command, HTML + screenshots) ✅ Callouts (> [!NOTE])
✅ Code block copy button ✅ ~~del~~ ==mark== ^sup^ ~sub~
✅ Code block filename / line numbers / highlight
✅ 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 and run MarkdownPreviewEnhanced: Toggle Preview to open / focus the preview. The package ships no default key bindings (so it never overrides Sublime's built-in shortcuts — issue #11); see Key bindings.

  • Paste as Markdown (right-click or Command Palette) converts clipboard HTML to markdown (headings, bold/italic, links, lists, code blocks, GFM tables); no HTML → plain paste. Linux needs xclip / wl-clipboard. Set paste_download_images to true to save remote images into media/.
  • Editing updates the preview in place (SSE), scroll kept. Re-running the command focuses the existing tab. Switching tabs in the browser focuses the matching Sublime view, and vice versa. The local server stays up while any preview tab is open and stops shortly after the last one closes.
  • Sidebar toolbar: 📋 copy as rich text, 🖼️ PNG, 💾 standalone HTML, 📽️ presentation, 🌙/☀️ dark mode, ☕ tip.
  • The 👁️ button at the bottom-right hides/shows the whole sidebar (toolbar, tabs, TOC) so you can focus on the preview; the choice is remembered.
  • Hover a code block for a Copy button. Copy as Rich Text copies the rendered HTML to the clipboard (browser button or Command Palette) for mail / Word / Confluence.
  • Dark mode follows prefers-color-scheme; the choice is stored in the browser. Click a Mermaid diagram or image to zoom. Clicking a line in Sublime scrolls the matching block to the middle of the preview.
  • GFM task-list checkboxes are clickable and write back to the file. Callouts (> [!NOTE] / TIP / IMPORTANT / WARNING / CAUTION), ~~del~~, ==mark==, ^sup^, ~sub~ render in preview and exports.

Presentation mode

📽️ or MarkdownPreviewEnhanced: Presentation Mode. Slides reuse the live-preview HTML; every h1–h4 starts a new slide. 16:9 canvas; navigate with arrow keys, edge click, or the HUD.

Key bindings

The package ships no default key bindings (issue #11). Bind them yourself:

  • Command Palette → Preferences: MarkdownPreviewEnhanced Key Bindings opens a two-pane editor: the example on the left, your User keymap on the right. Save the right pane to apply.
  • Or paste into the User keymap:
[
    { "keys": ["super+alt+m"], "command": "markdown_preview_enhanced_toggle" },
    { "keys": ["super+alt+v"], "command": "markdown_preview_enhanced_paste_as_markdown" },
    { "keys": ["super+alt+p"], "command": "markdown_preview_enhanced_insert_pagebreak" },
    { "keys": ["super+alt+n"], "command": "markdown_preview_enhanced_insert_notes" }
]

Use ctrl instead of super on Windows / Linux. super+alt / ctrl+alt avoid the built-in Expand Selection to Brackets / Paste and Indent (which sit on super+shift+m / super+shift+v). Other commands live under the MarkdownPreviewEnhanced: prefix.

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