Esc

A codemod and checker that moves a remark project to Comark and says what it leaves to you.

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.

  • migrate does the whole move in one command, then lists what's left for you.
  • check lists every remark setup it finds, with a fix for each problem.
  • rewrite swaps a unified chain for Comark's renderHtml when every plugin carries over.
  • content escapes 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.

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 migrate

It 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.

  • It leaves MDX alone, because JSX and expressions need a JavaScript runtime. Docusaurus compiles .md as MDX too, unless its config sets markdown.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.