Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v4.0 #354

Merged
merged 52 commits into from
Sep 19, 2022
Merged

v4.0 #354

merged 52 commits into from
Sep 19, 2022

Conversation

nfrasser
Copy link
Owner

@nfrasser nfrasser commented Oct 11, 2021

Breaking Changes

  • Removed deprecated linkifyjs/string, linkifyjs/html, linkifyjs/plugins/* packages
  • Refactored scanner internals break plugins created with Linkify v3
  • Links that begin with mailto: now have type url instead of email

Added

  • linkify-plugin-ip package for detecting IP addresses (v4 and v6 supported)
  • linkify-plugin-keyword package for detecting arbitrary keywords
  • linkify.find() function accepts a third options argument for output formatting
  • Link token methods toFormattedString(options), toFormattedHref(options) and toFormattedObject(options) that accept a linkify.Options object
  • New render option to override link rendering
  • More granular scanner tokens for improved plugin flexibility
  • Second optionalSlashSlash argument for registerCustomProtocol to allow links that don't require // after scheme:
  • Typescript hints and validation for options

Fixed

  • Improved HTML entity parsing with linkify-html
  • Improved link detection with mixed languages
  • Consistent option availability across interfaces (including truncate)

Fixes #171
Fixes #219
Fixes #245
Fixes #338
Fixes #350
Fixes #351
Fixes #357
Fixes #358
Fixes #362
Fixes #367
Fixes #372
Fixes #374
Fixes #375
Fixes #349
Fixes #365
Fixes #376
Fixes #378
Fixes #385
Fixes #387

* Refactor scanner to emit more granular tokens

The DOMAIN token (among others) has been removed in favour of WORD, UWORD and other tokens. SCHEME (formerly PROTOCOL) tokens now come in several flavours. Includes additional facilities for token groups, which will be useful for future plugins down the line

Also fixes file URL behaviour

* Update plugins to use new scanner tokens

Also improves hashtag and mention plugin accuracy

* Update tests to work with new scanner

* Better workspace packages to improve build order

* Update benchmark require

* Remove resolved FIXME

* Additional tests for linkify register functions

Fixes #171
Fixes #245
Fixes #351
@nfrasser nfrasser self-assigned this Oct 11, 2021
@coveralls
Copy link

Pull Request Test Coverage Report for Build 1329545737

  • 297 of 297 (100.0%) changed or added relevant lines in 10 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+1.6%) to 94.649%

Totals Coverage Status
Change from base Build 1327335843: 1.6%
Covered Lines: 854
Relevant Lines: 878

💛 - Coveralls

@coveralls
Copy link

coveralls commented Oct 11, 2021

Pull Request Test Coverage Report for Build 1329756125

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 70 of 78 (89.74%) changed or added relevant lines in 4 files are covered.
  • 8 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+1.7%) to 94.649%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/linkify-react/src/linkify-react.js 12 13 92.31%
packages/linkify-jquery/src/linkify-jquery.js 7 14 50.0%
Files with Coverage Reduction New Missed Lines %
packages/linkify-element/src/linkify-element.js 4 85.96%
packages/linkifyjs/src/core/fsm.js 4 86.73%
Totals Coverage Status
Change from base Build 1327335843: 1.7%
Covered Lines: 854
Relevant Lines: 878

💛 - Coveralls

Nick Frasser added 13 commits October 11, 2021 12:17
With updated simple-html-tokenizer, now correctly handles HTML-encoded <,
>, ", and & characters
- New toFormatted* token methods that accept options
- New render() token method to return final HTML tag intermediate representation
- New Options implementation to support token rendering
- Removed Options#resolve() method in favour of render
- Update interfaces to use new unified rendering
Nick Frasser added 27 commits January 30, 2022 12:54
Previously, when writing the parsed HTML back to a string, linkify-html ignored the selfClosing flag on StartTag tokens. Now it replaces it the same way in which it was found

Fixes #375
Also separated out plugin definition and registration to make testing easier
* Initial refactor of exports and types for plugin system

* Refactor plugins to use updated linkify plugin API

* Initial untested keyword plugin implementation

* Keyword test and transition bug fixes

* State machine refactor for native FSM collections support

Includes scanner and parser refactor to use the revamped scanner API.

Praying that this will be the last parsing refactor 🙏🙏🙏

* Passing implementation of all plugins with new token API

Including keyword plugin

* Scanner performance optimizations

Improves initialization speed to be more comparable to v3
For consistency
Will now default to the static State.groups collections
* Initial IP address plugin with IPv4 support

IPv6 support incoming

* Adapt to new transition interface

* Working IPv4 and IPv6 plugins

IPv6 has some bugs but works pretty well overall

* Add test for before plugin applied
No longer have to specify null type to specify opts, can just omit the argument
Might still work but not guaranteed
@nfrasser nfrasser marked this pull request as ready for review September 19, 2022 00:33
@nfrasser nfrasser merged commit 0bb8eef into main Sep 19, 2022
@nfrasser nfrasser deleted the v4.0 branch September 19, 2022 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment