[noImplicitAny: true] src/text
This commit is contained in:
parent
871f886702
commit
8c40917cc2
16 changed files with 166 additions and 44 deletions
|
|
@ -2,7 +2,15 @@
|
|||
* Link
|
||||
*/
|
||||
|
||||
module.exports = text => {
|
||||
export type TextElementLink = {
|
||||
type: "link"
|
||||
content: string
|
||||
title: string
|
||||
url: string
|
||||
silent: boolean
|
||||
};
|
||||
|
||||
export default function(text: string) {
|
||||
const match = text.match(/^\??\[([^\[\]]+?)\]\((https?:\/\/[\w\/:%#@\$&\?!\(\)\[\]~\.=\+\-]+?)\)/);
|
||||
if (!match) return null;
|
||||
const silent = text[0] == '?';
|
||||
|
|
@ -15,5 +23,5 @@ module.exports = text => {
|
|||
title: title,
|
||||
url: url,
|
||||
silent: silent
|
||||
};
|
||||
};
|
||||
} as TextElementLink;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue