# remark-to-comark

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

## Features

- `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](https://comark-ui.onmax.me/remark-to-comark/diagnostics/) 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](https://comark-ui.onmax.me/remark-to-comark/vite-doctor/).

Tested on [100 projects](https://comark-ui.onmax.me/remark-to-comark/testing/).

## 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](https://comark-ui.onmax.me/remark-to-comark/testing/#speed-and-size) has the numbers.

## Usage

Migrate the project in the current directory:

```sh
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](https://comark-ui.onmax.me/remark-to-comark/getting-started/) explains each step.

## Limits

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

## Sitemap

See the full list of pages in [llms.txt](https://comark-ui.onmax.me/llms.txt).
