{"_id":"@aleen42/autolinker","name":"@aleen42/autolinker","dist-tags":{"latest":"3.15.0-beta.0"},"versions":{"3.15.0-beta.0":{"name":"@aleen42/autolinker","version":"3.15.0-beta.0","description":"Utility to automatically link the URLs, email addresses, phone numbers, hashtags, and mentions (Twitter, Instagram) in a given block of text/HTML","main":"./dist/commonjs/index.js","typings":"./dist/commonjs/index.d.ts","module":"./dist/es2015/index.js","scripts":{"build":"npm-run-all clean update-tld-regex build:src build:live-example","build:docs":"ts-node scripts/build-docs.ts","build:src":"ts-node scripts/build.ts","build:live-example":"webpack","clean":"rimraf dist","prepublishOnly":"npm-run-all build","start":"webpack serve --open","test":"npm-run-all test:unit test:integration","test:unit":"node --require=ts-node/register node_modules/jasmine/bin/jasmine.js \"tests/**/*.spec.ts\"","test:integration":"ts-node scripts/test-integration.ts","update-tld-regex":"ts-node scripts/update-tld-regex.ts","prepare":"husky install"},"repository":{"type":"git","url":"git://github.com/gregjacobs/Autolinker.js.git"},"keywords":["auto","link","autolink","url","urls","anchor"],"author":{"name":"Gregory Jacobs","email":"greg@greg-jacobs.com"},"license":"MIT","bugs":{"url":"https://github.com/gregjacobs/Autolinker.js/issues"},"homepage":"https://github.com/gregjacobs/Autolinker.js","dependencies":{"tslib":"^2.3.0"},"devDependencies":{"@rollup/plugin-commonjs":"^21.0.0","@rollup/plugin-node-resolve":"^13.1.3","@types/dedent":"^0.7.0","@types/fs-extra":"^9.0.13","@types/jasmine":"^3.10.3","@types/jquery":"^3.5.5","@types/lodash":"^4.14.170","@types/node":"^16.11.26","@types/webpack":"^5.28.0","axios":"^0.26.0","css-loader":"^6.6.0","dedent":"^0.7.0","fast-glob":"^3.2.11","fs-extra":"^10.0.1","html-webpack-plugin":"^5.5.0","husky":"^7.0.4","jasmine":"^4.0.2","jsduck":"^1.1.2","lint-staged":"^12.3.4","lodash":"^4.17.21","mkdirp":"^1.0.4","npm":"^8.1.0","npm-run-all":"^4.1.5","prettier":"2.5.1","punycode":"^2.1.1","puppeteer":"^13.4.0","rimraf":"^3.0.2","rollup":"^2.52.2","style-loader":"^3.3.1","terser":"^5.11.0","ts-loader":"^9.2.3","ts-node":"^10.5.0","typescript":"^4.3.4","webpack":"^5.69.1","webpack-cli":"^4.9.2","webpack-dev-server":"^4.7.4"},"gitHead":"ec8b5cd3265a432c6c5c16b4046cbe14b27cb0b8","_id":"@aleen42/autolinker@3.15.0-beta.0","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-xNh3LotdUUPHMpQKO1PdM5DjMGzcKRGsDkGUdtcUXZmu5qiqL2PILSVUbIYMLyZyXts037CnpvBla/QeX/3lTw==","shasum":"eadf1f3c76e7053ac8d1b36be9276f3158148de8","tarball":"https://registry.npmjs.org/@aleen42/autolinker/-/autolinker-3.15.0-beta.0.tgz","fileCount":175,"unpackedSize":1649008,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDr4btzY+QcZBSvh7ySBB8ZiQ9z59I4FRImYNhKpn46FAiBkaZrkrwLJFHxVe1VHFpusutVwUt5e2qXXheMec8EADA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi9Ji3ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr/SQ//TvNUqy9rb6srBJwQw+9l/H9N+hbT9RdaM/WcbmVbpIUYvo8H\r\nKcZllpVdhaaOWLhCQjIbD+5BQZBbT+aLxpgEttUDnNMyRDjRMWuUsGYFYn8x\r\nTrkhmsxvlXdAj+nkeEDhpF2GmsFHsuUi+De27zAlSgj/XiQF76Pey64tAnBs\r\nIF/tfQQafB8lVA77jS3AWyVmeWDI/3H2RpeZXTU2evyZGJ7gPhtGIWoyS18q\r\n+iEFI+/vJra+KsjHT4nFru/bPLGmjHDo0QavEBEEwKqP6Wqd3ZeR9KooMzsx\r\nL/0wjQ5YHs9oSdXKLXIUA3nSw18Cf/DiSBXwPFqSMrpxdxsfDVP63p/eiyF7\r\n5bKIBnQPLWucYPqAqWFSKlK6X0yPN3MYjLbZqqSX3QeuGEde0S6jey/OMaJh\r\nBcqRkkNoF4fJMkQQojZUuMmcFblJnQNfyDmRo18dNvCrflV2YTzSBZHIc9os\r\n+0tgx+eYKotyYxvBQF2keJdGMd+1gLbPIjrArgmCefAMB2xvtaTdF4/2IZ0D\r\nnFFHJN4BK3P6g7voncreDDcLuhrzwXDzl+9OORwaHER5JkrhXBSzWmaEaJKK\r\nwZTr7eYQcPXTUhtbfM6t1N2lbxcL2I8dJBxlzQ583YsmroOuBNi65kqfLVm4\r\n6KxprqnYUovz3to6G/UjK5l5BP2hpUPr46w=\r\n=W10q\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"aleen42","email":"aleen42@vip.qq.com"},"directories":{},"maintainers":[{"name":"aleen42","email":"aleen42@vip.qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/autolinker_3.15.0-beta.0_1660197047413_0.2766208386780513"},"_hasShrinkwrap":false}},"time":{"created":"2022-08-11T05:50:47.351Z","3.15.0-beta.0":"2022-08-11T05:50:47.652Z","modified":"2022-08-11T05:50:47.776Z"},"maintainers":[{"name":"aleen42","email":"aleen42@vip.qq.com"}],"description":"Utility to automatically link the URLs, email addresses, phone numbers, hashtags, and mentions (Twitter, Instagram) in a given block of text/HTML","homepage":"https://github.com/gregjacobs/Autolinker.js","keywords":["auto","link","autolink","url","urls","anchor"],"repository":{"type":"git","url":"git://github.com/gregjacobs/Autolinker.js.git"},"author":{"name":"Gregory Jacobs","email":"greg@greg-jacobs.com"},"bugs":{"url":"https://github.com/gregjacobs/Autolinker.js/issues"},"license":"MIT","readme":"# Autolinker.js\n\nBecause I had so much trouble finding a good auto-linking implementation out in\nthe wild, I decided to roll my own. It  seemed that everything I found out there\nwas either an implementation that didn't cover every case, or was just limited\nin one way or another.\n\nSo, this utility attempts to handle everything. It:\n\n- Autolinks URLs, whether or not they start with the protocol (i.e. 'http://').\n  In other words, it will automatically link the text \"google.com\", as well as\n  \"http://google.com\".\n- Will properly handle URLs with special characters\n- Will properly handle URLs with query parameters or a named anchor (i.e. hash)\n- Will autolink email addresses.\n- Will autolink phone numbers.\n- Will autolink mentions (Twitter, Instagram, Soundcloud, TikTok).\n- Will autolink hashtags.\n- Will properly handle HTML input. The utility will not change the `href`\n  attribute inside anchor (&lt;a&gt;) tags (or any other tag/attribute), \n  and will not accidentally wrap the inner text of an anchor tag with a\n  new one (which would cause doubly-nested anchor tags).\n\nHope that this utility helps you as well!\n\nFull API Docs: [http://gregjacobs.github.io/Autolinker.js/api/](http://gregjacobs.github.io/Autolinker.js/api/#!/api/Autolinker)<br>\nLive Example: [http://gregjacobs.github.io/Autolinker.js/examples/live-example/](http://gregjacobs.github.io/Autolinker.js/examples/live-example/)\n\n\n## v3.0 released Jan 2019\n\nSee [Upgrading from v2.x -> v3.x (Breaking Changes)](#upgrading-from-v2x---v3x-breaking-changes) at the bottom of this readme\n\n\n## Installation\n\n#### Installing with the [npm](https://www.npmjs.org/) package manager:\n\n```shell\nnpm install autolinker --save\n```\n\n\n#### Installing with the [Yarn](https://yarnpkg.com/) package manager:\n\n```shell\nyarn add autolinker\n```\n\n\n#### Installing with the [Bower](http://bower.io) package manager:\t\n  \n```shell\nbower install Autolinker.js --save\n```\n\n\n#### Direct download\n\nSimply clone this repository or download a zip of the project, and link to \neither `dist/Autolinker.js` or `dist/Autolinker.min.js` with a script tag.\n\n\n## Importing Autolinker\n\n#### ES6/TypeScript/Webpack:\n\n```ts\nimport Autolinker from 'autolinker';\n```\n\n#### Node.js:\n\n```javascript\nconst Autolinker = require( 'autolinker' );\n// note: npm wants an all-lowercase package name, but the utility is a class and\n// should be aliased with a capital letter\n```\n\n#### Browser\n\n```html\n<!-- 'Autolinker.js' or 'Autolinker.min.js' - non-minified is better for \n     debugging, minified is better for users' download time -->\n<script src=\"path/to/autolinker/dist/Autolinker.min.js\"></script>\n```\n\n\n## Usage\n\nUsing the static [link()](http://gregjacobs.github.io/Autolinker.js/api/#!/api/Autolinker-static-method-link)\nmethod:\n\n```javascript\nvar linkedText = Autolinker.link( textToAutolink[, options] );\n```\n\nUsing as a class:\n\n```javascript\nvar autolinker = new Autolinker( [ options ] );\n\nvar linkedText = autolinker.link( textToAutoLink );\n```\n\nNote: if using the same options to autolink multiple pieces of html/text, it is\nslightly more efficient to create a single Autolinker instance, and run the\n[link()](http://gregjacobs.github.io/Autolinker.js/api/#!/api/Autolinker-method-link)\nmethod repeatedly (i.e. use the \"class\" form above).\n\n\n#### Examples:\n\n```javascript\nvar linkedText = Autolinker.link( \"Check out google.com\" );\n// Produces: \"Check out <a href=\"http://google.com\" target=\"_blank\" rel=\"noopener noreferrer\">google.com</a>\"\n\nvar linkedText = Autolinker.link( \"Check out google.com\", { \n    newWindow: false \n} );\n// Produces: \"Check out <a href=\"http://google.com\">google.com</a>\"\n```\n\n## Options\n\nThe following are the options which may be specified for linking. These are \nspecified by providing an Object as the second parameter to [Autolinker.link()](http://gregjacobs.github.io/Autolinker.js/api/#!/api/Autolinker-static-method-link). \nThese include:\n\n- [newWindow](http://gregjacobs.github.io/Autolinker.js/api/#!/api/Autolinker-cfg-newWindow) : boolean<br />\n  `true` to have the links should open in a new window when clicked, `false`\n  otherwise. Defaults to `true`.\n  \n- [urls](http://gregjacobs.github.io/Autolinker.js/api/#!/api/Autolinker-cfg-urls) : boolean/Object<br />\n  `true` to have URLs auto-linked, `false` to skip auto-linking of URLs. Defaults \n  to `true`.\n\n  This option also accepts an Object form with 3 properties to allow for \n  more customization of what exactly gets linked. All default to `true`:\n\n    - schemeMatches (boolean): `true` to match URLs found prefixed with a scheme,\n      i.e. `http://google.com`, or `other+scheme://google.com`, `false` to\n      prevent these types of matches.\n    - wwwMatches (boolean): `true` to match urls found prefixed with `'www.'`,\n      i.e. `www.google.com`. `false` to prevent these types of matches. Note\n      that if the URL had a prefixed scheme, and `schemeMatches` is true, it\n      will still be linked.\n    - tldMatches: `true` to match URLs with known top level domains (.com, .net,\n      etc.) that are not prefixed with a scheme or `'www.'`. Ex: `google.com`,\n      `asdf.org/?page=1`, etc. `false` to prevent these types of matches.\n\n  Example usage: `urls: { schemeMatches: true, wwwMatches: true, tldMatches: false }`\n\n- [email](http://gregjacobs.github.io/Autolinker.js/api/#!/api/Autolinker-cfg-email) : boolean<br />\n  `true` to have email addresses auto-linked, `false` to skip auto-linking of\n  email addresses. Defaults to `true`.\n  \n- [phone](http://gregjacobs.github.io/Autolinker.js/api/#!/api/Autolinker-cfg-phone) : boolean<br />\n  `true` to have phone numbers auto-linked, `false` to skip auto-linking of\n  phone numbers. Defaults to `true`.\n\n- [mention](http://gregjacobs.github.io/Autolinker.js/api/#!/api/Autolinker-cfg-mention) : string<br />\n  A string for the service name to have mentions (@username) auto-linked to. Supported\n  values at this time are 'twitter', 'soundcloud', 'instagram' and 'tiktok'. Pass `false` to skip\n  auto-linking of mentions. Defaults to `false`.\n\n- [hashtag](http://gregjacobs.github.io/Autolinker.js/api/#!/api/Autolinker-cfg-hashtag) : boolean/string<br />\n  A string for the service name to have hashtags auto-linked to. Supported\n  values at this time are 'twitter', 'facebook', 'instagram' and 'tiktok'. Pass `false` to skip\n  auto-linking of hashtags. Defaults to `false`.\n\n- [stripPrefix](http://gregjacobs.github.io/Autolinker.js/api/#!/api/Autolinker-cfg-stripPrefix) : boolean<br />\n  `true` to have the `'http://'` (or `'https://'`) and/or the `'www.'` \n  stripped from the beginning of displayed links, `false` otherwise. \n  Defaults to `true`.\n  \n  This option also accepts an Object form with 2 properties to allow for \n  more customization of what exactly is prevented from being displayed. \n  Both default to `true`:\n\n    - scheme (boolean): `true` to prevent the scheme part of a URL match\n      from being displayed to the user. Example: `'http://google.com'` \n      will be displayed as `'google.com'`. `false` to not strip the \n      scheme. NOTE: Only an `'http://'` or `'https://'` scheme will be\n      removed, so as not to remove a potentially dangerous scheme (such\n      as `'file://'` or `'javascript:'`).\n    - www (boolean): `true` to prevent the `'www.'` part of a URL match\n      from being displayed to the user. Ex: `'www.google.com'` will be\n      displayed as `'google.com'`. `false` to not strip the `'www'`.\n\n- [stripTrailingSlash](http://gregjacobs.github.io/Autolinker.js/api/#!/api/Autolinker-cfg-stripTrailingSlash) : boolean<br />\n  `true` to remove the trailing slash from URL matches, `false` to keep\n  the trailing slash. Example when `true`: `http://google.com/` will be \n  displayed as `http://google.com`. Defaults to `true`.\n\n- [truncate](http://gregjacobs.github.io/Autolinker.js/api/#!/api/Autolinker-cfg-truncate) : number/Object<br />\n  A number for how many characters long URLs/emails/Twitter handles/Twitter\n  hashtags should be truncated to inside the text of a link. If the match is\n  over the number of characters, it will be truncated to this length by\n  replacing the end of the string with a two period ellipsis ('..').\n\n  Example: a url like 'http://www.yahoo.com/some/long/path/to/a/file' truncated\n  to 25 characters may look like this: 'yahoo.com/some/long/pat..'\n\n  In the object form, both `length` and `location` may be specified to perform\n  truncation. Available options for `location` are: 'end' (default), 'middle',\n  or 'smart'. Example usage:\n\n    ```javascript\n    truncate: { length: 32, location: 'middle' }\n    ```\n\n  The 'smart' truncation option is for URLs where the algorithm attempts to\n  strip out unnecessary parts of the URL (such as the 'www.', then URL scheme,\n  hash, etc.) before trying to find a good point to insert the ellipsis if it is\n  still too long. For details, see source code of:\n  [TruncateSmart](http://gregjacobs.github.io/Autolinker.js/api/#!/api/Autolinker.truncate.TruncateSmart)\n  \n- [className](http://gregjacobs.github.io/Autolinker.js/api/#!/api/Autolinker-cfg-className) : string<br />\n  A CSS class name to add to the generated anchor tags. This class will be added\n  to all links, as well as this class plus \"url\"/\"email\"/\"phone\"/\"hashtag\"/\"mention\"/\"twitter\"/\"instagram\"\n  suffixes for styling url/email/phone/hashtag/mention links differently.\n\n  For example, if this config is provided as \"myLink\", then:\n\n  - URL links will have the CSS classes: \"myLink myLink-url\"\n  - Email links will have the CSS classes: \"myLink myLink-email\"\n  - Phone links will have the CSS classes: \"myLink myLink-phone\"\n  - Twitter mention links will have the CSS classes: \"myLink myLink-mention myLink-twitter\"\n  - Instagram mention links will have the CSS classes: \"myLink myLink-mention myLink-instagram\"\n  - Hashtag links will have the CSS classes: \"myLink myLink-hashtag\"\n\n- [decodePercentEncoding](http://gregjacobs.github.io/Autolinker.js/api/#!/api/Autolinker-cfg-decodePercentEncoding): boolean<br />\n  `true` to decode percent-encoded characters in URL matches, `false` to keep\n  the percent-encoded characters.\n  \n  Example when `true`: `https://en.wikipedia.org/wiki/San_Jos%C3%A9` will\n  be displayed as `https://en.wikipedia.org/wiki/San_José`.\n  \n  Defaults to `true`.\n\n- [replaceFn](http://gregjacobs.github.io/Autolinker.js/api/#!/api/Autolinker-cfg-replaceFn) : Function<br />\n  A function to use to programmatically make replacements of matches in the\n  input string, one at a time. See the section\n  <a href=\"#custom-replacement-function\">Custom Replacement Function</a> for\n  more details.\n\n- [sanitizeHtml](http://gregjacobs.github.io/Autolinker.js/api/#!/api/Autolinker-cfg-sanitizeHtml) : boolean<br />\n  \n\t`true` to HTML-encode the start and end brackets of existing HTML tags found \n  in the input string. This will escape `<` and `>` characters to `&lt;` and \n  `&gt;`, respectively.\n\t\n\tSetting this to `true` will prevent XSS (Cross-site Scripting) attacks, \n\tbut will remove the significance of existing HTML tags in the input string. If \n  you would like to maintain the significance of existing HTML tags while also \n  making the output HTML string safe, leave this option as `false` and use a \n  tool like https://github.com/cure53/DOMPurify (or others) on the input string \n  before running Autolinker.\n\n  Defaults to `false`.\n\nFor example, if you wanted to disable links from opening in [new windows](http://gregjacobs.github.io/Autolinker.js/api/#!/api/Autolinker-cfg-newWindow), you could do:\n\n```javascript\nvar linkedText = Autolinker.link( \"Check out google.com\", { \n    newWindow: false \n} );\n// Produces: \"Check out <a href=\"http://google.com\">google.com</a>\"\n```\n\nAnd if you wanted to truncate the length of URLs (while also not opening in a new window), you could do:\n\n```javascript\nvar linkedText = Autolinker.link( \"http://www.yahoo.com/some/long/path/to/a/file\", { \n    truncate: 25, \n    newWindow: false \n} );\n// Produces: \"<a href=\"http://www.yahoo.com/some/long/path/to/a/file\">yahoo.com/some/long/pat..</a>\"\n```\n\n## More Examples\n\nOne could update an entire DOM element that has unlinked text to auto-link them\nas such:\n\n```javascript\nvar myTextEl = document.getElementById( 'text' );\nmyTextEl.innerHTML = Autolinker.link( myTextEl.innerHTML );\n```\n\nUsing the same pre-configured [Autolinker](http://gregjacobs.github.io/Autolinker.js/api/#!/api/Autolinker)\ninstance in multiple locations of a codebase (usually by dependency injection):\n\n```javascript\nvar autolinker = new Autolinker( { newWindow: false, truncate: 25 } );\n\n//...\n\nautolinker.link( \"Check out http://www.yahoo.com/some/long/path/to/a/file\" );\n// Produces: \"Check out <a href=\"http://www.yahoo.com/some/long/path/to/a/file\">yahoo.com/some/long/pat..</a>\"\n\n//...\n\nautolinker.link( \"Go to www.google.com\" );\n// Produces: \"Go to <a href=\"http://www.google.com\">google.com</a>\"\n\n```\n\n## Retrieving the List of Matches\n\nIf you're just interested in retrieving the list of [Matches](http://greg-jacobs.com/Autolinker.js/api/#!/api/Autolinker.match.Match) without producing a transformed string, you can use the [parse()](http://greg-jacobs.com/Autolinker.js/api/#!/api/Autolinker-static-method-parse) method.\n\nFor example:\n\n```\nvar matches = Autolinker.parse( \"Hello google.com, I am asdf@asdf.com\", {\n    urls: true,\n    email: true\n} );\n\nconsole.log( matches.length );           // 2\nconsole.log( matches[ 0 ].getType() );   // 'url'\nconsole.log( matches[ 0 ].getUrl() );    // 'google.com'\nconsole.log( matches[ 1 ].getType() );   // 'email'\nconsole.log( matches[ 1 ].getEmail() );  // 'asdf@asdf.com'\n```\n\n\n## Custom Replacement Function\n\nA custom replacement function ([replaceFn](http://gregjacobs.github.io/Autolinker.js/api/#!/api/Autolinker-cfg-replaceFn))\nmay be provided to replace url/email/phone/mention/hashtag matches on an\nindividual basis, based on the return from this function.\n\n#### Full example, for purposes of documenting the API:\n\n```javascript\nvar input = \"...\";  // string with URLs, Email Addresses, Mentions (Twitter, Instagram), and Hashtags\n\nvar linkedText = Autolinker.link( input, {\n    replaceFn : function( match ) {\n        console.log( \"href = \", match.getAnchorHref() );\n        console.log( \"text = \", match.getAnchorText() );\n\n        switch( match.getType() ) {\n            case 'url' :\n                console.log( \"url: \", match.getUrl() );\n\n                return true;  // let Autolinker perform its normal anchor tag replacement\n\n            case 'email' :\n                var email = match.getEmail();\n                console.log( \"email: \", email );\n\n                if( email === \"my@own.address\" ) {\n                    return false;  // don't auto-link this particular email address; leave as-is\n                } else {\n                    return;  // no return value will have Autolinker perform its normal anchor tag replacement (same as returning `true`)\n                }\n\n            case 'phone' :\n                console.log( \"Phone Number: \", match.getPhoneNumber() );\n\n                return '<a href=\"http://newplace.to.link.phone.numbers.to/\">' + match.getPhoneNumber() + '</a>';\n\n            case 'mention' :\n                console.log( \"Mention: \", match.getMention() );\n                console.log( \"Mention Service Name: \", match.getServiceName() );\n\n                return '<a href=\"http://newplace.to.link.mention.handles.to/\">' + match.getMention() + '</a>';\n\n            case 'hashtag' :\n                console.log( \"Hashtag: \", match.getHashtag() );\n\n                return '<a href=\"http://newplace.to.link.hashtag.handles.to/\">' + match.getHashtag() + '</a>';\n        }\n    }\n} );\n```\n\n#### Modifying the default generated anchor tag\n\n```javascript\nvar input = \"...\";  // string with URLs, Email Addresses, Mentions (Twitter, Instagram), and Hashtags\n\nvar linkedText = Autolinker.link( input, {\n    replaceFn : function( match ) {\n        console.log( \"href = \", match.getAnchorHref() );\n        console.log( \"text = \", match.getAnchorText() );\n\n        var tag = match.buildTag();         // returns an `Autolinker.HtmlTag` instance for an <a> tag\n        tag.setAttr( 'rel', 'nofollow' );   // adds a 'rel' attribute\n        tag.addClass( 'external-link' );    // adds a CSS class\n        tag.setInnerHtml( 'Click here!' );  // sets the inner html for the anchor tag\n\n        return tag;\n    }\n} );\n```\n\n\nThe `replaceFn` is provided one argument:\n\n1. An [Autolinker.match.Match](http://gregjacobs.github.io/Autolinker.js/api/#!/api/Autolinker.match.Match)\n   object which details the match that is to be replaced.\n\n\nA replacement of the match is made based on the return value of the function.\nThe following return values may be provided:\n\n1. No return value (`undefined`), or `true` (boolean): Delegate back to\n   Autolinker to replace the match as it normally would.\n2. `false` (boolean): Do not replace the current match at all - leave as-is.\n3. Any string: If a string is returned from the function, the string will be used\n   directly as the replacement HTML for the match.\n4. An [Autolinker.HtmlTag](http://gregjacobs.github.io/Autolinker.js/api/#!/api/Autolinker.HtmlTag)\n   instance, which can be used to build/modify an HTML tag before writing out its\n   HTML text.\n\n\n## Full API Docs\n\nThe full API docs for Autolinker may be referenced at:\n[http://gregjacobs.github.io/Autolinker.js/api/](http://gregjacobs.github.io/Autolinker.js/api/#!/api/Autolinker)\n\n## Live Example\n\n[http://gregjacobs.github.io/Autolinker.js/examples/live-example/](http://gregjacobs.github.io/Autolinker.js/examples/live-example/)\n\n\n## Users of Internet Explorer 8 and Below\n\nAutolinker compiles into ES5, and uses ES5 library methods. If you need to run \nAutolinker on old browsers (i.e. Internet Explorer 8 or below), you will need \nsome polyfills. \n\nI recommend using the [core-js](https://www.npmjs.com/package/core-js)\nES5 polyfill. You may also be able to get away with adding the following two\npolyfills, but that may or may not be true in the future:\n\n```js\nif( typeof Array.prototype.forEach !== 'function' ) {\n    Array.prototype.forEach = function( callback, thisArg ) {\n        for( var i = 0; i < this.length; i++ ) {\n            callback.apply( thisArg || this, [ this[ i ], i, this ] );\n        }\n    };\n}\n\nif( typeof Object.assign !== 'function' ) {\n    Object.assign = function( target ) {\n        var srcObjs = Array.prototype.slice.call( arguments, 1 );\n\n        for( var i = 0, len = srcObjs.length; i < len; i++ ) {\n            var currentSrcObj = srcObjs[ i ];\n\n            for( var prop in currentSrcObj ) {\n                if( currentSrcObj.hasOwnProperty( prop ) ) {\n                    target[ prop ] = currentSrcObj[ prop ];\n                }\n            }\n        }\n        return target;\n    };\n}\n```\n\n## Upgrading from v2.x -> v3.x (Breaking Changes)\n\n1. If you are still on v1.x, first follow the instructions in the \n   [Upgrading from v1.x -> v2.x](#upgrading-from-v1x---v2x-breaking-changes) \n   section below.\n2. The `HtmlParser` class has been removed in favor of an internal `parseHtml()`\n   function which replaces the old regexp-based implementation with a state \n   machine parser that is guaranteed to run in linear time. If you were using \n   the `HtmlParser` class directly, I recommend switching to [htmlparser2](https://github.com/fb55/htmlparser2), which implements the HTML semantics \n   better. The internal `parseHtml()` function that Autolinker now uses is \n   fairly geared towards Autolinker's purposes, and may not be useful in a \n   general HTML parsing sense.\n\n## Upgrading from v1.x -> v2.x (Breaking Changes)\n\n1. If you are still on v0.x, first follow the instructions in the \n   [Upgrading from v0.x -> v1.x](#upgrading-from-v0x---v1x-breaking-changes) \n   section below.\n2. The codebase has been converted to TypeScript, and uses ES6 exports. You can\n   now use the `import` statement to pull in the `Autolinker` class and related \n   entities such as `Match`:\n\n   ```ts\n   // ES6/TypeScript/Webpack\n   import Autolinker, { Match } from 'autolinker';\n   ```\n\n   The `require()` interface is still supported as well for Node.js:\n\n   ```ts\n   // Node.js\n   const Autolinker = require( 'autolinker' );\n   ```\n\n3. You will no longer need the `@types/autolinker` package as this package now\n   exports its own types\n4. You will no longer be able to override the regular expressions in the \n  `Matcher` classes by assigning to the prototype (for instance, something like\n   `PhoneMatcher.prototype.regex = ...`). This is due to how TypeScript creates \n   properties for class instances in the constructor rather than on prototypes. \n   \n   The idea of providing your own regular expression for these classes is a \n   brittle notion anyway, as the  `Matcher` classes rely on capturing groups in \n   the RegExp being in the right place, or even multiple capturing groups for \n   the same piece of information to support a different format. These capturing\n   groups and associated code are subject to change as the regular expression \n   needs to be updated, and will not involve a major version release of \n   Autolinker.\n   \n   In the future you will be able to override the default `Matcher` classes\n   entirely to provide your own implementation, but please raise an issue (or\n   +1 an issue) if you think the library should support a currently-unsupported\n   format.\n\n## Upgrading from v0.x -> v1.x (Breaking Changes)\n\n1. `twitter` option removed, replaced with `mention` (which accepts 'twitter', \n   'instagram' and 'soundcloud' values)\n2. Matching mentions (previously the `twitter` option) now defaults to\n   being turned off. Previously, Twitter handle matching was on by \n   default.\n3. `replaceFn` option now called with just one argument: the `Match` \n   object (previously was called with two arguments: `autolinker` and \n   `match`)\n4. (Used inside the `replaceFn`) `TwitterMatch` replaced with \n   `MentionMatch`, and `MentionMatch.getType()` now returns `'mention'` \n   instead of `'twitter'`\n5. (Used inside the `replaceFn`) `TwitterMatch.getTwitterHandle()` -> \n   `MentionMatch.getMention()`\n\n\n\n## Developing / Contributing\n\nPull requests definitely welcome. To setup the project, make\nsure you have [Node.js](https://nodejs.org) installed. Then\nopen up a command prompt and type the following:\n\n```\nnpm install -g yarn  # if you don't have yarn already\n\ncd Autolinker.js     # where you cloned the project\nyarn install\n```\n\nTo run the tests:\n\n```\nyarn test\n```\n\n- Make sure to add tests to cover your new functionality/bugfix\n- Run the `yarn test` command to build/test\n- Please use tabs for indents! Tabs are better for everybody \n  (individuals can set their editors to different tab sizes based on \n  their visual preferences).\n\n\n#### Building the Project Fully\n\nFor this you will need [Ruby](https://www.ruby-lang.org) installed (note: Ruby\ncomes pre-installed on MacOS), with the [JSDuck](https://github.com/senchalabs/jsduck) \ngem. \n\nSee https://github.com/senchalabs/jsduck#getting-it for installation \ninstructions on Windows/Mac/Linux\n\n[JSDuck](https://github.com/senchalabs/jsduck) is used to build the project's\nAPI/documentation site. See [Documentation Generator Notes](#Documentation Generator Notes)\nfor more info.\n\n\n#### Running the Live Example Page Locally\n\nRun:\n\n```\nyarn serve\n```\n\nThen open your browser to: http://localhost:8080/docs/examples/index.html\n\nYou should be able to make a change to source files, and refresh the page to see\nthe changes.\n\nNote: If anyone wants to submit a PR converting `gulp watch` to `webpack` with \nthe live development server, that would be much appreciated :)\n\n\n#### Documentation Generator Notes\n\nThis project uses [JSDuck](https://github.com/senchalabs/jsduck) for its \ndocumentation generation, which produces the page at [http://gregjacobs.github.io/Autolinker.js](http://gregjacobs.github.io/Autolinker.js).\n\nUnfortunately, JSDuck is a very old project that is no longer maintained. As \nsuch, it doesn't support TypeScript or anything from ES6 (the `class` keyword, \narrow functions, etc). However, I have yet to find a better documentation \ngenerator that creates such a useful API site. (Suggestions for a new one are \nwelcome though - please raise an issue.)\n\nSince ES6 is not supported, we must generate the documentation from the ES5 \noutput. As such, a few precautions must be taken care of to make sure the \ndocumentation comes out right:\n\n1. `@cfg` documentation tags must exist above a class property that has a \n   default value, or else it won't end up in the ES5 output. For example:\n\n   ```ts\n   // Will correctly end up in the ES5 output\n\n   /**\n    * @cfg {String} title\n    */\n   readonly title: string = '';\n\n\n\n   // Will *not* end up in ES5 output, and thus, won't end up in the generated\n   // documentation\n\n   /**\n    * @cfg {String} title\n    */\n   readonly title: string;\n   ```\n2. The `@constructor` tag must be replaced with `@method constructor`\n\n\n## Changelog\n\nSee [Releases](https://github.com/gregjacobs/Autolinker.js/releases)\n","readmeFilename":"README.md"}