remark-to-comark
A codemod and checker that moves a remark project to Comark and says what it leaves to you.
Install the global Vite+ CLI before running this command. Without it, replace vp dlx with pnpm dlx.
remark-to-comark moves a Markdown project from remark to Comark. It changes only what remark would still render the same, and reports the rest with a fix.
Features
Section titled "Features"migratedoes the whole move in one command, then lists what's left for you.checklists every remark setup it finds, with a fix for each problem.rewriteswaps a unified chain for Comark'srenderHtmlwhen every plugin carries over.contentescapes the Markdown Comark would read differently.- It finds setups in unified, react-markdown, Vue, Svelte, Astro, Next.js, Docusaurus, Gatsby, and Nuxt Content.
- It also runs in Vite Doctor.
Tested on 100 projects.
Why Comark
Section titled "Why Comark"Comark renders components written in plain-text Markdown to Vue, React, Svelte, Angular, HTML, and the terminal, and it renders a half-streamed reply without breaking. It turns Markdown into HTML 6 to 7 times faster than remark, but its browser bundle is bigger. Speed and size has the numbers.
Migrate the project in the current directory:
pnpm dlx remark-to-comark migrateIt escapes the Markdown, rewrites the unified chains, and ends with what's left for you. It only runs on a clean git tree, so git diff shows every change and git checkout . undoes them. To see the findings first without changing anything, run pnpm dlx remark-to-comark check. Getting started explains each step.
Limits
Section titled "Limits"- It leaves MDX alone, because JSX and expressions need a JavaScript runtime. Docusaurus compiles
.mdas MDX too, unless its config setsmarkdown.format: "detect". - It reports framework configs but doesn't rewrite them, since the framework owns the parser.
- You port your own remark plugins by hand.
- It leaves a block as written when no edit keeps remark's output the same, and reports it as RTC0303.