diff --git a/index.js b/index.js index 3f6c626..ae280a9 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,7 @@ import createHtmlElement from 'create-html-element'; // Capture the whole URL in group 1 to keep `String#split()` support -const urlRegex = () => (/((? (/((?` element as string const linkify = (href, options = {}) => createHtmlElement({ diff --git a/test.js b/test.js index 7b0dc3d..aa3f8fd 100644 --- a/test.js +++ b/test.js @@ -175,3 +175,12 @@ test('skips truncated URLs (DocumentFragment)', t => { html(domify('See https://github.com/sindresorhus/linkify-... and https://github.com/sindresorhus/linkify-...')), ); }); + +test('supports CJK URLs', t => { + t.is(linkifyUrlsToHtml('https://语c.com'), 'https://语c.com'); + t.is( + linkifyUrlsToHtml('https://github.com/scarf005/hangul-test/wiki/한글-위키-페이지'), + 'https://github.com/scarf005/hangul-test/wiki/한글-위키-페이지', + ); + t.is(linkifyUrlsToHtml('https://www.例.jp'), 'https://www.例.jp'); +});