VS Code Extension
Markdown Viewer is available as a VS Code extension, allowing you to preview and export Markdown documents directly within your editor.
Overview
| Feature | Status |
|---|---|
| Markdown preview | ✅ |
| Word export | ✅ |
| All diagram types | ✅ |
| LaTeX formulas | ✅ |
| 29 themes | ✅ |
| Live preview | ✅ |
Installation
From VS Code Marketplace
- Visit VS Code Marketplace - Markdown Viewer Extension
- Click Install
- Or open VS Code, go to Extensions (
Ctrl+Shift+X/Cmd+Shift+X) - Search for “Markdown Viewer Extension”
- Click Install
From Open VSX
For VSCodium or offline installations:
- Visit Open VSX - Markdown Viewer Extension
- Click Install
From Command Line
code --install-extension xicilion.markdown-viewer-extension
Features
Live Preview
As you edit your Markdown file, the preview updates in real-time.
Open Preview:
- Command Palette:
Markdown Viewer: Open Preview - Keyboard:
Ctrl+Shift+V/Cmd+Shift+V - Right-click file → “Open Preview”
Side-by-Side Editing
Edit and preview simultaneously:
Ctrl+K V/Cmd+K V— Open preview to the side
Export to Word
Export the current document to Word:
- Command Palette:
Markdown Viewer: Export to Word - Right-click in editor → “Export to Word”
Usage
Opening Preview
- Open a
.mdfile in VS Code - Click the preview icon in the top-right corner
- Or use keyboard shortcut
Ctrl+Shift+V
- Or use keyboard shortcut
- Preview opens in a new tab
Exporting
- Open the Markdown file
- Open Command Palette (
Ctrl+Shift+P/Cmd+Shift+P) - Type “Markdown Viewer: Export to Word”
- Choose save location
- Word document is created
Settings
Access settings: File → Preferences → Settings → Markdown Viewer
| Setting | Default | Description |
|---|---|---|
markdownViewer.theme |
default |
Document theme |
markdownViewer.fontSize |
14 |
Preview font size |
markdownViewer.lineHeight |
1.5 |
Line height |
settings.json Example
{
"markdownViewer.theme": "business",
"markdownViewer.fontSize": 16,
"markdownViewer.lineHeight": 1.6
}
Diagrams in VS Code
All diagram types work in VS Code:
Mermaid
```mermaid
graph TD
A[Start] --> B[End]
```
Graphviz
```dot
digraph G {
A -> B
}
```
Vega-Lite
```vega-lite
{
"data": {"values": [{"x": 1, "y": 2}]},
"mark": "point",
"encoding": {
"x": {"field": "x"},
"y": {"field": "y"}
}
}
```
Keyboard Shortcuts
| Action | Windows/Linux | macOS |
|---|---|---|
| Open Preview | Ctrl + Shift + V |
Cmd + Shift + V |
| Preview to Side | Ctrl + K V |
Cmd + K V |
| Export to Word | Via Command Palette | Via Command Palette |
Integration with VS Code
Works With
- ✅ VS Code built-in Markdown features
- ✅ Git diff view
- ✅ Remote workspaces
- ✅ WSL
- ✅ GitHub Codespaces
File Types
| Extension | Language ID | Supported |
|---|---|---|
.md |
markdown |
✅ |
.markdown |
markdown |
✅ |
.mermaid |
mermaid |
✅ |
.vega, .vl |
vega |
✅ |
.gv, .dot |
graphviz |
✅ |
.infographic |
infographic |
✅ |
Advantages Over Browser Extension
| Aspect | VS Code | Browser |
|---|---|---|
| Editing | Native code editing | View only |
| Live Preview | Real-time as you type | Manual refresh |
| File Management | Full VS Code features | Browser-based |
| Git Integration | Built-in | None |
| Workspace | Multi-file projects | Single file |
Use VS Code when you’re actively writing and editing. Use Browser when you’re reading or sharing documents.
Troubleshooting
Preview Not Showing?
- Verify the extension is installed and enabled
- Check file type is
.mdor.markdown - Try reloading VS Code window (
Ctrl+Shift+P→ “Reload Window”)
Diagrams Not Rendering?
- Check diagram syntax
- Wait for initial render (may take a moment)
- Check VS Code Developer Tools for errors
Export Fails?
- Ensure you have write permissions
- Check available disk space
- Try a different save location
Development
Building from Source
cd vscode
npm install
npm run build
Testing
npm run test
Debugging
- Open project in VS Code
- Press
F5to launch Extension Development Host - Test in the new VS Code window
Source Code
GitHub: markdown-viewer-extension
VS Code-specific code is in the vscode/ directory.