JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 216903
  • Score
    100M100P100Q168744F
  • License MIT

remark support for rehype

Package Exports

  • rehype-remark

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rehype-remark) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

rehype-remark Build Status Coverage Status

Bridge / mutate from rehype to remark.

Tiny wrapper around hast-util-to-mdast.

Installation

npm:

npm install rehype-remark

Usage

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);

process.stdin.pipe(createStream(processor)).pipe(process.stdout);

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 established to be used for illustrative examples in documents. You may use this domain in examples without prior coordination or asking for permission.

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

API

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

Either bridge or mutate from rehype (HAST) to remark (MDAST).

destination

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 tree (bridge-mode). Otherwise, passes the tree to further plug-ins (mutate-mode).

options

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

License

MIT © Titus Wormer