summaryrefslogtreecommitdiff
path: root/src/common/text/elements/url.js
blob: f350b707acb84b4209f85638008277ed139c8e05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
/**
 * URL
 */

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