{"name":"@starptech/rehype-webparser","version":"0.8.17","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":"yarn run test -- --coverage","tslint":"tslint -c tslint.json -p tsconfig.json","prepublish":"yarn 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.8.17","@starptech/webparser":"^0.8.17"},"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":"f51b884554e7d3f7ae31fc3245f89e606334109a","_id":"@starptech/rehype-webparser@0.8.17","_nodeVersion":"8.10.0","_npmVersion":"lerna/3.13.0/node@v8.10.0+x64 (linux)","_npmUser":{"name":"starptech","email":"deusdustin@gmail.com"},"dist":{"integrity":"sha512-8GklGO1DSCyFqQKl8ZyL0mu3LDIc3DN1w8vj28EYxUinAGUWCGyaimC7QDyvs4hK75XM1NddPzR0fFBlBOXn1g==","shasum":"8b6c0d77719cb595d3e4a441aab6aba94ceac6d1","tarball":"http://registry-npm.ywwl.com/@starptech/rehype-webparser/download/@starptech/rehype-webparser-0.8.17.tgz","fileCount":8,"unpackedSize":12886,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcqjbrCRA9TVsSAnZWagAAopYP/3Z6GcQNi4c1YcfJiePy\nFW16ZRT4a9+w33Djzw4n8wfLGILjysPdqJq7/EKJIl5F9z/bmhAUspmfT03U\nPn+jbNJKv5qlduS51HRhqMu50fs1fz22Vb7TJszPBhq+JjlpKZyIA1euYKbP\nvVBrlVvJLoZNF2LZW3oSWsIwHPOdc4SsZqDQPWb6VP4HB96jqC96TeIGfNbO\nLbBcytEggDhmihqt6ZjlrAUW0efznmH+So2AuEhOsd9K5lbMUiodHxoZ3das\nHxTFd6EBtywNQTQ2PT7emxigrganSUCS0VURwN/QxAUMssUXDCvNNM3poKK0\nUFK+LJj1xgdcjvdOMKo1wZR7IVqKSPAVOWt80YMRtWVqosYQPmzF2+dA2tTz\nmHE61N894p6g7cnac+0rGWf0N9b8WFqsmIp2eqo3XQjGbxDrITANDgrvg5zz\n++YkRCvTD3UOKVeYeGiW5zSyCxuFKYsmHQpWY79dOLcsQHE11l3EJowM0S0J\nrj31JnRL9oqJ3Z49Ah070Ah9rXZivuMjcs+50obasCLqPNFAjD6cFUtlByrk\nZGJZxt3LyUJA9x+sG20nm8t/COpwxJi1KTARH/PpfIJweNfb7jXGcGjnAHaG\n8oNVnC+IFrRS326xyt3G6yWXT4x7yn1pd/dtrhNgc6UKY//rVbw5qr/ExrHs\no3kz\r\n=4dFk\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFc114Asm2ttINzef3v8bsd67SOhv9B4O3bShm6vEIQdAiEAsqUcw6SztfAUy7l3S9t8ssqBNgNK3RhI/KXG3gpnHD0="}],"size":3846,"noattachment":false,"key":"/@starptech/rehype-webparser/-/@starptech/rehype-webparser-0.8.17.tgz"},"maintainers":[{"name":"starptech","email":"deusdustin@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rehype-webparser_0.8.17_1554659051031_0.79431509541145"},"_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":1554659051143,"_cnpm_publish_time":1554659051143,"dist-tags":{"latest":"0.10.0"}}