Skip to content
| Marketplace
Sign in
Visual Studio Code>Visualization>Markdown Chart PreviewNew to Visual Studio Code? Get it now.
Markdown Chart Preview

Markdown Chart Preview

owent

|
2 installs
| (0) | Free
Render charts, diagrams, and referenced code offline in VS Code's built-in Markdown preview.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Markdown Chart Preview

简体中文

Render charts, diagrams, and referenced code offline in VS Code's built-in Markdown preview. In the VS Code desktop app (1.148.0 or later), open a Markdown file and run Markdown: Open Preview or Markdown: Open Preview to the Side.

Install from the VS Code Marketplace · Rendering gallery · Complete usage guide

```chart
{"type":"bar","data":{"labels":["A","B"],"datasets":[{"label":"Count","data":[2,5]}]}}
```

![Flowchart][flow]

[flow]: ./flow.d2

{{< codeblock src="./example.py" from="6" to="8" >}}

Rendering gallery

These screenshots show the installed VSIX in the native Markdown preview in VS Code 1.148.0 with the default Follow VS Code theme. Open an image to view it at full size.

Chart.js

Grouped bars comparing API and worker requests across six months

ECharts

Two smoothed request-volume lines with shaded areas

Plotly.js

Interactive 3D terrain surface shown from an angled view

Mermaid

Request validation flowchart with accept and revise branches

draw.io

Ingest, queue, and storage pipeline with native viewer controls

Excalidraw

Hand-drawn workflow from draft to review and shipment

D2

Client and API gateway connected to a cache and database

PlantUML

Sequence diagram for checkout and payment approval

Preview theme

Open Settings and search for markdownChartPreview.theme. Follow VS Code matches the preview's light or dark appearance. Choose Light or Dark to keep charts in a fixed mode. Changes apply to open previews. Theme options and renderer behavior

Customize shortcodes

Both Hugo forms, {{< … >}} and {{% … %}}, are enabled by default. Both read the chart body as plain text. Set markdownChartPreview.shortcodes in settings.json to add a literal delimiter pair or map a new name to an existing renderer. Open previews refresh when the setting changes. This example keeps both Hugo forms and adds [[ plot … ]] … [[ !plot ]].

{
  "markdownChartPreview.shortcodes": {
    "enabled": true,
    "delimiters": [
      { "open": "{{<", "close": ">}}" },
      { "open": "{{%", "close": "%}}" },
      { "open": "[[", "close": "]]", "endPrefix": "!" }
    ],
    "aliases": { "plot": "plotly", "snippet": "codeblock" }
  }
}

The default closing prefix is /. Set enabled to false to turn off shortcodes. Image references and fenced blocks continue to work. Aliases can target chart, d2, drawio, echarts, excalidraw, mermaid, plantuml, plotly, or codeblock.

Offline support

Format Supported features
Chart.js Line, bar, pie, and other built-in chart types configured in JSON
Mermaid VS Code's built-in Mermaid renderer and editor theme settings
ECharts 2D, gl, wordcloud, and liquidfill. GL charts need WebGL in the preview.
Plotly cartesian, geo, gl3d, gl2d, and finance. Geographic base maps ship in the VSIX. Tile maps show a diagnostic in offline mode.
draw.io Uncompressed and compressed XML, page switching, zoom, and basic, flowchart, and BPMN stencils
Excalidraw SVG export, bundled fonts, and embedded raster images
D2 Bundled WASM, relative .d2 imports, local raster icons, SVG links, and animations
PlantUML Bundled MIT-licensed headless engine, Viz.js, modern light and dark defaults, the original plain option, and upstream themes with explicit permissive grants. Static relative !include directives can nest. Unavailable themes, remote includes, and includes that require preprocessor control flow show a diagnostic in the diagram.
External code Native syntax highlighting, lang / language, and inclusive, 1-based from and to line numbers

Relative paths resolve from the Markdown document in the preview. Trusted workspaces allow files under the same workspace root. A single-file window uses the Markdown document's directory as its boundary. D2 and PlantUML dependencies resolve from the file that refers to them. Editing an open dependency or saving a change refreshes the preview. Run Markdown Chart Preview: Retry Sources after a deferred job or a read failure.

Render concurrency

Use the extension's concurrency settings to limit source jobs, preview draws, and live WebGL charts. Render concurrency

Build and verify

Run npm ci, npm test, and npm run package:vsix to build dist/markdown-chart-preview.vsix. Use npm run test:engines to verify D2 and PlantUML output. To exercise the native preview, run node test/vsix-smoke.mjs <Code executable> <out/cli.js>. The test supports --no-workspace, --no-webgl, --development, and --pressure. Verification record · Execution plan

License

The original extension code and documentation use the MIT License. Bundled third-party components retain their upstream terms. MIT License · Third-party licenses and source links

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