{"name":"@starptech/rehype-webparser","version":"0.10.0","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.10.0","@starptech/webparser":"^0.10.0"},"devDependencies":{"jest":"^24.8.0","ts-jest":"^24.0.2","ts-node":"^8.3.0","tslint":"^5.17.0","tslint-eslint-rules":"^5.4.0","typescript":"^3.5.2","vrsource-tslint-rules":"^6.0.0"},"publishConfig":{"access":"public"},"gitHead":"c417941cf747a0c94abd2dd17eb468395195e752","_id":"@starptech/rehype-webparser@0.10.0","_nodeVersion":"12.4.0","_npmVersion":"lerna/3.13.0/node@v12.4.0+x64 (linux)","_npmUser":{"name":"starptech","email":"deusdustin@gmail.com"},"dist":{"integrity":"sha512-1CPMVKrgXjKnehAouQBa2wWkikR6jD+BZ+8/v1RDH1S1a293fOzItU63W3VIx4zv3n0iMgrTWeeyfpk/9cT4LQ==","shasum":"a23d18812fbca3d416b010c3054162dfde3ed358","tarball":"http://registry-npm.ywwl.com/@starptech/rehype-webparser/download/@starptech/rehype-webparser-0.10.0.tgz","fileCount":8,"unpackedSize":12885,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdDVMLCRA9TVsSAnZWagAAg1YP/0MD4Z3Vz22ZaOjbO8PB\njiMK1W0QI8L4H9ce75pkqFsnPqsbMlofTImNzn7zkA3YVKuGmw75LINsKJzK\n/QfSv8/X+3fqCsB2jDJCpmflG8ngR9VH82x9RX0NYJB7wYIR5jetw9KOI1xY\nUqKzrDQ+OL7/82EekF7oFwIMLQTtO+sFp0JBEFyrLa5mAqH6ffFRmpgc9QC3\nF4XF/pfxo8N07vYO6XKrdwRuRuDvPP4qbCqyqvslCo5iJDr0rM6FnVootRC5\njezqQ9lBrIxIAw1fua7Qwp6KOazonL04qec9nRm/gRc17YHhuI4Zl6mKPsyF\nO8q0SV5d2ayjYPPMT4DccrMharQlIK90gAJma9JYxYlc+a87oQT7lOVkGusE\ns/zgNjoyTmN/ZWflVsoZEgVDYDi3HiQnkKVRZciAg0N1fapHe0V3RT1liT16\nZp7wpPb7XBSpH0FkhBpc5oUWszx+LFE+RhcHCJo796d7BYGyBUD2Y73zijbn\nDFa96n6+fwXGAAQtK2NnkkzX9+TredazS+pDZBFB8nvvX0dxnlKx/zXLMYqE\nPaMXBAB1NFEPzcxpi8cWVoWEynmqAx/6FlhRtN9Vs4O1kk+IH/lx16jwbWMs\nfLGMUBK7Z+/L0JJ1tOaQnsBB8Pa+tzXq2eB9mDOZuT7W5Hb4OpqpRfzMqN1Z\naxu0\r\n=xWH9\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEuR4zHn18IbkYxPNSoBKHwsQPBLVuhnT6F3zE1jJNw3AiBcoikovElIx+1wmwGOMIv6opkwPhi662WWensE3R8HTQ=="}],"size":3840,"noattachment":false,"key":"/@starptech/rehype-webparser/-/@starptech/rehype-webparser-0.10.0.tgz"},"maintainers":[{"name":"starptech","email":"deusdustin@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rehype-webparser_0.10.0_1561154315364_0.27962792064879616"},"_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":1561154315486,"_cnpm_publish_time":1561154315486,"dist-tags":{"latest":"0.10.0"}}