htmltree-stringify syntax tree (htmltree) -> xml/html $ npm i --save htmltree-stringify htmltree('<html><body onclick=foo></body></html>', function (err, doc) { var html = stringify(doc); console.log(html);});