{"name":"@starptech/rehype-webparser","version":"0.1.5","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 --verbose --detectOpenHandles","test-coverage":"npm run test -- --coverage","tslint":"tslint -c tslint.json -p tsconfig.json","prepublish":"npm run build-ts"},"keywords":[],"author":{"name":"Dustin Deus","email":"deusdustin@gmail.com","url":"http://www.starptech.de"},"license":"MIT","dependencies":{"@starptech/hast-util-from-webparser":"^0.1.5","@starptech/webparser":"^0.1.5","vfile-message":"^1.0.1"},"devDependencies":{"jest":"^23.6.0","ts-jest":"^23.10.2","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":"ecfbddf9f15735c55d51f7b50c9f0f969be8f871","_resolved":"","_integrity":"","_from":"file:starptech-rehype-webparser-0.1.5.tgz","_id":"@starptech/rehype-webparser@0.1.5","_npmVersion":"6.4.1","_nodeVersion":"10.10.0","_npmUser":{"name":"starptech","email":"deusdustin@gmail.com"},"dist":{"integrity":"sha512-pcpMUk3vwiZBsWBpTO+rW5PrnS32Qe+cLP//wio/eBV8mm8BGYXYkN6KdeF7CeqQ5WYrRJfe4VPMCDDRRksQLg==","shasum":"34ebef3467462d696cb768a6cab9340d70944056","tarball":"http://registry-npm.ywwl.com/@starptech/rehype-webparser/download/@starptech/rehype-webparser-0.1.5.tgz","fileCount":12,"unpackedSize":9612,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbsMBsCRA9TVsSAnZWagAAlOwP/ipZAU//iXE39xadDKFx\nq9u/25+PD5EdxfTXoW3h0u/pN4WNj6asQYnYm3mnCJ5n1Eu0QQHszRmrYQyx\nPG04JrIskD627S/k9J1fHraIkeT1bwWiLtROLs0HcTSh2lw5rnI6dDo9m1QV\nKb5l3gwJjmCcDqaOoJvuA4BxsCl5StQfLeMEHm/Yo438WSJRywt54VvpS+7Y\n/bfyjQovdZk562/dzxhNXQlBowbjLCQzRHypPp0OHheWjT7jY6neZSsOezo4\nmM5TIDGb3zICUPC8FPe1X3560wuzkDdJkb87++fCb2t89VDNGngAUPhNm0Kq\nb0JLiTQ8yKRxnidblc0E+fTzcXX9ag8Awq0bYVzVV2m074Q27yXkMoiZddDX\n6x6ga/aAq+Et9uEyNOOEGGHxr4VqYLdP5onlKdiEukeMYMZqlu5bfVFPHWDq\nyRDx7UMOBb/apaziUJadYPwqSdbodpdv+gr7eT/gA9FcDY3ET4jB0DfZrDYE\n+L0WeudWY+p9nH0zEOaIRd9jai7U2uECB63m4BkINLU1l45HVGPL4YU4wC8p\n01AuTxYlEyMCaffDDXhX/c9uXdNyc2+795s28izjD8Q4TxxytbS/pTPbxi1z\n3VmEOdEvYmkyXvc67zYdwVj/G8GccM9LbKAkvyOwM0l1zrPq23g2XXxMn0eE\nfaU6\r\n=TOqO\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBiD16mffrZzVxQQVB00cto555EYkg+mWYGxdIjWWTneAiEAxioA1A49agbtKF1tutsmq5w/mn+dcftp4ZHIpasiTHk="}],"size":3958,"noattachment":false,"key":"/@starptech/rehype-webparser/-/@starptech/rehype-webparser-0.1.5.tgz"},"maintainers":[{"name":"starptech","email":"deusdustin@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rehype-webparser_0.1.5_1538310251609_0.8968611713377432"},"_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":1538310251753,"_cnpm_publish_time":1538310251753,"dist-tags":{"latest":"0.10.0"}}