diff --git a/packages/embed-plugin-url/package.json b/packages/embed-plugin-url/package.json
index d9d9dfa..0558025 100644
--- a/packages/embed-plugin-url/package.json
+++ b/packages/embed-plugin-url/package.json
@@ -22,7 +22,7 @@
},
"homepage": "https://github.com/ritz078/embed.js#readme",
"dependencies": {
- "html-linkify": "1.2.2",
- "just-extend": "1.1.27"
+ "just-extend": "1.1.27",
+ "linkifyjs": "^2.1.5"
}
}
diff --git a/packages/embed-plugin-url/src/index.js b/packages/embed-plugin-url/src/index.js
index e529d90..b91184e 100644
--- a/packages/embed-plugin-url/src/index.js
+++ b/packages/embed-plugin-url/src/index.js
@@ -1,22 +1,17 @@
import extend from "just-extend"
-import linkify from "html-linkify"
+import linkify from 'linkifyjs/string'
const id = "url"
export default function url(opts) {
- const defaultOptions = {
- attributes: {},
+ const defaultOptions = { }
- // setting this to true will mess up characters like "
- escape: false
- }
-
- const { attributes, escape } = extend({}, defaultOptions, opts)
+ const defaults = extend({}, defaultOptions, opts)
return {
id,
async transform(options) {
return extend({}, options, {
- result: linkify(options.result, { attributes, escape })
+ result: linkify(options.result, defaults)
})
}
}
diff --git a/packages/embed-plugin-url/tests/index.test.js b/packages/embed-plugin-url/tests/index.test.js
index 6fe3364..7eff95a 100644
--- a/packages/embed-plugin-url/tests/index.test.js
+++ b/packages/embed-plugin-url/tests/index.test.js
@@ -22,9 +22,9 @@ test("Plugin: url - should convert URL into anchor", async t => {
test("Plugin: url - should include attributes in URL", async t => {
const { result } = await url({
- attributes: {
- target: "_blank"
- }
+ attributes: {
+ rel: 'nofollow'
+ }
}).transform({
result: "hello https://world.com"
})
diff --git a/packages/embed-plugin-url/tests/snapshots/index.test.js.md b/packages/embed-plugin-url/tests/snapshots/index.test.js.md
index 1681a16..c4db303 100644
--- a/packages/embed-plugin-url/tests/snapshots/index.test.js.md
+++ b/packages/embed-plugin-url/tests/snapshots/index.test.js.md
@@ -1,4 +1,4 @@
-# Snapshot report for `packages/embed-plugin-url/tests/index.test.js`
+# Snapshot report for `packages\embed-plugin-url\tests\index.test.js`
The actual snapshot is saved in `index.test.js.snap`.
@@ -8,10 +8,10 @@ Generated by [AVA](https://ava.li).
> Snapshot 1
- 'https://a.com'
+ 'https://a.com'
## Plugin: url - should include attributes in URL
> Snapshot 1
- 'hello https://world.com'
+ 'hello https://world.com'
diff --git a/packages/embed-plugin-url/tests/snapshots/index.test.js.snap b/packages/embed-plugin-url/tests/snapshots/index.test.js.snap
index 000412f..aa08370 100644
Binary files a/packages/embed-plugin-url/tests/snapshots/index.test.js.snap and b/packages/embed-plugin-url/tests/snapshots/index.test.js.snap differ