Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Markdown-Preview-toolNew to Visual Studio Code? Get it now.
Markdown-Preview-tool

Markdown-Preview-tool

TengWenjie

|
60 installs
| (0) | Free
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Markdown Preview Tool

A VS Code extension that provides an enhanced Markdown preview with a navigable table of contents, three-way sync, image copy/save actions, zoom, theme switching, interactive Mermaid diagrams, and code copy helpers.

Features

  • Table of Contents — Auto-generated collapsible tree sidebar from headings, with scroll spy highlighting
  • Resizable / Hideable TOC — Drag the sidebar edge to adjust width; show or hide it with the floating Toggle contents button at the top-right of the content area or the right-click menu. The button follows the content edge as the sidebar opens, closes, or resizes, and is disabled when the document has no headings
  • Three-way Sync — TOC, Preview, and Markdown editor stay in sync:
    • Click a TOC item → Preview scrolls + Editor jumps to the heading
    • Scroll Preview → TOC highlights + Editor follows
    • Move cursor in Editor → Preview and TOC follow
  • Theme Switching — Defaults to Light theme; cycle through Light → Dark → System (follows VS Code)
  • Zoom — Ctrl/Cmd + Scroll zooms the full preview, including code blocks (50%–200%); right-click menu can reset to 100%
  • Context Menu — Right-click the preview to refresh, toggle TOC, reset zoom, switch theme, or copy Markdown source
  • Copy — Hover over code blocks for a copy icon; right-click a code block to copy it immediately
  • Mermaid Diagrams — Render mermaid fenced code blocks as interactive diagrams, each with:
    • Drag to pan — Hold the left mouse button and drag (the cursor turns into a hand) to reposition the diagram
    • Per-diagram zoom — Ctrl/Cmd + Scroll over a diagram zooms only that diagram (10%–300%), leaving the rest of the page untouched
    • Dedicated right-click menu — Reset zoom, Copy Mermaid code, Copy PNG (rendered to the clipboard as an image), Show graph, and Show source
    • Template-safe — Blocks containing Mustache/Handlebars placeholders ({{var}}, {{#section}}) are not valid Mermaid, so they show a short "not rendered" notice instead of a syntax error; use Show source to view them. Each diagram renders independently, so one invalid diagram doesn't affect the others
  • Links — Clicking a link works: #heading anchors scroll the preview (and the editor follows), links to other files open in the editor beside the preview (other.md#heading also jumps to that heading), non-text files open with their default VS Code editor, and http(s) / mailto: links open outside VS Code
  • Images — Local images display in the preview, whether written as a relative path (./img/a.png, ../assets/a.png), an absolute path, a file:// URI, a remote URL, a data: URI, or a raw <img> tag
  • Image Menu — Right-click a local, remote, or data URI image for Copy image (copy the image to the clipboard as PNG) or Save image (choose a location and save the original image file)
  • Code Styling — Code blocks use dark green base text and gray italic comments
  • Floating Controls — Semi-transparent circular buttons: Toggle contents at the top-right and top/bottom navigation at the bottom-right of the content area
  • Content Spacing — Preview content has 15px padding on each side and 32px padding at the top and bottom
  • Refresh — Right-click menu refresh action manually syncs preview with latest Markdown content

Usage

Action Shortcut / Command
Open Preview Ctrl+Shift+V / Cmd+Shift+V
Open Preview to Side Command: Open Markdown Preview to the Side
Open preview menu Right-click inside the preview
Copy or save an image Right-click an image: Copy image / Save image
Toggle TOC Floating button at the top-right of the content area, or preview right-click menu: Toggle contents
Collapse TOC items Click ▼/▶ toggle arrows
Resize TOC Drag left edge of the sidebar
Zoom in/out Ctrl/Cmd + Scroll
Reset zoom Preview right-click menu: Zoom 100%
Switch theme Preview right-click menu: Switch theme
Follow a link Click it in the preview
Copy code block Right-click a code block, or hover and click the copy icon
Copy Markdown source Preview right-click menu: Copy Markdown source
Refresh preview Preview right-click menu: Refresh preview
Pan a Mermaid diagram Hold the left mouse button over the diagram and drag
Zoom a Mermaid diagram Ctrl/Cmd + Scroll over the diagram (10%–300%)
Mermaid diagram menu Right-click a diagram: Reset zoom, Copy mermaid code, Copy PNG, Show graph, Show source

Requirements

  • VS Code ^1.125.0

Development and Packaging

For development, use Node.js 22 or newer and npm. Install dependencies and compile:

npm ci
npm run compile

Open the project in VS Code, select the Run Extension launch configuration, and press F5 to open an Extension Development Host. Use Ctrl+Shift+F5 to restart it after rebuilding. Run extension tests with npm test.

To create a VSIX with Make installed:

make package

make runs the same default target. The target uses @vscode/vsce@latest through npx, so a global vsce installation is unnecessary. Packaging runs the production build, type checking, and linting automatically. The generated filename follows the version in package.json, currently markdown-preview-tool-0.2.1.vsix.

Without Make, run the packaging command directly:

npx --yes @vscode/vsce@latest package --no-dependencies

In VS Code, run Extensions: Install from VSIX... and select the generated file. After updating an installed copy, run Developer: Reload Window to load the new version.

Release Notes

0.2.3

Packaging refresh with updated README; no functional changes.

0.2.2

  • Mermaid blocks containing template placeholders ({{...}}) now show a "not rendered" notice instead of Syntax error in text.
  • Mermaid diagrams render independently, so one invalid diagram no longer blocks the others.

0.2.1

Increased preview content padding to 15px on each side while retaining 32px top and bottom padding.

0.2.0

  • Added an image context menu with Copy image and Save image. Copying produces a PNG clipboard image; saving preserves the original file format.
  • Added the floating Toggle contents button, styled like the top/bottom navigation buttons, with synchronized sidebar state and keyboard activation.
  • Improved image handling for reference-style Markdown images, unquoted HTML src attributes, encoded paths, query strings, SVG fragments, and protocol-relative URLs.
  • Added make package to build a VSIX with the latest vsce version.

0.1.0

Fixed local images not rendering. Image sources are now rewritten to webview URIs and the referenced folders are added to the preview's allowed resource roots, so relative, absolute, and file:// paths all display — in Markdown image syntax and raw <img> tags alike.

Links in the preview are now clickable: in-page #heading anchors, links to other files (opened in the editor, with #heading jumps), and external http(s) / mailto: links. Copy Markdown source now copies the document verbatim instead of an escaped string.

0.0.11

Reworked Mermaid diagrams into interactive views: drag to pan (hand cursor), Ctrl/Cmd + Scroll to zoom a single diagram (10%–300%) without affecting the page, and a dedicated right-click menu (Reset zoom, Copy Mermaid code, Copy PNG, Show graph, Show source). Removed the per-diagram toolbar. Mermaid now renders labels as SVG text so diagrams can be copied to the clipboard as PNG.

0.0.7

Removed the top toolbar and moved preview actions into a right-click menu. Code blocks now scale with preview zoom, support right-click copy, and use dark green base text with gray italic comments. TOC hiding now removes the sidebar from layout and uses tighter right spacing.

0.0.4

Three-way sync, collapsible TOC tree, resizable sidebar, default Light theme.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft