{"name":"@starptech/rehype-webparser","version":"0.6.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":"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.6.0","@starptech/webparser":"^0.6.0"},"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":"cac4b4a67029454e823e3a2ac9f0f88be8c72ba8","_resolved":"","_integrity":"","_from":"file:starptech-rehype-webparser-0.6.0.tgz","_id":"@starptech/rehype-webparser@0.6.0","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"starptech","email":"deusdustin@gmail.com"},"dist":{"integrity":"sha512-zhfUwwTc9GG0/O8XWB0/tvKhF3wOLjJl95kGZ4krtgMwLRhzWg0kaQaGTBA+31wc4ZNOAWJj+rd9Tv09J7IAbw==","shasum":"86f07037c4e92675566286ab5598b42f91704a73","tarball":"http://registry-npm.ywwl.com/@starptech/rehype-webparser/download/@starptech/rehype-webparser-0.6.0.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\nwsFcBAEBCAAQBQJb5LUJCRA9TVsSAnZWagAAapwP/iPhrRE/oA3y8MokVdWK\neb2/n4DeAFRjGBVlYyFQ3krk4xOK28EYUH2R0hpgXNs8vbLFail0nIbw+7hE\n4UpGIEcNp9RCEuKkIy76jDxf0GeekKaepCNXKxeiSRB8NiUfsRFYE/7ZmtaK\nFVMUeqmVjAr60W/z34yIw8QiK/wNNVz+ZgXh8nM5HMmwx8q8uesHvcJBoQNA\ndLMmZVcunND71pJOwNBFFhCldfZvZrotnP0dK3gdba835Lp4KiO2KRzdWwnf\nkNCn/ofDlQwszlXLPR3Y0d9Q1c0Dl0ErLduIf6fvyGCz0xe5V9z8r6Cs469m\nJdR56mj9ZrHpdDoAwKhS0O3tJQgUYqn1CRoGNAKLcvOvU+fuj5h/BY+8KZQ0\nCg5dTg21ilQ6Hi1ltGw2tgAR/DcFrohCO/jXtReZPzznviVGiG3WUnVcWsa4\nxd7NV8hhMezWB5cIZrTsWG02EJkk22lV8ITcs1Quuh7fUbQMyQZxDFnw/WfD\n7uRGPU+bsqLJ3TKd2yLlhZsZOiG4lGggv1QPES13/+e5NPh8daHWkdYWP1ya\nCVH2wbQkrycwOglql9n037Jy8qmgtutpb1nLjrv97DSyQXCGW1ci+OUJQ8B/\nTtIp8D2WRN8w60AZakrwgrxRj8iDm58+rjyasywC00CCEjJx5NKUoDtkNWI/\n+/uq\r\n=+x71\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEGBWji+uSTo5a+2aw/16xkGABUXIlicXmieUYvXGEpAAiEA/fzOzNh+q0hLibrJbBiVeO9PWMDIpRorM5b4GHqgZx0="}],"size":3872,"noattachment":false,"key":"/@starptech/rehype-webparser/-/@starptech/rehype-webparser-0.6.0.tgz"},"maintainers":[{"name":"starptech","email":"deusdustin@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rehype-webparser_0.6.0_1541715208392_0.20847144889890412"},"_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":1541715208532,"_cnpm_publish_time":1541715208532,"dist-tags":{"latest":"0.10.0"}}