{"name":"@starptech/rehype-webparser","version":"0.4.2","description":"Parses HTML via [**Webparser**](https://github.com/Prettyhtml/prettyhtml/tree/master/packages/webparser) to a [**HAST**](https://github.com/syntax-tree/hast) syntax tree.","main":"./dist/index.js","scripts":{"start":"ts-node index.ts","build-ts":"tsc","watch-ts":"tsc -w","test":"jest --forceExit --detectOpenHandles","test-coverage":"npm run test -- --coverage","tslint":"tslint -c tslint.json -p tsconfig.json","prepublish":"npm run build-ts"},"keywords":["webparser","parser","rehype"],"author":{"name":"Dustin Deus","email":"deusdustin@gmail.com","url":"http://www.starptech.de"},"license":"MIT","dependencies":{"@starptech/hast-util-from-webparser":"^0.4.2","@starptech/webparser":"^0.4.2"},"devDependencies":{"jest":"^23.6.0","ts-jest":"^23.10.3","ts-node":"^7.0.1","tslint":"^5.11.0","tslint-eslint-rules":"^5.4.0","typescript":"^3.1.1","vrsource-tslint-rules":"^5.8.2"},"publishConfig":{"access":"public"},"gitHead":"e0c41744b2edd0c78df7198e4f461cccf37a83ae","_resolved":"","_integrity":"","_from":"file:starptech-rehype-webparser-0.4.2.tgz","_id":"@starptech/rehype-webparser@0.4.2","_npmVersion":"6.4.1","_nodeVersion":"11.0.0","_npmUser":{"name":"starptech","email":"deusdustin@gmail.com"},"dist":{"integrity":"sha512-AnbfyFXW+OedrXAOCGkhkF/TRETqyfYm6HJaGH5Qni2EQs7mcC7u2Eon+VnuOz3wmaIKHgeLMF50qVBUD4AZCw==","shasum":"4fd2b3ed5d32e13b160f4426a7f78d08bde4577c","tarball":"http://registry-npm.ywwl.com/@starptech/rehype-webparser/download/@starptech/rehype-webparser-0.4.2.tgz","fileCount":8,"unpackedSize":12997,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb1DsSCRA9TVsSAnZWagAAA7cP/3+wFoeiK5XmzF9JcBcO\nnd9RmSXYYrGVcPd0mBWFrL1nLewa2xrKj6AHAVPkgMrCFks8rqwbVzdyyRdf\nAFQt4G6jSgGKZmnSna8i4kKL49BprSWVD1ddBbxpUR1T6hzy3mPTrw9zdieC\nitV4P/x69feweMHTchV1TnVFB0BkHanLXmlH6kkSA8/n3tJqkOjCeYGU4DTk\nZhaEffDGPaj10k/KkofBwp9zf6Ib2dv75PAquLst16zhvsulEmNHG6QuFTGp\n7lthIhIs0aMyA4RuL/67IIBYupyDPvm6jhwY1qBSKaGjqXoHh3FHnotYT/0+\nQQnKCJCuHhdU0aQz5VgPzzGokcezVviTBT4cHcbPqEn+pmR19ln6bDL+kGoI\n3w5eDcwG31ncaKsdthBxzSuR3pgGdu3pb/Sa8IK35LfIKl8lCs1Ko6gC9Q3J\nB7FOEjxrkYsvyS/v60yHvctPNwMpDB6In5mM/qj5y/le6ldyzWM2cR4neqCb\n7HVdbPte2oGCwVuc0FBRmOh/hamN8TO0MdzIbDShxJiFw04vAPvjmiUE+I9O\ne5L0W4iygUiTO0dMkMb7lurroe1H2Ri+xvs7thmudBHn9DLDEeqee1ENakVL\nwNHAWDQ0TqIlGMpfG/H+P6aF4vKFm8c7A/BXIQvTWADFgDqYFTQvAE94hyNt\nlHRI\r\n=VRIh\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICIn8970XG8qQ2Ce4MI3z+vnfivMzOcMBOAKBsRF6sz1AiAC8ficX1oTqvb3o4yaEG4nyxW0MgVlAIkXC3rzvJKOBA=="}],"size":3871,"noattachment":false,"key":"/@starptech/rehype-webparser/-/@starptech/rehype-webparser-0.4.2.tgz"},"maintainers":[{"name":"starptech","email":"deusdustin@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rehype-webparser_0.4.2_1540635409480_0.2112524865498948"},"_hasShrinkwrap":false,"readme":"# @starptech/rehype-webparser\n\nParses HTML via [**Webparser**](https://github.com/Prettyhtml/prettyhtml/tree/master/packages/webparser) to a [**HAST**](https://github.com/syntax-tree/hast) syntax tree.\n\n## Installation\n\n```\nnpm install --save @starptech/rehype-webparser\n```\n\n## Usage\n\nThis example shows how we parse HTML with [**Webparser**](https://github.com/Prettyhtml/prettyhtml/blob/master/packages/webparser) transform it into [**HAST**](https://github.com/syntax-tree/hast) compatible structure and finally compile that data back to HTML with [hast-util-to-html](https://github.com/syntax-tree/hast-util-to-html).\n\nSay we have the following file, `example.html`:\n\n```html\n<!DOCTYPE html>\n<title>Hello!</title>\n<h1 id=\"world\">World!</h1>\n```\n\nAnd our script, `example.js`, looks as follows:\n\n```javascript\nconst vfile = require('to-vfile')\nconst report = require('vfile-reporter')\nconst unified = require('unified')\nconst parse = require('@starptech/rehype-webparser')\nconst toHTML = require('hast-util-to-html')\n\n// A compiler is needed to inform unified how to transform it back to HTML\nfunction stringify() {\n  this.Compiler = compiler\n\n  function compiler(tree) {\n    return toHTML(tree)\n  }\n}\n\nunified()\n  .use(parse)\n  //.use(yourPlugin)\n  .use(stringify)\n  .process(vfile.readSync('example.html'), function(err, file) {\n    console.error(report(err || file))\n    console.log(String(file))\n  })\n```\n\nNow, running `node example` yields:\n\n```text\n<!doctype html>\n<title>Hello!</title>\n<h1 id=\"world\">World!</h1>\n```\n\n## API\n\n### `processor.use(webparser[, options])`\n\nConfigure the `processor` to read HTML as input and process a\n[**HAST**](https://github.com/syntax-tree/hast) syntax tree.\n\n###### `options.*`\n\n[**Webparser**](https://github.com/Prettyhtml/prettyhtml/blob/master/packages/webparser) options.\n","publish_time":1540635409634,"_cnpm_publish_time":1540635409634,"dist-tags":{"latest":"0.10.0"}}