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 8K
  • Win 3K
  • Mac 4K
  • Linux 1K
Nov 20 Nov 19 Nov 18 Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12 Nov 11 Nov 10 Nov 9 Nov 8 Nov 7 Nov 6 Nov 5 Nov 4 Nov 3 Nov 2 Nov 1 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
Windows 17 40 47 55 36 25 22 24 37 41 41 41 27 22 30 50 36 52 42 15 19 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
Mac 11 35 42 52 49 18 9 52 43 44 56 32 23 29 48 50 49 51 38 27 18 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
Linux 3 16 10 14 10 10 5 12 13 17 7 14 10 7 19 13 12 7 15 9 12 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

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. The sidebar sits on the left of the article with a 28px gap. content_width (default 0.8, range 0.5–1) is how much of the remaining width the article uses.
  • 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. The hint is English by default (Drag to pan · Scroll to zoom · Esc to close); set zoom_hint to replace that sentence. 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
export_dir "" Export PDF/HTML suggested path: "" = output_dir; "beside_source" = next to the .md; otherwise a directory (~ ok)
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
break_on_single_newline false false: a single newline stays in the paragraph (CommonMark / GitHub .md files). true: each newline becomes <br>
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
zoom_hint "" Image / Mermaid zoom hint. Empty = Drag to pan · Scroll to zoom · Esc to close
content_width 0.8 Main column width as a fraction of the space left after the sidebar. Range 0.5–1

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