{"name":"@starptech/hast-util-from-webparser","version":"0.9.0","description":"Produce [HAST](https://github.com/syntax-tree/hast) compatible AST from [Webparser](https://github.com/Prettyhtml/prettyhtml/tree/master/packages/webparser)","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":["formatter","webparser","hast","html5"],"author":{"name":"Dustin Deus","email":"deusdustin@gmail.com","url":"http://www.starptech.de"},"license":"MIT","dependencies":{"@starptech/prettyhtml-hastscript":"^0.9.0","@starptech/webparser":"^0.9.0","property-information":"^5.0.1"},"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/hast-util-from-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-evqGr0KOXB27vu/KiNv6gmd/ggygzwYvINVsCWF6GAd1SFQNS4Vz2wv4tmiktX6rcr6Qq+jBwVXvVwe60d5Z3g==","shasum":"ae3e8ad0f02d1b9562457e5b508973633a1f5973","tarball":"http://registry-npm.ywwl.com/@starptech/hast-util-from-webparser/download/@starptech/hast-util-from-webparser-0.9.0.tgz","fileCount":13,"unpackedSize":71900,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcxX0DCRA9TVsSAnZWagAAgCMP/jzjmmCztnVIOoxZfC9b\nLd+RV5aOOuvlj2Jar1YvkI4cc//oU2s/FhEG5DT8xFSt09b1hQc1bUrztK/f\nb/Vk1jBHHMxoB6uHUDNX3uJOLLXPIPXOgg4e+PfA85W1YpqCY6KI7jGAYVbT\nneCAXn6v+X19uTTbok5m8Il5nx01jaEoaf14XFGLawr5Rzzro1en8yQ+/2nZ\nldprT8NosFPnqWyffv6HtNvoqOCMQxhXEoiGcoU8D7eYPzb2umR8QGjPIT9A\njrVUvqn3gc9waYEDpRRK0x2VzqR7xi5gpjT+q1+Q8C8aFRQSMitAQgLyX1JQ\nO96Nhm1h2MMKDg7/2LgxglGSjKkuj2/hu1+4r4lDiedQVE9HQjjGP0yGEtNz\nonQ6ahoF7PdBBCddSqNEm6+kKQeSlkhaY4Wm5DKmBhP7vQ2i99EzGsIR3SOv\n0sWt0m7eg0hp+Y5aV4NCvZHF/ixJfOP4tm+9XOFf48OQFxaU7v5hKTiZmMIM\njHYwAAjgec1onQntAdPA00avVDXNk2yNBzzD9f/czil5sEh63d+Psl9KnIcD\n8mAyQ2EbsXqc3kgoiMYMRcN/FG+tsaSq3w1OCZPNozYtTQx4i9btGfbEaVao\n5B2/FwVgXzHVQfCDOJR22LsRfcGR/oYpknLNUVuCkeZG93Z+DOmiVLd9iExj\nVbMB\r\n=W/CH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDyXaS/vvM3uiVNhw8OEJhuWmiutga6XK50YcG9A4L72gIgYghEc9bkommYeVf+zeQzlxXgbEdYAl8gvz8ZriQ7pbk="}],"size":10856,"noattachment":false,"key":"/@starptech/hast-util-from-webparser/-/@starptech/hast-util-from-webparser-0.9.0.tgz"},"maintainers":[{"name":"starptech","email":"deusdustin@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hast-util-from-webparser_0.9.0_1556446467221_0.25792051750271705"},"_hasShrinkwrap":false,"readme":"# @starptech/hast-util-from-webparser\n\nProduce [HAST](https://github.com/syntax-tree/hast) compatible AST from [Webparser](https://github.com/Prettyhtml/prettyhtml/tree/master/packages/webparser)\n\n## Installation\n\n```\n@starptech/hast-util-from-webparser\n```\n\n## Usage\n\nSay we have the following file, `example.html`:\n\n```html\n<!DOCTYPE html><title>Hello!</title>\n<h1 id=\"world\">World!<!--after--></h1>\n```\n\nAnd our script, `example.js`, looks as follows:\n\n```javascript\nconst vfile = require('to-vfile')\nconst inspect = require('unist-util-inspect')\nconst HtmlParser = require('@starptech/webparser').HtmlParser\nconst fromWebparser = require('@starptech/hast-util-from-webparser')\n\nconst filepath = 'example.html'\nconst doc = vfile.readSync(filepath)\nconst result = new HtmlParser({\n  ignoreFirstLf: false,\n  decodeEntities: false,\n  selfClosingCustomElements: true\n}).parse(String(doc), filepath)\n\nconst hast = fromWebparser(result.rootNodes)\n```\n\nNow, running `node example` yields:\n\n```text\nroot[3] [data={\"selfClosing\":false}]\n├─ doctype (1:1-1:15, 0-15) [name=\"html\"]\n├─ element[1] (1:15-1:36, 15-36) [tagName=\"title\"][data={\"selfClosing\":false}]\n│  └─ text: \"Hello!\" (1:22-1:28, 22-28)\n└─ element[2] [tagName=\"h1\"][properties={\"id\":\"world\"}][data={\"selfClosing\":false}]\n   ├─ text: \"World!\" (1:51-1:57, 51-57)\n   └─ comment: \"after\" (1:57-1:61, 57-61)\n```\n\n## API\n\n### `fromWebparser(rootNodes[, options])`\n\nTransform an `Node` to a [**HAST Node**](https://github.com/syntax-tree/hast#ast).\n","publish_time":1556446467426,"_cnpm_publish_time":1556446467426,"dist-tags":{"latest":"0.10.0"}}