Initial commit 🍀
This commit is contained in:
commit
b3f42e62af
405 changed files with 31017 additions and 0 deletions
16
src/common/text/elements/url.js
Normal file
16
src/common/text/elements/url.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* URL
|
||||
*/
|
||||
|
||||
const regexp = /https?:\/\/[\w\/:%#@\$&\?!\(\)\[\]~\.=\+\-]+/;
|
||||
|
||||
module.exports = {
|
||||
test: x => new RegExp('^' + regexp.source).test(x),
|
||||
parse: text => {
|
||||
const link = text.match(new RegExp('^' + regexp.source))[0];
|
||||
return {
|
||||
type: 'link',
|
||||
content: link
|
||||
};
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue