migrate-to-comark
One command that finds remark, markdown-it, or marked in a project and moves it to Comark.
Install the global Vite+ CLI before running this command. Without it, replace vp dlx with pnpm dlx.
migrate-to-comark reads every package.json in a project, finds the Markdown libraries it uses, and runs the migrator for each one. It shows what each migrator found, asks, and then writes the changes.
npx migrate-to-comarkWhat it finds
Section titled "What it finds"| Library | Found through | Migrator |
|---|---|---|
| remark | unified, remark and rehype plugins, react-markdown, streamdown, MDX, Astro, Docusaurus, Gatsby, Nextra, Fumadocs, Nuxt Content, Contentlayer, Velite | remark-to-comark |
| markdown-it | markdown-it and its plugins, VitePress, VuePress, Slidev, Eleventy, Hexo, Marp | markdown-it-to-comark |
| marked | marked and its extensions, svelte-markdown, ngx-markdown | marked-to-comark |
showdown, Markdoc, markdown-to-jsx, commonmark.js, snarkdown, and markdown-wasm have no migrator yet. The wizard names them and leaves them alone.
What it writes
Section titled "What it writes"The wizard writes only what each migrator's own rewrite --write and content --write would. Before writing a file, it checks the file hasn't changed since the check read it. Each migrator checks every Markdown file, so in a project with two libraries both want the same files. A file goes to the library that its nearest package.json declares, such as a VitePress site's own package. When that package.json declares both libraries, or none above the file declares either, the wizard leaves the file alone and names both migrators.
Code that renders Markdown switches to Comark last. While any Markdown file its migrator handles still needs a fix by hand, or is left alone as above, the wizard keeps that code on its library and names the files it waits on, since switching it would change how they render. Fix them and run the wizard again.
On the 100 projects remark-to-comark was tested on, npx migrate-to-comark --yes writes the same files, byte for byte, as running remark-to-comark's content and rewrite by hand.
Everything else stays with each migrator: the warnings, what each plugin becomes, and the fixes. The wizard ends with the command that lists them.
Getting started covers the wizard and its flags.