Transform HAST (HTML) to MDAST (markdown).
This is stable in versioning now, but may change a bit in the future.
See GH-3 for progress.
npm:
npm install hast-util-to-mdast
var rehype = require('rehype');
var remark = require('remark');
var toMDAST = require('hast-util-to-mdast');
var hast = rehype().parse('<h2>Hello <strong>world!</strong></h2>');
var doc = remark().stringify(toMDAST(hast));
console.log(doc);
Yields:
## Hello **world!**
Transform the given HAST tree to an MDAST tree.
- Object mapping tag-names to functions handling those elements.
Take a look at
handlers/
for examples.