@@ -19,27 +19,28 @@ Output: "Visit <a href="https://google.com">google.com</a>"
1919```
2020
2121Because I had so much trouble finding a good auto-linking implementation out in
22- the wild, I decided to roll my own. It seemed that everything I found out there
23- was either an implementation that didn't cover every case, or was just limited
24- in one way or another.
22+ the wild, I decided to roll my own. It seemed that everything I found was either
23+ an implementation that didn't cover every case, had many false positives linked,
24+ or was just limited in one way or another.
2525
2626So, this utility attempts to handle everything. It:
2727
2828- Autolinks URLs, whether or not they start with the protocol (i.e. 'http://').
2929 In other words, it will automatically link the text "google.com", as well as
30- "http://google.com "
31- - Will properly handle URLs with query parameters, named anchors (i.e. hash),
32- and special characters
30+ "http://google.com ". Will also autolink IPv4 addresses.
31+ - Will properly handle URLs with query params, anchors,
32+ and special characters, and not include things like a trailing ` . ` at the end
33+ of a sentence, or a ` ) ` char if the URL is inside parenenthesis.
3334- Will autolink email addresses
3435- Will autolink phone numbers
3536- Will autolink mentions (Twitter, Instagram, Soundcloud, TikTok, Youtube)
3637- Will autolink hashtags (Twitter, Instagram, Facebook, TikTok, Youtube)
37- - Will properly handle HTML input. The utility will not overwrite the ` href `
38- attribute inside anchor (` <a> ` ) tags (or any other tag/attribute),
39- and will not accidentally wrap the inner text of anchor/ script/ style tags
40- with a new one (which would cause doubly-nested anchor tags)
38+ - ** Will properly handle HTML input.** The utility will not overwrite an ` href `
39+ attribute inside anchor (` <a> ` ) tags (or any other tag/attribute), and will not
40+ accidentally wrap the inner text of ` <a> ` / ` < script> ` / ` < style> ` tags with a new
41+ one (which cause doubly-nested anchor tags, or mess with scripts )
4142- Will do all of this in ` O(n) ` (linear) time with low constant factors and
42- without the possibility of RegExp backtracking
43+ without the possibility of RegExp backtracking, making it extremely fast.
4344
4445Hope that this utility helps you as well!
4546
@@ -546,55 +547,46 @@ The full API docs for Autolinker may be referenced at:
546547
547548## Developing / Contributing
548549
549- Pull requests definitely welcome. To setup the project, make
550- sure you have [Node.js](https://nodejs.org) installed. Then
551- open up a command prompt and type the following:
550+ Pull requests definitely welcome. To setup the project, make sure you have
551+ [Node.js](https://nodejs.org) installed. Then open up a command prompt and type
552+ the following:
552553
553- ` ` `
554- cd Autolinker .js # where you cloned the project
555- npm install
554+ ` ` ` sh
555+ npm install - g pnpm@latest # this project uses pnpm workspaces, and pnpm is a faster npm anyway : )
556+
557+ cd Autolinker .js # where you cloned the project
558+ pnpm install
556559` ` `
557560
558561To run the tests:
559562
560- ` ` `
561- npm run test
563+ ` ` ` sh
564+ pnpm run test
562565` ` `
563566
564567- Make sure to add tests to check your new functionality/bugfix
565- - Run the ` npm run test` command to test
566-
567-
568- #### Building the Project Fully
569-
570- For this you will need [Ruby](https://www.ruby-lang.org) installed (note: Ruby
571- comes pre-installed on MacOS), with the [JSDuck](https://github.com/senchalabs/jsduck)
572- gem.
573-
574- See https://github.com/senchalabs/jsduck#getting-it for installation
575- instructions on Windows/Mac/Linux
576-
577- [JSDuck](https://github.com/senchalabs/jsduck) is used to build the project's
578- API/documentation site. See [Documentation Generator Notes](#Documentation Generator Notes)
579- for more info.
580-
568+ - Run the ` pnpm run test ` command to test
581569
582570#### Running the Live Example Page Locally
583571
584572Run:
585573
586- ` ` `
587- yarn serve
574+ ` ` ` sh
575+ pnpm run devserver
588576` ` `
589577
590578Then open your browser to: http://localhost:8080/docs/examples/index.html
591579
592580You should be able to make a change to source files, and refresh the page to see
593581the changes.
594582
595- Note: If anyone wants to submit a PR converting ` gulp watch` to ` webpack` with
596- the live development server, that would be much appreciated :)
583+ #### Running the benchmarks
584+
585+ Run:
597586
587+ ` ` ` sh
588+ pnpm run benchmarks
589+ ` ` `
598590
599591#### Documentation Generator Notes
600592
@@ -634,6 +626,12 @@ documentation comes out right:
634626 ` ` `
6356272. The ` @constructor ` tag must be replaced with `@method constructor `
636628
629+ To build the documentation, you will need [Ruby](https : // www.ruby-lang.org)
630+ installed (note: Ruby comes pre- installed on MacOS), with the
631+ [JSDuck ](https: // github.com/senchalabs/jsduck) gem.
632+
633+ See https: // github.com/senchalabs/jsduck#getting-it for installation
634+ instructions on Windows/ Mac/ Linux.
637635
638636## Changelog
639637
0 commit comments