{"name":"linkify-it","version":"0.1.2","description":"Links recognition library with FULL unicode support","keywords":["linkify","linkifier","autolink","autolinker"],"repository":{"type":"git","url":"https://github.com/markdown-it/linkify-it"},"license":"MIT","scripts":{"test":"make test"},"dependencies":{"uc.micro":"~0.1.0"},"devDependencies":{"ansi":"~0.3.0","autoprefixer-stylus":"~0.5.0","benchmark":"~1.0.0","browserify":"*","chai":"~2.0.0","coveralls":"~2.11.2","jade":"~1.9.2","eslint":"0.13.0","eslint-plugin-nodeca":"^1.0.0","istanbul":"*","mocha":"*","ndoc":"^3.1.0","punycode":"^1.3.2","stylus":"~0.50.0","tlds":"^1.26.0"},"gitHead":"b2b0ffc2d5a985e575ea0207aefa8612597a613c","bugs":{"url":"https://github.com/markdown-it/linkify-it/issues"},"homepage":"https://github.com/markdown-it/linkify-it","_id":"linkify-it@0.1.2","_shasum":"6ad4ae5b9fc883bd5377ad67c0bd4f8ff8bfad3b","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"vitaly","email":"vitaly@rcdesign.ru"},"maintainers":[{"name":"vitaly","email":"vitaly@rcdesign.ru"}],"dist":{"shasum":"6ad4ae5b9fc883bd5377ad67c0bd4f8ff8bfad3b","tarball":"http://registry-npm.ywwl.com/linkify-it/download/linkify-it-0.1.2.tgz","integrity":"sha512-MgXZ5CozBqcLN3YMQ8EekHKXinmlcE8qsn5P0jZJaoZds7zOhsDwizZaZ5FYAOF5O14yhOkH/5WPipr/wYzeYQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFu0M+b0My6MEEk1WcV7Gdg57nOzsNwAQ5YcKA4QkH1cAiAzSq17tBwuymJbwuqpGsexRCEAXP5rzk67T+xLqI+aoA=="}],"size":8572,"noattachment":false,"key":"/linkify-it/-/linkify-it-0.1.2.tgz"},"directories":{},"readme":"linkify-it\n==========\n\n[![CI](https://github.com/markdown-it/linkify-it/actions/workflows/ci.yml/badge.svg)](https://github.com/markdown-it/linkify-it/actions/workflows/ci.yml)\n[![NPM version](https://img.shields.io/npm/v/linkify-it.svg?style=flat)](https://www.npmjs.org/package/linkify-it)\n[![Coverage Status](https://img.shields.io/coveralls/markdown-it/linkify-it/master.svg?style=flat)](https://coveralls.io/r/markdown-it/linkify-it?branch=master)\n[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/markdown-it/linkify-it)\n\n> Links recognition library with FULL unicode support.\n> Focused on high quality link patterns detection in plain text.\n\n__[Demo](http://markdown-it.github.io/linkify-it/)__\n\nWhy it's awesome:\n\n- Full unicode support, _with astral characters_!\n- International domains support.\n- Allows rules extension & custom normalizers.\n\n\nInstall\n-------\n\n```bash\nnpm install linkify-it --save\n```\n\nBrowserification is also supported.\n\n\nUsage examples\n--------------\n\n##### Example 1\n\n```js\nimport linkifyit from 'linkify-it';\nconst linkify = linkifyit();\n\n// Reload full tlds list & add unofficial `.onion` domain.\nlinkify\n  .tlds(require('tlds'))          // Reload with full tlds list\n  .tlds('onion', true)            // Add unofficial `.onion` domain\n  .add('git:', 'http:')           // Add `git:` protocol as \"alias\"\n  .add('ftp:', null)              // Disable `ftp:` protocol\n  .set({ fuzzyIP: true });        // Enable IPs in fuzzy links (without schema)\n\nconsole.log(linkify.test('Site github.com!'));  // true\n\nconsole.log(linkify.match('Site github.com!')); // [ {\n                                                //   schema: \"\",\n                                                //   index: 5,\n                                                //   lastIndex: 15,\n                                                //   raw: \"github.com\",\n                                                //   text: \"github.com\",\n                                                //   url: \"http://github.com\",\n                                                // } ]\n```\n\n##### Example 2. Add twitter mentions handler\n\n```js\nlinkify.add('@', {\n  validate: function (text, pos, self) {\n    const tail = text.slice(pos);\n\n    if (!self.re.twitter) {\n      self.re.twitter =  new RegExp(\n        '^([a-zA-Z0-9_]){1,15}(?!_)(?=$|' + self.re.src_ZPCc + ')'\n      );\n    }\n    if (self.re.twitter.test(tail)) {\n      // Linkifier allows punctuation chars before prefix,\n      // but we additionally disable `@` (\"@@mention\" is invalid)\n      if (pos >= 2 && tail[pos - 2] === '@') {\n        return false;\n      }\n      return tail.match(self.re.twitter)[0].length;\n    }\n    return 0;\n  },\n  normalize: function (match) {\n    match.url = 'https://twitter.com/' + match.url.replace(/^@/, '');\n  }\n});\n```\n\n\nAPI\n---\n\n__[API documentation](http://markdown-it.github.io/linkify-it/doc)__\n\n### new LinkifyIt(schemas, options)\n\nCreates new linkifier instance with optional additional schemas.\nCan be called without `new` keyword for convenience.\n\nBy default understands:\n\n- `http(s)://...` , `ftp://...`, `mailto:...` & `//...` links\n- \"fuzzy\" links and emails (google.com, foo@bar.com).\n\n`schemas` is an object, where each key/value describes protocol/rule:\n\n- __key__ - link prefix (usually, protocol name with `:` at the end, `skype:`\n  for example). `linkify-it` makes sure that prefix is not preceded with\n  alphanumeric char.\n- __value__ - rule to check tail after link prefix\n  - _String_ - just alias to existing rule\n  - _Object_\n    - _validate_ - either a `RegExp` (start with `^`, and don't include the\n      link prefix itself), or a validator function which, given arguments\n      _text_, _pos_, and _self_, returns the length of a match in _text_\n      starting at index _pos_.  _pos_ is the index right after the link prefix.\n      _self_ can be used to access the linkify object to cache data.\n    - _normalize_ - optional function to normalize text & url of matched result\n      (for example, for twitter mentions).\n\n`options`:\n\n- __fuzzyLink__ - recognize URL-s without `http(s)://` head. Default `true`.\n- __fuzzyIP__ - allow IPs in fuzzy links above. Can conflict with some texts\n  like version numbers. Default `false`.\n- __fuzzyEmail__ - recognize emails without `mailto:` prefix. Default `true`.\n- __---__ - set `true` to terminate link with `---` (if it's considered as long dash).\n\n\n### .test(text)\n\nSearches linkifiable pattern and returns `true` on success or `false` on fail.\n\n\n### .pretest(text)\n\nQuick check if link MAY BE can exist. Can be used to optimize more expensive\n`.test()` calls. Return `false` if link can not be found, `true` - if `.test()`\ncall needed to know exactly.\n\n\n### .testSchemaAt(text, name, offset)\n\nSimilar to `.test()` but checks only specific protocol tail exactly at given\nposition. Returns length of found pattern (0 on fail).\n\n\n### .match(text)\n\nReturns `Array` of found link matches or null if nothing found.\n\nEach match has:\n\n- __schema__ - link schema, can be empty for fuzzy links, or `//` for\n  protocol-neutral  links.\n- __index__ - offset of matched text\n- __lastIndex__ - index of next char after mathch end\n- __raw__ - matched text\n- __text__ - normalized text\n- __url__ - link, generated from matched text\n\n\n### .matchAtStart(text)\n\nChecks if a match exists at the start of the string. Returns `Match`\n(see docs for `match(text)`) or null if no URL is at the start.\nDoesn't work with fuzzy links.\n\n\n### .tlds(list[, keepOld])\n\nLoad (or merge) new tlds list. Those are needed for fuzzy links (without schema)\nto avoid false positives. By default:\n\n- 2-letter root zones are ok.\n- biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф are ok.\n- encoded (`xn--...`) root zones are ok.\n\nIf that's not enough, you can reload defaults with more detailed zones list.\n\n### .add(key, value)\n\nAdd a new schema to the schemas object.  As described in the constructor\ndefinition, `key` is a link prefix (`skype:`, for example), and `value`\nis a String to alias to another schema, or an Object with `validate` and\noptionally `normalize` definitions.  To disable an existing rule, use\n`.add(key, null)`.\n\n\n### .set(options)\n\nOverride default options. Missed properties will not be changed.\n\n\n## License\n\n[MIT](https://github.com/markdown-it/linkify-it/blob/master/LICENSE)\n","publish_time":1424923122159,"_cnpm_publish_time":1424923122159,"dist-tags":{"latest":"6.1.0"}}