Convert HAST trees to MDAST trees.
Based on the code in mdast-util-to-hast, this module provides a way to transform an HTML abstract syntax tree into a markdown abstract syntax tree.
Used with rehype and remark, this allows you to convert HTML into markdown.
So far this only transforms a few HTML elements, and there's more work to do. To see what's been completed so far look at the handlers directory.
npm install --save hast-util-to-mdast
var unified = require('unified')
var parse = require('rehype-parse')
var stringify = require('remark-stringify')
var toMDAST = require('hast-util-to-mdast')
var result = unified()
.use(parse)
.use(function () { return toMDAST })
.use(stringify)
.process(html, { fragment: true })
console.log(result.contents)