Files
misskey/src/common/text/elements/url.js
2017-02-11 02:32:00 +09:00

14 lines
219 B
JavaScript

/**
* URL
*/
module.exports = text => {
const match = text.match(/^https?:\/\/[\w\/:%#@\$&\?!\(\)\[\]~\.=\+\-]+/);
if (!match) return null;
const link = match[0];
return {
type: 'link',
content: link
};
};