Tiny wrapper around
npm install rehype-remark
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
# 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...]( )
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).
remark-rehype— Transform Markdown (mdast) to HTML (hast)
rehype-retext— Transform HTML (hast) to natural language (nlcst)
remark-retext— Transform Markdown (mdast) to natural language (nlcst)
This project has a Code of Conduct. By interacting with this repository, organisation, or community you agree to abide by its terms.