darkmark is a VS Code and VSCodium extension that opens Markdown, spreadsheets, Word documents, PDFs and images in dark-themed viewers.
When you open a Markdown file in VS Code, you normally get the source text, and you have to open a separate preview pane to see what it looks like. darkmark flips that around. Every .md file opens straight into a dark rendered view, and you switch to the source only when you want to edit.
The preview is meant to show real documents well: READMEs with screenshots, notes with math, design docs with diagrams. Images, video and audio next to the file load, KaTeX math renders, Mermaid diagrams draw, and links between Markdown files keep you inside the preview.
Version 3 adds viewers for the other files that end up next to your docs: spreadsheets, CSV, Word documents, PDFs and images, in the same dark theme.
darkmark is for anyone who reads more Markdown than they write in VS Code or VSCodium, or who wants a cleaner reading view of project docs and notes.
- Opens
.md files as a preview by default: darkmark registers itself as the default editor for *.md, so files open rendered without any extra step.
- Dark theme: A custom dark stylesheet with Inter for body text, JetBrains Mono for code and the atom-one-dark syntax theme.
- Images, video and audio: Relative paths such as
, <img> and <video> resolve against the folder of the .md file, even when that folder is outside your workspace.  and  render as media players instead of broken images.
- YouTube embeds:
<iframe> embeds from youtube.com and youtube-nocookie.com play inside the preview.
- Math: Inline
$...$, block $$...$$ and fenced ```math blocks render with KaTeX. Math is rendered by the extension itself.
- Mermaid diagrams: Fenced
```mermaid blocks render as dark-themed diagrams.
- Task lists:
- [ ] and - [x] items render as checkboxes (read-only).
- Heading anchors and a Contents panel: Headings get GitHub-style ids,
#anchor links scroll smoothly, and a Contents button lists every h1 to h3 heading.
- Working links: Links to other
.md files open in darkmark, links to other files open in VS Code, and web or mail links open in your browser or mail client.
- Copy button: Every code block has a Copy button that copies its contents to the clipboard.
- Syntax highlighting: Code blocks with a language tag are highlighted with highlight.js.
- Live updates: The preview refreshes as you type in the source editor, and when the file changes on disk (for example after a
git checkout).
- Edit Source button: A button in the preview switches to the raw text editor at any time.
- File viewers: Dark viewers for
.xlsx, .xls, .ods, .csv, .tsv, .docx, .pdf and common image formats. See Viewers.
- Download the
.vsix file from the releases page.
- In VS Code or VSCodium, open the Extensions panel, click the
... menu and choose Install from VSIX....
- Select the downloaded
.vsix file.
On VSCodium, or any editor that uses Open VSX, you can also install it from Open VSX.
You can also install it from the command line:
code --install-extension darkmark-<version>.vsix
# or, for VSCodium
codium --install-extension darkmark-<version>.vsix
You need Node.js and npm.
git clone https://github.com/n1th1n-19/DARKMARK.git
cd DARKMARK
npm install
npm run package
npm run package compiles the TypeScript and runs vsce package, which produces a darkmark-<version>.vsix in the project folder. Install that file as described above.
If you are upgrading from 2.0.0, remove the old copy first. It installed as undefined_publisher.darkmark:
code --uninstall-extension undefined_publisher.darkmark
| File types |
Opens by default? |
What you get |
.xlsx .xls .ods |
Yes |
Sheet tabs, sticky column letters and row numbers, number, date and boolean styling |
.csv .tsv |
No: right-click, Open With..., then darkmark Sheet |
The same grid, with quoted fields and embedded newlines handled |
.docx |
Yes |
The document converted to HTML in the dark theme, with images, tables and working links |
.pdf |
Yes |
Pages, zoom, fit width, page navigation, search and selectable text |
.png .jpg .jpeg .gif .webp .svg .bmp .ico .avif |
No: Open With..., then darkmark Image |
Fit or 1:1, wheel zoom around the cursor, drag to pan, a checkerboard behind transparency and size info |
Every viewer has an Open with default editor button, and VS Code's find widget (<kbd>Ctrl</kbd>+<kbd>F</kbd>) works in all of them.
The viewers are light on memory. Files are streamed from disk and never copied into the extension. Only what is on screen is rendered: PDF pages near the viewport and sheet rows in view. A viewer tab you switch away from frees its memory and comes back at the same page, zoom and scroll.
Limits:
- Sheets show the first 50,000 rows and 1,000 columns.
- Password-protected PDFs are not supported yet.
- Video and audio files use VS Code's built-in preview.
Open any .md file from the Explorer, Quick Open or the command line. darkmark takes over automatically and shows the rendered preview. The editor tab is titled with the file name, and the preview stays alive when you switch to another tab, so your scroll position is kept.
You have three ways to get to the raw Markdown:
- Click the Edit Source button in the bottom-right corner of the preview.
- Run the command darkmark: Edit Source (
darkmark.openAsText) from the Command Palette.
- Right-click the file in the Explorer, choose Open With..., then Text Editor.
All three open the file in VS Code's normal text editor. If you keep the preview open in another editor group, it updates live while you type. Unsaved edits in the text editor take priority over the file on disk.
To go back to the preview, right-click the file and choose Open With... then darkmark, or simply reopen the file.
- Click the Contents button in the preview. A panel lists all h1, h2 and h3 headings.
- Click a heading to jump to it.
- Click Contents again to hide the panel.
The Contents button only appears when the document has at least one heading. Links such as [Setup](#setup) scroll to the matching heading. Heading ids follow GitHub's style: lowercase, punctuation removed, spaces turned into dashes, and repeated headings get -1, -2 suffixes.
- A relative link to another
.md or .markdown file, such as [Guide](docs/guide.md), opens that file in darkmark.
- A relative link to any other file, such as
[config](settings.json), opens it in VS Code.
- A link starting with
http://, https:// or mailto: opens externally in your default browser or mail client.
- Other URL schemes are ignored for safety.
Relative links resolve against the folder of the current .md file.
Put media files next to your Markdown (or in a subfolder) and reference them with relative paths:



<video src="demo.webm" controls></video>
<iframe src="https://www.youtube.com/embed/VIDEO_ID"></iframe>
Image syntax pointing at .mp4, .m4v, .webm, .mov or .ogv renders a video player. Image syntax pointing at .mp3, .wav, .ogg, .oga, .m4a or .flac renders an audio player. Remote https: images and media also load.
Inline: $E = mc^2$
$$
\int_0^1 x^2 \, dx = \frac{1}{3}
$$
```math
a^2 + b^2 = c^2
```
```mermaid
graph LR
A[Write] --> B[Preview]
B --> C[Ship]
```
While you are typing, an invalid diagram shows Mermaid's own error box instead of breaking the preview.
Hover any fenced code block and click Copy. The button briefly changes to Copied.
darkmark has no settings. It contributes the following to VS Code:
| Contribution |
ID |
Details |
| Custom editor |
darkmark.preview |
Display name darkmark, file pattern *.md, priority default (opens .md files automatically) |
| Custom editor |
darkmark.sheet |
Display name darkmark Sheet, *.xlsx, *.xls, *.ods, opens by default |
| Custom editor |
darkmark.csv |
Display name darkmark Sheet, *.csv, *.tsv, available from Open With... |
| Custom editor |
darkmark.docx |
Display name darkmark Word, *.docx, opens by default |
| Custom editor |
darkmark.pdf |
Display name darkmark PDF, *.pdf, opens by default |
| Custom editor |
darkmark.image |
Display name darkmark Image, common image formats, available from Open With... |
| Command |
darkmark.openAsText |
Title darkmark: Edit Source. Reopens the file in the default text editor |
To turn a viewer off or make one the default, use VS Code's built-in workbench.editorAssociations setting, for example "*.md": "default" for the plain text editor, "*.pdf": "default" to turn off the PDF viewer, or "*.csv": "darkmark.csv" to open CSV files in darkmark. You can still open the preview with Open With... then darkmark.
darkmark is a read-only custom editor built on VS Code's CustomReadonlyEditorProvider API. It has three main parts.
The extension host side registers the darkmark.preview editor for *.md. When you open a file, it reads the file, renders it, and shows the result in a webview. It watches two sources of change: edits in an open text editor for the same file, and changes to the file on disk. Each change triggers a re-render that is posted to the webview. A small counter makes sure a slow disk read never overwrites newer content.
The Markdown engine uses markdown-it with HTML, auto-linking and typographic replacements turned on. On top of it darkmark adds:
- KaTeX math through @vscode/markdown-it-katex, including fenced
math blocks.
- A rule that gives every heading a GitHub-style id.
- A custom image renderer that turns video and audio files into players.
- Task list conversion for
[ ] and [x] items.
- Mermaid fences emitted as
<pre class="mermaid"> for the client to render.
The page includes a <base> tag pointing at the Markdown file's folder, so all relative paths resolve next to the document.
The preview script runs inside the webview. After every render it highlights code with highlight.js, adds copy buttons, rebuilds the Contents panel and runs Mermaid. Because a webview cannot navigate on its own, the script catches link clicks and sends them back to the extension, which decides whether to open the target in darkmark, in VS Code or externally.
Security notes:
- The webview uses a strict Content Security Policy. Only darkmark's own scripts, marked with a random nonce, can run. Script tags written inside your Markdown cannot load.
- Only
http, https and mailto links are handed to the operating system.
- Mermaid runs with its
strict security level.
- The webview can read files from the extension, the document's folder and your workspace folders.
- VS Code or VSCodium 1.90.0 or newer.
- An internet connection for syntax highlighting, Mermaid diagrams and the Inter and JetBrains Mono fonts, which load from public CDNs (cdnjs and Google Fonts). Math rendering is bundled and works offline.
- To build from source: Node.js and npm.
Problem: An .mp4 video does not play. VS Code ships without proprietary codecs, so H.264 .mp4 files may not play. Convert the video to .webm for reliable playback.
Problem: Code is not highlighted and Mermaid blocks show raw text. highlight.js and Mermaid load from a CDN. When you are offline they cannot load. The preview still works: the Edit Source button, Contents panel, copy buttons, links and math keep working.
Problem: A Mermaid diagram shows an error box. The diagram source is invalid. This is common while you are still typing. Fix the syntax and the preview updates.
Problem: I cannot tick the task list checkboxes. The preview is read-only. Edit [ ] to [x] in the source.
Problem: A local image does not show. Check that the path is relative to the .md file's folder, not to the workspace root. Paths with spaces should be URL-encoded (%20) or wrapped in angle brackets, as in standard Markdown.
Problem: A link does nothing when clicked. Only http, https and mailto links open externally. Other schemes are blocked on purpose.
Problem: I want the normal text editor back for Markdown. Use Edit Source, or set workbench.editorAssociations so *.md opens with default.
darkmark is released under the MIT License.
It is built on:
Source code: github.com/n1th1n-19/DARKMARK.