markdown-it-to-comark
A codemod and checker that moves a markdown-it 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.
markdown-it-to-comark moves a project from markdown-it to Comark. It changes only what markdown-it would still render the same, and reports the rest with a fix.
Features
Section titled "Features"checklists every markdown-it setup it finds, with a fix for each problem.rewriteswaps a markdown-it instance for Comark'srenderHtmlwhen every option and plugin carries over.contentescapes the Markdown Comark would read differently.markdownItPlugin()runs a markdown-it plugin on Comark, renderer rules included, so plugins keep their output.- It finds setups in your own code and in VitePress, VuePress, Vite Markdown plugins, Eleventy, and VS Code extensions.
- It also runs in Vite Doctor.
Tested on 100 projects.
Why Comark
Section titled "Why Comark"Comark parses with markdown-exit, a port of markdown-it, so the Markdown reads the same. It 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. markdown-it stays smaller and renders synchronously.
Try the check without installing anything. It only reads the project:
pnpm dlx markdown-it-to-comark check .The whole migration is four commands. Getting started explains each one.
pnpm markdown-it-to-comark check .
pnpm markdown-it-to-comark content "**/*.md" --write
pnpm markdown-it-to-comark rewrite . --write
pnpm markdown-it-to-comark check .Limits
Section titled "Limits"- Comark renders asynchronously.
md.render()returns a string,renderHtml()a promise, sorewriteonly replaces an instance whose everyrendercall is inside an async function. - It reports framework setups but doesn't rewrite them, since the framework owns the instance.
- Plugins outside the tested list run through
markdownItPlugin(), but nobody has compared their output; check a few pages. - It leaves a block as written when no edit keeps markdown-it's output the same, and reports it as MIC0303.