You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+29-5Lines changed: 29 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -29,18 +29,29 @@ So, this utility attempts to handle everything. It:
29
29
In other words, it will automatically link the text "google.com", as well as
30
30
"http://google.com". Will also autolink IPv4 addresses.
31
31
- Will properly handle URLs with query params, anchors,
32
-
and special characters, and not include things like a trailing `.` at the end
32
+
and special characters, and not include chars like a trailing `.` at the end
33
33
of a sentence, or a `)` char if the URL is inside parenenthesis.
34
34
- Will autolink email addresses
35
35
- Will autolink phone numbers
36
36
- Will autolink mentions (Twitter, Instagram, Soundcloud, TikTok, Youtube)
37
37
- Will autolink hashtags (Twitter, Instagram, Facebook, TikTok, Youtube)
38
+
- Won't clobber URLs with hash anchors by treating them as hashtags (like some other libraries do). For example: `google.com/#anchor` is properly linked.
38
39
-**Will properly handle HTML input.** The utility will not overwrite an `href`
39
40
attribute inside anchor (`<a>`) tags (or any other tag/attribute), and will not
40
41
accidentally wrap the inner text of `<a>`/`<script>`/`<style>` tags with a new
41
42
one (which cause doubly-nested anchor tags, or mess with scripts)
42
-
- Will do all of this in `O(n)` (linear) time with low constant factors and
43
-
without the possibility of RegExp backtracking, making it extremely fast.
43
+
- Will do all of this in `O(n)` (linear) time with low constant factors and without the possibility of RegExp [Catastrophic Backtracking](https://www.regular-expressions.info/catastrophic.html), making it extremely fast and unsusceptible to pathological inputs.
method repeatedly (i.e. use the "class" form above).
@@ -580,14 +591,21 @@ Then open your browser to: http://localhost:8080/docs/examples/index.html
580
591
You should be able to make a change to source files, and refresh the page to see
581
592
the changes.
582
593
583
-
#### Running the benchmarks
594
+
#### Running the benchmarks <a name="benchmarks"></a>
584
595
585
596
Run:
586
597
587
598
```sh
588
599
pnpmrunbenchmarks
589
600
```
590
601
602
+
> Note: See the [Benchmarks Table](#benchmarks-table) above for current results.
603
+
604
+
Couple points on the benchmarks:
605
+
* These benchmarks attempt to set up all libraries by configuring comparable features to Autolinker (e.g.: linking emails, hashtags, mentions, etc.) to try to get an apples-to-apples comparison.
606
+
* While developing, recommend running the benchmarks a few times both before and after making any changes if developing.
607
+
* See the [benchmarks](./benchmarks) folder and [benchmarks/input-text.ts](./benchmarks/input-text.ts) for how the benchmarks are set up and what input they are given.
608
+
591
609
#### Documentation Generator Notes
592
610
593
611
This project uses [JSDuck](https://github.com/senchalabs/jsduck) for its
@@ -636,3 +654,9 @@ instructions on Windows/Mac/Linux.
636
654
## Changelog
637
655
638
656
See [Releases](https://github.com/gregjacobs/Autolinker.js/releases)
0 commit comments