Project: rehypejs/rehype-remark

Package: rehype-remark@8.0.0

  1. Dependencies: 1·Dependents: 38
  2. rehype plugin to transform to remark
  1. remark 198
  2. unified 168
  3. markdown 138
  4. html 110
  5. mdast 88
  6. rehype 75
  7. remark-plugin 75
  8. hast 61
  9. rehype-plugin 53


Build Coverage Downloads Size Sponsors Backers Chat

rehype plugin to bridge or mutate to remark.

Tiny wrapper around hast-util-to-mdast.


This plugin is ready for the new parser in remark (remarkjs/remark#536). No change is needed: it works exactly the same now as it did before!



npm install rehype-remark


Say our example.js looks as follows:

var unified = require('unified')
var createStream = require('unified-stream')
var parse = require('rehype-parse')
var rehype2remark = require('rehype-remark')
var stringify = require('remark-stringify')

var processor = unified().use(parse).use(rehype2remark).use(stringify)


Now, when running the following in a terminal (2>/dev/null is just to silence Curl’s debugging output):

curl https://example.com 2>/dev/null | node example.js

stdout(4) yields:

# Example Domain

This domain is for use in illustrative examples in documents. You may use this domain in literature without prior coordination or asking for permission.

[More information...](https://www.iana.org/domains/example)


origin.use(rehype2remark[, destination][, options])

rehype (hast) plugin to bridge or mutate to remark (mdast).


If given (Unified), runs the destination processor with the new mdast tree, then, after running discards that tree and continues on running the origin processor with the original hast tree (bridge-mode). Otherwise, passes the tree to further plugins (mutate-mode).


Options are passed to hast-util-to-mdast. Note that options.document defaults to true in rehype-remark, as this plugin is mostly used with blocks.


Use of rehype-remark can open you up to a cross-site scripting (XSS) attack if the tree is unsafe. Use rehype-sanitize to make the tree safe.


See contributing.md in rehypejs/.github for ways to get started. See support.md for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.


MIT © Titus Wormer