{"name":"@starptech/rehype-webparser","version":"0.9.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.9.0","@starptech/webparser":"^0.9.0"},"devDependencies":{"jest":"^24.7.1","ts-jest":"^24.0.2","ts-node":"^8.0.3","tslint":"^5.15.0","tslint-eslint-rules":"^5.4.0","typescript":"^3.4.2","vrsource-tslint-rules":"^6.0.0"},"publishConfig":{"access":"public"},"gitHead":"c7c203521b9e87f18690e30ca5a9b413de918c5e","_id":"@starptech/rehype-webparser@0.9.0","_nodeVersion":"11.14.0","_npmVersion":"lerna/3.13.0/node@v11.14.0+x64 (linux)","_npmUser":{"name":"starptech","email":"deusdustin@gmail.com"},"dist":{"integrity":"sha512-Ndv/excuCjdRIUWtzD5YQMvuZudMvjtYmNhLllzYEzMq6+nkPrhaORuUNihDG1SYZI260CXV1khDTGqPc581Yg==","shasum":"afa5bcd4eedba9f6b3324d545494ebadf629bee7","tarball":"http://registry-npm.ywwl.com/@starptech/rehype-webparser/download/@starptech/rehype-webparser-0.9.0.tgz","fileCount":8,"unpackedSize":12882,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcxX0HCRA9TVsSAnZWagAAnKAP/A9vBoBqotAgSlCEaPt8\np7+eEtreqdst3zIUMYb/2WSeVacSS363oEAXZsb/ojqKEEVpqEy1oH7zSt9S\noxnwTShOzpdz98cXEarFWiExICVepun/bsxjhF9Dln0+BD8YnfxQoyouz7Dr\nFYP4ery7zLShFb2uw/3+aqdULdFkK9/TNI+X5UzJOR3AKXdQoTha6Ix1i6Md\nPfC721GNbZ6oNVdSjxrf+B56iEbHP5XJw0uCmjA8kdqApFMuXNJv0rU5b4Fl\nuLJTJW9KeDl24YabUZNH8OIi2MtvSEFmmRRmSg6CYop475lIXj3Mp5S8T9ka\nlBsYoJusYI1DKnsJVDyxn00XIO16wm3Yhlg1vy7J6kpBMXOR3A9E9RzEMgMq\nO+wOzRYcyvAt+J4TLq1Mp/sMsYWsGSxq53GphwH5lULky9IHdC5zY80KuS88\nCDK3zNfAkSpAmIFrKxj9Bu9JBqgQhdHthCgBX//glL78HmJHV6OjCkC8/UJB\nOaREeHfeUqRNDYCznRhE3uxQC7A+MU00JVze+T7Z7U6sseTAgI9N5vOO0GdT\n6uDt/I9ualhj+YrfUZPR1ehQdYU3ca509DDnCh7V6NGOoE1329526f3oCgxy\nyDbi6e3xKy8dRBYRRoxEz9ISupHwWFP6j0oJzpLqB2NyUjGKhMvQAbuhUrLT\nFEDp\r\n=ByjY\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDUe8Zn9q+sl7jAxWA9IQhKqE17Cc9ZpWbaDr5etbbMTwIgPE9PnFwqtpMQSMd3Ng6s7Bl0UoRGe4W+H7+eAsbQpTA="}],"size":3840,"noattachment":false,"key":"/@starptech/rehype-webparser/-/@starptech/rehype-webparser-0.9.0.tgz"},"maintainers":[{"name":"starptech","email":"deusdustin@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rehype-webparser_0.9.0_1556446470733_0.5857470792210198"},"_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":1556446470868,"_cnpm_publish_time":1556446470868,"dist-tags":{"latest":"0.10.0"}}