CompMD is coming to your editor
CompMD is still in its early stages, but it is quietly becoming a lot more approachable: it is coming to your editor. Writing components by hand in a plain text editor works, but you have to remember which components you have, what each one takes, and whether that expression in braces really means what you think it does, until you build the page. An editor that knows CompMD tells you all of that while you type.
As of CompMD 0.14.0, there is a tree-sitter grammar
for CompMD and a language server, compmd-lsp, and
five editors to get first-class support on them:
| Editor | CompMD support | Status | |
|---|---|---|---|
| Neovim | compmd.nvim, a plugin | Today | |
| Emacs | compmd-ts-mode, a major mode | Today | |
| Helix | the grammar and the server, as they are: no plugin needed | Today | |
| VS Code | an extension, with a TextMate grammar | Next week | |
| Zed | an extension | Next week |
Getting started
If you want to follow along, the steps below get you going in a few minutes. If your setup needs more than that, the Author's Guide has a chapter for each editor: Neovim, Emacs and Helix.
First, in every editor: the language server. Install it once, with whichever you have:
npm install -g @compmd/lsp # with Node.js
cargo install compmd-lsp # with Rustor download its file for your computer from the latest release
and put it on your PATH. Emacs can also download it for you, the first time you open a document.
Neovim
You need Neovim 0.12 or later, git and the tree-sitter command. Add the plugin, with lazy.nvim (in LazyVim, a file
of its own under lua/plugins/):
return {
{ 'comp-markdown/compmd.nvim', dependencies = { 'nvim-treesitter/nvim-treesitter' } },
}then install the grammars once, with :TSInstall compmd, and open a .comp.md file.
Emacs
You need Emacs 30 or later, git and a C compiler. Add the mode, with use-package:
(use-package compmd-ts-mode
:vc (:url "https://github.com/comp-markdown/compmd-ts-mode" :rev :newest)
:hook (compmd-ts-mode . eglot-ensure))then install the grammars once, M-x treesit-install-language-grammar for compmd, compmd-inline and cel, and
open a .comp.md file. Doom Emacs users: the chapter has the package! line.
Helix
Helix needs no plugin. Copy the entries of editors/helix/languages.toml
into your ~/.config/helix/languages.toml, and its queries/ folders into ~/.config/helix/runtime/queries/, then
build the grammars once:
hx --grammar fetch
hx --grammar buildhx --health compmd tells you whether Helix found the grammar, the queries and the server.
Then what?
Open a document, and here is what you get:
Headings, tables and boxes as they will look, while the text stays as you wrote it.
Completion, imports added for you, and each component's documentation where you use it.
The paths and functions you can use, and every value shown beside its expression.
The page in your browser, as a site renders it, following you as you type.
The document, drawn in place
In Neovim and Emacs, your document looks much like the page it will become: headings, tables, boxes and the frontmatter are drawn in place, and the file itself stays exactly as you wrote it. Move the cursor onto a line, and it shows its plain text again, so you always know what you are editing. For tables, we took our cue from render-markdown.nvim, the renderer behind LazyVim's Markdown extra, which does this beautifully. Here is the same document in my own setups:

Figure 1. LazyVim in Ghostty: the frontmatter, headings, a table, a row and its boxes drawn in place, with the preview beside it.

Figure 2. Doom Emacs: the same document, drawn in place, with the preview beside it.
Helix has no plugins to draw with, so there you write the plain text and keep the preview open beside it. Everything below works in Helix too:

Figure 3. Helix: the same document as written, with the preview beside it.
Components, without the guesswork
Type ::, and your editor lists the components you can use. Pick one from a pack, and its import goes into the
frontmatter for you, which is the part I like most. Not sure what a component takes? Hover over it for its
documentation and an example. And if something is off, it is underlined right away, often with a fix one keystroke
away.
Expressions, as you write them
Expressions get completion too, for the md. paths and functions you can use. Better still, you see what each one
comes to as you write: # {{md.doc.title}} shows = Harbour notes right after it, so no more guessing what the page
will say.
The preview
When you want to see the real thing, open the preview: :LspCompmdPreview in Neovim, C-c C-p in Emacs, or the
Open preview code action in any of them. It shows the page in your browser and keeps up as you type. Check this out:

Figure 4. A Mermaid diagram in LazyVim, its preview redrawn as each edge is typed.
If you write your own components, the preview draws their examples too, and the CompMD Inspector is one tab away when you want to look under the hood.
Good, so what can I do with this?
Well, I think at this point it is getting quite useful, for local note taking with all of CompMD's components: the ones already out, the ones coming up, and maybe even your own. With the Mermaid and wireframe components, it can already be used for design documentation: a diagram and a screen sketch in the same file as the text about them, readable as plain Markdown in a pull request. I have already started using it for that.
I would love to hear what else people would use it for.
What's next
A few things are coming next: a TextMate grammar, and CompMD in VS Code and Zed. The language server is getting more too: templates, formatting and refactorings.
In the meantime, please try it in your editor and tell me what you think, in the comments below or in an issue on GitHub. What's missing, what's annoying, and what you'd want next all help us decide where to go from here.
Until next time...
Hakan Serce