{"name":"@emmetio/html-matcher","version":"0.1.0","description":"Minimalistic and ultra-fast HTML parser & matcher","main":"dist/html-matcher.cjs.js","module":"dist/html-matcher.es.js","devDependencies":{"babel-plugin-transform-es2015-modules-commonjs":"^6.23.0","babel-register":"^6.23.0","mocha":"^3.2.0","rollup":"^0.41.6","rollup-watch":"^3.2.2"},"scripts":{"test":"mocha","build":"rollup -c","watch":"rollup -wc"},"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"},"gitHead":"e5863f0faf963b4e487e002ce403b7c463128e71","_id":"@emmetio/html-matcher@0.1.0","_shasum":"79a05d83d8e25338ad5892aaef5b822821f48fd7","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.7.3","_npmUser":{"name":"emmetio","email":"info@emmet.io"},"dist":{"shasum":"79a05d83d8e25338ad5892aaef5b822821f48fd7","tarball":"http://registry-npm.ywwl.com/@emmetio/html-matcher/download/@emmetio/html-matcher-0.1.0.tgz","integrity":"sha512-rXmlyU66OwwmoHEP7CvOWkEns5FM1beTVgTljh1jwrBJtwESd5mOSx1bm15ATHUeVackobeEd+CvmpmmVir+EA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHwDBjqCjUrwPoTr7qiJBiy1Bul1zAicpf0u32oqPxnfAiEAzH0H/utwbIQnhDukXpI8s/8aYONlrn12s5cDL3cUW/o="}],"size":9237,"noattachment":false,"key":"/@emmetio/html-matcher/-/@emmetio/html-matcher-0.1.0.tgz"},"maintainers":[{"name":"emmetio","email":"info@emmet.io"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/html-matcher-0.1.0.tgz_1490133811507_0.6009068896528333"},"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":1490133812164,"_cnpm_publish_time":1490133812164,"dist-tags":{"latest":"1.3.0"}}