Markii for VS Code
Preview for Markii (.mk.md) documents: CommonMark plus a small directive
syntax that renders components: callouts, cards, tabs, dashboard stats,
and more. See the
format guide
for the full picture.
Getting started
No setup. After installing the extension:
- Open any file ending in
.mk.md (create one if you like; it's an
ordinary text file).
- Press Ctrl+Shift+V
(Cmd+Shift+V on macOS). You can also
click the preview icon at the right of the editor title bar, or run
Markii: Open Preview from the command palette.
In a .mk.md file that shortcut opens the Markii preview; in a plain .md
file it still opens VS Code's built-in markdown preview, unchanged.
The preview opens beside the editor, follows whichever .mk.md file is
active, updates as you type, and matches your VS Code theme.
Something to paste into a new file to see it work:
# Hello Markii
:::callout{type=warning title="It works"}
This is a **component**, not plain markdown.
:::
Press :kbd[Ctrl+Shift+P] anytime.
Features
- Components. Renders the whole format: directives, the standard
component set (callouts, cards, tabs, dashboard stats, and more), layout
wrappers, tables, and frontmatter.
- Live preview. Opens beside the editor, follows the active
.mk.md
file, updates as you type, matches your VS Code theme, and highlights
directive syntax in the editor too.
- Scripts, on demand. Press Markii: Run Scripts and each named Lua
script block runs in a sandbox, feeding the data-bound components
(
stat, progress, chart, :value[...]). Scripts never run when a note
is only opened, and network access is granted one host at a time, with a
prompt. Until you run them, script blocks show a collapsed marker and
data-bound components show their quiet empty states.
- Monitoring notes. A note's last values are remembered, so reopening it
shows its figures immediately, marked stale, before any re-run. Turn on
markii.runOnOpen to run a note once when its preview opens, or set
markii.refreshIntervalSeconds to refresh it on an interval. Both run at
the read-only tier: they reuse only the hosts you already granted by hand,
never prompt on a timer, and never add network access.
- Component packs. Point the
markii.packs setting, or the Markii: Add
Pack Folder… command, at folders you trust as installed packs. Their
prefixed components (for example :::ana-timeline) render in the preview,
and their shared Lua is reachable from require "ana/..." in a note's
scripts. A note that uses a pack you have not installed stays readable: the
unknown component shows a labeled fallback. The setting is user-scope only,
so opening someone else's project never loads a pack on your behalf. See the
packs guide.
- Images. Local images resolve relative to the note (
nice.png beside
it, img/nice.png in a subfolder) and remote images load over https.
Anything outside the note's folder and your workspace is not loaded, the
same rule VS Code's own preview uses.
The extension has no rendering logic of its own: it hosts @markii/react,
the format's reference renderer, so the preview shows exactly what the
reference implementation renders.
Contributing
The extension lives in the
Markii monorepo. Build, debug, and
release details are in the repo's
AGENTS.md; issues
and pull requests are welcome there.
| |