diff options
| author | rinsuki <428rinsuki+git@gmail.com> | 2018-06-17 19:55:39 +0900 |
|---|---|---|
| committer | rinsuki <428rinsuki+git@gmail.com> | 2018-06-17 19:55:39 +0900 |
| commit | 8c40917cc2762a498cd2d35a4f4f69b01de3d672 (patch) | |
| tree | b2e32a07e1fb85964558428068f745a1c299118f /src/text/parse/elements/link.ts | |
| parent | build:ts success (diff) | |
| download | sharkey-8c40917cc2762a498cd2d35a4f4f69b01de3d672.tar.gz sharkey-8c40917cc2762a498cd2d35a4f4f69b01de3d672.tar.bz2 sharkey-8c40917cc2762a498cd2d35a4f4f69b01de3d672.zip | |
[noImplicitAny: true] src/text
Diffstat (limited to 'src/text/parse/elements/link.ts')
| -rw-r--r-- | src/text/parse/elements/link.ts | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/text/parse/elements/link.ts b/src/text/parse/elements/link.ts index 35563ddc3d..7e0d6f5cf8 100644 --- a/src/text/parse/elements/link.ts +++ b/src/text/parse/elements/link.ts @@ -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; +} |