Skip to content

Commit 3df3568

Browse files
author
Nick Frasser
authored
Merge pull request #157 from SoapBox/v2.1
v2.1
2 parents a4c26d4 + 39352cc commit 3df3568

File tree

15 files changed

+672
-593
lines changed

15 files changed

+672
-593
lines changed

CHANGELOG.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,46 @@
11
# Linkify Changelog
22

3+
### v2.1.0
4+
5+
#### BREAKING CHANGES
6+
7+
* The `dist/jquery.linkify.js` 1.x legacy browser files have been permanently
8+
removed from the release bundle.
9+
* Use `linkify.js` and `linkify-jquery.js` instead.
10+
* The deprecated `newLine` option from linkify 1.x has been completely removed.
11+
* Use the [`nl2br` option](http://soapbox.github.io/linkifyjs/options.html#nl2br) instead.
12+
13+
#### Features
14+
15+
* [New React.js interface](http://soapbox.github.io/linkifyjs/linkify-react.html)
16+
* [@mention plugin](http://soapbox.github.io/linkifyjs/plugin-mention.html)
17+
* [GitHub-style ticket/issue reference plugin](http://soapbox.github.io/linkifyjs/plugin-ticket.html)
18+
* Improved option definitions
19+
* Options that take functions with value and type arguments can now be
20+
specified as objects, where each key is the target link type.
21+
22+
#### Deprecations
23+
24+
* The `linkAttributes` option is deprecated in favour of just **`attributes`**.
25+
* The `linkClass` option is deprecated in favour of **`className`**.
26+
* The default `.linkified` class is deprecated and will be fully removed
27+
in a future release.
28+
29+
To maintain compatibility with versions >= 2.1, make sure options objects
30+
include these properties instead of `linkAttributes` and `linkClass`
31+
32+
#### All Changes
33+
34+
* Build optimizations to make compiled AMD payload smaller
35+
* Bugfix in quick-es3 task
36+
* Make better use of ES6 modules and rollup
37+
* Tickets plugin (#156)
38+
* Additional Mentions features, enhancements, and tests (#155)
39+
* Mentions plugin (#111)
40+
* Revamped options utility (#154)
41+
* Linkify React Interface (#150)
42+
* Development upgrades (#153)
43+
344
### v2.0.5
445

546
* Correct trailing symbol parsing (#149)

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ bower install linkifyjs
6161
Add [linkify](https://github.com/nfrasser/linkify-shim/raw/master/linkify.min.js) and [linkify-jquery](https://github.com/nfrasser/linkify-shim/raw/master/linkify-jquery.min.js) to your HTML following jQuery:
6262

6363
```html
64-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
64+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
6565
<script src="linkify.min.js"></script>
6666
<script src="linkify-jquery.min.js"></script>
6767
```
@@ -158,16 +158,21 @@ Note that if you are using `linkify-jquery.amd.js`, a `jquery` module must be de
158158
### Browser globals
159159

160160
```html
161-
<script src="jquery.js"></script>
161+
<script src="react.js"></script>
162+
<script src="react-dom.js"></script>
162163
<script src="linkify.js"></script>
163-
<script src="linkify-string.js"></script>
164-
<script src="linkify-jquery.js"></script>
164+
<script src="linkify-react.js"></script>
165165
```
166166

167-
```js
167+
```jsx
168168
linkify.test('[email protected]'); // true
169-
var htmlStr = linkifyStr('Check out soapboxhq.com it is great!');
170-
$('p').linkify();
169+
170+
ReactDOM.render(
171+
<Linkify options={{ignoreTags: ['style']}}>
172+
Check out soapboxhq.com it is great!
173+
</Linkify>,
174+
document.getElementById('#container');
175+
);
171176
```
172177

173178
## Internet Explorer
@@ -198,6 +203,7 @@ Download the [**latest release**](https://github.com/SoapBox/linkifyjs/releases)
198203

199204
**Interfaces** _(recommended - include at least one)_
200205

206+
* **[react](http://soapbox.github.io/linkifyjs/docs/linkify-react.html)**<br> [`.min.js`](https://github.com/nfrasser/linkify-shim/raw/master/linkify-react.min.js) · [`.js`](https://github.com/nfrasser/linkify-shim/raw/master/linkify-react.js) · [`.amd.min.js`](https://github.com/nfrasser/linkify-shim/raw/master/linkify-react.amd.min.js) · [`.amd.js`](https://github.com/nfrasser/linkify-shim/raw/master/linkify-react.amd.js)
201207
* **[jquery](http://soapbox.github.io/linkifyjs/docs/linkify-jquery.html)**<br> [`.min.js`](https://github.com/nfrasser/linkify-shim/raw/master/linkify-jquery.min.js) · [`.js`](https://github.com/nfrasser/linkify-shim/raw/master/linkify-jquery.js) · [`.amd.min.js`](https://github.com/nfrasser/linkify-shim/raw/master/linkify-jquery.amd.min.js) · [`.amd.js`](https://github.com/nfrasser/linkify-shim/raw/master/linkify-jquery.amd.js)
202208
* **[html](http://soapbox.github.io/linkifyjs/docs/linkify-html.html)**<br> [`.min.js`](https://github.com/nfrasser/linkify-shim/raw/master/linkify-html.min.js) · [`.js`](https://github.com/nfrasser/linkify-shim/raw/master/linkify-html.js) · [`.amd.min.js`](https://github.com/nfrasser/linkify-shim/raw/master/linkify-html.amd.min.js) · [`.amd.js`](https://github.com/nfrasser/linkify-shim/raw/master/linkify-html.amd.js)
203209
* **[element](http://soapbox.github.io/linkifyjs/docs/linkify-element.html)** _(Included with linkify-jquery)_<br> [`.min.js`](https://github.com/nfrasser/linkify-shim/raw/master/linkify-element.min.js) · [`.js`](https://github.com/nfrasser/linkify-shim/raw/master/linkify-element.js) · [`.amd.min.js`](https://github.com/nfrasser/linkify-shim/raw/master/linkify-element.amd.min.js) · [`.amd.js`](https://github.com/nfrasser/linkify-shim/raw/master/linkify-element.amd.js)

gulpfile.js

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ gulp.task('babel', () =>
6161
/**
6262
ES6 to babel AMD modules
6363
*/
64-
gulp.task('babel-amd', () =>
64+
gulp.task('babel-amd-core', () =>
6565
gulp.src(paths.src)
6666
.pipe(replace('__TLDS__', tldsReplaceStr))
6767
.pipe(babel({
@@ -72,10 +72,29 @@ gulp.task('babel-amd', () =>
7272
moduleIds: true
7373
// moduleRoot: 'linkifyjs'
7474
}))
75+
.pipe(quickEs3())
7576
.pipe(gulp.dest('build/amd')) // Required for building plugins separately
76-
.pipe(amdOptimize('linkify'))
77-
.pipe(concat('linkify.amd.js'))
77+
);
78+
79+
80+
/**
81+
ES6 to babel AMD modules
82+
Must run interfaces first because a more optimized core linkify payload will
83+
overwrite the AMD-generated one
84+
*/
85+
gulp.task('babel-amd', ['babel-amd-core'], () =>
86+
gulp.src(paths.srcCore)
87+
.pipe(rollup({
88+
bundle: {
89+
format: 'amd',
90+
moduleId: 'linkify',
91+
moduleName: 'linkify'
92+
}
93+
}))
94+
.pipe(babel())
95+
.pipe(replace('__TLDS__', tldsReplaceStr))
7896
.pipe(quickEs3())
97+
.pipe(concat('linkify.amd.js'))
7998
.pipe(gulp.dest('build'))
8099
);
81100

@@ -232,6 +251,7 @@ gulp.task('build-polyfill', () =>
232251
// Build steps
233252
gulp.task('build', [
234253
'babel',
254+
'babel-amd-core',
235255
'babel-amd',
236256
'build-core',
237257
'build-interfaces',
@@ -340,16 +360,8 @@ gulp.task('karma-amd-ci', (callback) => {
340360
return server.start();
341361
});
342362

343-
// Build the deprecated legacy interface
344-
gulp.task('build-legacy', ['build'], () =>
345-
gulp.src(['build/linkify.js', 'build/linkify-jquery.js'])
346-
.pipe(concat('jquery.linkify.js'))
347-
.pipe(wrap({src: 'templates/linkify-legacy.js'}))
348-
.pipe(gulp.dest('build/dist'))
349-
);
350-
351363
// Build a file that can be used for easy headless benchmarking
352-
gulp.task('build-benchmark', ['build-legacy'], () =>
364+
gulp.task('build-benchmark', ['build'], () =>
353365
gulp.src('build/dist/jquery.linkify.js')
354366
.pipe(concat('linkify-benchmark.js'))
355367
.pipe(wrap({src: 'templates/linkify-benchmark.js'}))
@@ -358,26 +370,18 @@ gulp.task('build-benchmark', ['build-legacy'], () =>
358370
);
359371

360372
// NOTE: DO NOT Upgrade gulp-uglify, it breaks IE8 and the options don't seem to be working
361-
gulp.task('uglify', ['build-legacy'], () => {
373+
gulp.task('uglify', ['build'], () => {
362374
let options = {
363375
mangleProperties: {
364376
regex: new RegExp(`^(?!(${unmangleableProps.join('|')})).*$`)
365377
}
366378
};
367379

368-
let task = gulp.src('build/*.js')
380+
return gulp.src('build/*.js')
369381
.pipe(gulp.dest('dist')) // non-minified copy
370382
.pipe(rename((path) => path.extname = '.min.js'))
371383
.pipe(uglify(options))
372384
.pipe(gulp.dest('dist'));
373-
374-
let taskLegacy = gulp.src('build/dist/jquery.linkify.js')
375-
.pipe(gulp.dest('dist/dist')) // non-minified copy
376-
.pipe(rename((path) => path.extname = '.min.js'))
377-
.pipe(uglify(options))
378-
.pipe(gulp.dest('dist/dist'));
379-
380-
return merge(task, taskLegacy);
381385
});
382386

383387
gulp.task('dist', ['uglify']);

0 commit comments

Comments
 (0)