Skip to content

Commit c19c1eb

Browse files
committed
Update readme, and fix example app
1 parent 0f09204 commit c19c1eb

File tree

30 files changed

+85
-94
lines changed

30 files changed

+85
-94
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ jobs:
2121
- name: build
2222
run: pnpm run build
2323

24+
# Not deploying the example here, but make sure it builds without errors
25+
- name: build-example
26+
run: pnpm run build:live-example
27+
2428
- name: test
2529
run: pnpm run test:ci
2630

README.md

Lines changed: 37 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,28 @@ Output: "Visit <a href="https://google.com">google.com</a>"
1919
```
2020

2121
Because 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

2626
So, 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

4445
Hope 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
558561
To 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
584572
Run:
585573
586-
```
587-
yarn serve
574+
```sh
575+
pnpm run devserver
588576
```
589577
590578
Then open your browser to: http://localhost:8080/docs/examples/index.html
591579
592580
You should be able to make a change to source files, and refresh the page to see
593581
the 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
```
635627
2. 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

Comments
 (0)