{"name":"@starptech/rehype-webparser","version":"0.1.4","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":"ISC","dependencies":{"@starptech/hast-util-from-webparser":"^0.1.4","@starptech/webparser":"^0.1.4","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":"1cd755e683022712cef4faf8c571ff3fd560cfe3","_resolved":"","_integrity":"","_from":"file:starptech-rehype-webparser-0.1.4.tgz","_id":"@starptech/rehype-webparser@0.1.4","_npmVersion":"6.4.1","_nodeVersion":"10.10.0","_npmUser":{"name":"starptech","email":"deusdustin@gmail.com"},"dist":{"integrity":"sha512-ffuakxJYMef2wFMwLpXdrEUt8+EbJazwg+DuYY3UHZEfYMHu/7inO7G5l3IWzgyr88b8ceiYfayQXPgb34ztng==","shasum":"243ed745d12a6f521d7f029b013169894f85a102","tarball":"http://registry-npm.ywwl.com/@starptech/rehype-webparser/download/@starptech/rehype-webparser-0.1.4.tgz","fileCount":8,"unpackedSize":7118,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbr7/RCRA9TVsSAnZWagAAR8MP/2t4MkCqDSvhg2bS5L45\nS+BGPtwfY9R+yGBb0pcCsjzCvFg4FeDiKOg/NgUOg1mbxxaZuLRbk3T5NMxI\nsQGplfKo/HIgRcHFz7ZuUKqeSeqDkj4ijsmkGmn6A+hWftZRPCq2znS+A2YO\nImg1YnlWgF1rYqiGdfFNCRo2Ac1aQSeof1C9E9bVOqFnm6eIpry9YtIS16Fh\nFRBf80XKVCf6hcCjx5qIW2g882EXZ/AaFNn+m04ckk4NAk3x0om1VFlDDdTM\ni486jBObJJSPjpZa2nGtNY/zSJeYT4yiir228CJSNuiIcD5etzO5nzcpI6uU\nbuI++t8tjpM1JeUpLq/2s1ZNBcAkc98uNrZEUBOHOu+g03IGMfZazoS/yEqo\nmcBdTOusBG86c5qIdL+qgIRGass4aTNdCLiAhNfKUimZN7t37OnrnS2hsXcB\nQsQ0Hj3/EgbWAD13Q+/dbAN7kDrrqzjQhCJVhntXjZ8P8jCm2oDyiOU3dEKi\nV5YnN0J2QAYKzm8fGnyzqUBuz8J+S1lqXqzS8GgqCgmVm+6hD7KRJJKFEK2e\ntzVeTo0LfUrkroeWWtD2SLZv+0KIVSMYYpp66hUM8o4HJmZz9J/GEHWojCv6\ndJWlU4g82rL7AntdcbnkHugL1aX4LXOLmOE6IgN8oCFZnq+U6ypXLospDo3B\nfDQe\r\n=npxm\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE3FBB0hfFLW9dA4mb1qf7sFXCUQBfNC8KAuvoDOSi4NAiEAqScWU5U1A8zVyMBUotHIktUoJZE2RWb5ANYjvdXSsKM="}],"size":2999,"noattachment":false,"key":"/@starptech/rehype-webparser/-/@starptech/rehype-webparser-0.1.4.tgz"},"maintainers":[{"name":"starptech","email":"deusdustin@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rehype-webparser_0.1.4_1538244560518_0.9432908873927301"},"_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":1538244560919,"_cnpm_publish_time":1538244560919,"dist-tags":{"latest":"0.10.0"}}