- Category
- Interop
- Maintained by
- rehype team
- License
- MIT
- Module format
- ESM, default export
npm install rehype-remarkWhat it does
rehype-remark transforms hast into mdast using hast-util-to-mdast. Plugins used after it are remark plugins, and remark-stringify turns the result into Markdown text.
Example
import {unified} from 'unified'
import rehypeParse from 'rehype-parse'
import rehypeRemark from 'rehype-remark'
import remarkStringify from 'remark-stringify'
const html = `<h2>Changelog</h2>
<p>Fixed <strong>two</strong> bugs. See <a href="https://github.com/rehypejs/rehype">the repo</a>.</p>
<ul><li>Parser</li><li>CLI</li></ul>`
const file = await unified()
.use(rehypeParse)
.use(rehypeRemark)
.use(remarkStringify)
.process(html)
console.log(String(file))## Changelog
Fixed **two** bugs. See [the repo](https://github.com/rehypejs/rehype).
* Parser
* CLIremark-stringify uses * for bullets by default; pass {bullet: '-'} to it if you prefer dashes. Add remark-gfm after rehype-remark to write tables, strikethrough and task lists.
Options
document(defaulttrue): whether the input is a complete document; affects paragraph wrapping.newlines(defaultfalse): keep line endings when collapsing whitespace.checked(default'[x]') andquotes: how checkboxes and<q>elements are written.handlersandnodeHandlers: custom conversion for specific elements, merged into the defaults.
Limits
Markdown has no syntax for many HTML features (classes, layout elements, merged table cells, forms), so those are dropped or simplified. Review converted content before publishing it. Try conversions instantly in the HTML to Markdown converter.
Official references
- rehype-remark readme (API and all options) (opens in a new tab)
- rehype-remark on npm (current version) (opens in a new tab)
Facts on this page were checked against the package readme on November 11, 2026. Options not covered here are documented upstream.