Abolish common and misc directories
This commit is contained in:
parent
a0f8b4e940
commit
5b9f3701f5
111 changed files with 133 additions and 133 deletions
19
src/text/parse/elements/link.ts
Normal file
19
src/text/parse/elements/link.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* Link
|
||||
*/
|
||||
|
||||
module.exports = text => {
|
||||
const match = text.match(/^\??\[([^\[\]]+?)\]\((https?:\/\/[\w\/:%#@\$&\?!\(\)\[\]~\.=\+\-]+?)\)/);
|
||||
if (!match) return null;
|
||||
const silent = text[0] == '?';
|
||||
const link = match[0];
|
||||
const title = match[1];
|
||||
const url = match[2];
|
||||
return {
|
||||
type: 'link',
|
||||
content: link,
|
||||
title: title,
|
||||
url: url,
|
||||
silent: silent
|
||||
};
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue