{"name":"@emmetio/html-matcher","version":"1.0.0","description":"Minimalistic and ultra-fast HTML parser & matcher","main":"./dist/html-matcher.cjs.js","module":"./dist/html-matcher.es.js","types":"./dist/index.d.ts","devDependencies":{"@emmetio/scanner":"0.0.7","@types/mocha":"^5.2.7","@types/node":"^12.7.5","mocha":"^6.2.0","rollup":"^1.21.4","rollup-plugin-node-resolve":"^5.2.0","rollup-plugin-typescript2":"^0.24.2","ts-node":"^8.3.0","tslint":"^5.20.0","typescript":"^3.6.3"},"scripts":{"test":"mocha","lint":"tslint ./src/*.ts","build":"rollup -c","clean":"rm -rf ./dist","prepare":"npm run lint && npm test && npm run clean && npm run build"},"repository":{"type":"git","url":"git+https://github.com/emmetio/html-matcher.git"},"keywords":[],"author":{"name":"Sergey Chikuyonok","email":"serge.che@gmail.com"},"license":"ISC","bugs":{"url":"https://github.com/emmetio/html-matcher/issues"},"homepage":"https://github.com/emmetio/html-matcher#readme","directories":{"test":"test"},"mocha":{"require":"ts-node/register","spec":"./test/*.ts"},"gitHead":"2f8ce73edc35cfb2a4ae283c4baa6f88e7360f02","_id":"@emmetio/html-matcher@1.0.0","_nodeVersion":"10.9.0","_npmVersion":"6.10.1","dist":{"integrity":"sha512-QCJ6cMww1C4R70snJbMz4rSrYuiw5/Ph2ABT4ozg5+E6gsdjpi7N2URExUtffuVFNq2rU2VKVNXb67Pob6IVIg==","shasum":"265061769592bbd4e8a01df2702ac1f98aed2cc1","tarball":"http://registry-npm.ywwl.com/@emmetio/html-matcher/download/@emmetio/html-matcher-1.0.0.tgz","fileCount":11,"unpackedSize":131306,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdgoEHCRA9TVsSAnZWagAAnB4P/j3z6keE91uQ5Ecih2hQ\nzRW/VA4qFLmBLNl42KuoEUgC7xCBb+8mZMQWWKw43Ca/HWJuW7q2cD78yvnG\n5MwYi/RzDjEZTcvZ6/sdXlnYYK4FvLX0wOID9bdRUdr61Az798TeyeNHCr8V\n+dHo0Zg7bQiF4FfKZ3x7traJtQWTBPY8/U122cWgWDrivFGK7H1/uAHYhZrE\na9fioI+HG9Hjoc0kGxDFGvUi0dAGOd+qfZz7oXdsB5ebD6GpaAQq6EbWTZy3\n4YorJ9ZBOKeziIBNftu1gEU1K5DxVcwH9doxktIUQq7/k3IFAZI3Ec19KSCq\ndii6p/VUmqzGaIXqh452ylxQVv6vtod2WSRi29E1Y4RVrA6hw6mJl24BeZEz\nnpkELPTUAGE7d5OCMmcDsQwxuVe/YYT146p/dAyeW8jq0YWF88vMt4HZ58r9\nCCnBu7PN1MC2gOyTZjrJ2WQggbJ5mFS/MhTvnlLiVPbMxzVM1xo+oK08jO4Q\njImcfCbg8aE5k4kYVAE+wlcbLbtZY+iU/dXEKyEY28VtI1Gkc2NpxQDwUH5E\npJ0C2dDwavaimjvjRsMZ+/2lNWOHMrQNSrOvQY+/9wwcbGOrQgtzjfe9tk3A\nlfwrjs6nTGd5PEXEda+La8otRZIdJXtP1YrX8i+4u7OuxBZQTOQwPtppy68V\ngWdi\r\n=+4Fl\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD90hraM2p53qebkUZ0ryx+DzKR6KyeJx+Al+MOoAEqWAIgFxgv+sI04DrQexZsGXIZNVSWQ98snJvmmGNJwv+N5hA="}],"size":25502,"noattachment":false,"key":"/@emmetio/html-matcher/-/@emmetio/html-matcher-1.0.0.tgz"},"maintainers":[{"email":"info@emmet.io","name":"emmetio-user"},{"email":"serge.che@gmail.com","name":"serge.che"}],"_npmUser":{"name":"serge.che","email":"serge.che@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/html-matcher_1.0.0_1568833798646_0.23926646840977517"},"_hasShrinkwrap":false,"readme":"# Small and fast HTML matcher\n\nFinds matching opening and closing tag pair for given location in HTML/XML source:\n\n```js\nimport match from '@emmetio/html-matcher';\n\nconst content = '<div><a href=\"http://emmet.io\">Example</a></div>';\n\n// Find tag pair at character 35\nconst tag = match(content, 35);\n\nconsole.log(tag.name); // Name of matched tag: \"a\"\nconsole.log(tag.open); // Range of opening tag: [5, 31]\nconsole.log(tag.end); // Range of closing tag: [38, 42]\n\n// List of attributes found in opening tag\nconsole.log(tag.attributes);\n```\n\nBy default, matcher works in HTML, which means if it finds tag name which is known to be empty (for example, `<img>`) it will not search for it’s closing part. However, such behavior might be unexpected for XML syntaxes where all tags should be either self-closed or provide closing part. In this case, you should pass `xml: true` option to properly handle XML mode:\n\n```js\nimport match from '@emmetio/html-matcher';\n\nconst content = '<div><img>Caption</img></div>';\nconst html = match(content, 8);\nconst xml = match(content, 8, { xml: true });\n\nconsole.log(html.name); // \"img\"\nconsole.log(html.open); // [5, 10]\nconsole.log(html.close); // undefined\n\nconsole.log(xml.name); // \"img\"\nconsole.log(xml.open); // [5, 10]\nconsole.log(xml.close); // [17, 23]\n```\n\n## Special tags\n\nIn HTML, some tags has special meaning. For example, a `<script>` tag: its contents should be completely ignored until we find closing `</script>` tag. But, if `<script>` tag contains unknown `type` attribute value, we should consider it as a regular tag.  By default, matcher understands `script` and `style` tags as “special” but you can override them with `special` option:\n\n```js\nimport match from '@emmetio/html-matcher';\n\n// Treat `<foo-bar>` tag as ”special”: skip its content until `</foo-bar>`. Note that this option overwrites default value with `['script', 'style']` value\nmatch('...', 10, { special: { 'foo-bar': null } });\n```\n\nThe `special` option is an object where key is a tag name and value is an array of `type` attribute values which, if present in tag, will make it special. If array is not provided, all instances of tag with given name will be considered as special.\n","publish_time":1568833798788,"_cnpm_publish_time":1568833798788,"dist-tags":{"latest":"1.3.0"}}