From 79ffbf95db9d0cc019d06ab93b1bfa6ba0d4f9ae Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 21 Nov 2018 05:11:00 +0900 Subject: Improve MFM parser (#3337) * wip * wip * Refactor * Refactor * wip * wip * wip * wip * Refactor * Refactor * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Clean up * Update misskey-flavored-markdown.ts * wip * wip * wip * wip * Update parser.ts * wip * Add new test * wip * Add new test * Add new test * wip * Refactor * Update parse.ts * Refactor * Update parser.ts * wip --- src/mfm/parse/elements/link.ts | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 src/mfm/parse/elements/link.ts (limited to 'src/mfm/parse/elements/link.ts') diff --git a/src/mfm/parse/elements/link.ts b/src/mfm/parse/elements/link.ts deleted file mode 100644 index 972fce3810..0000000000 --- a/src/mfm/parse/elements/link.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Link - */ - -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.startsWith('?'); - const link = match[0]; - const title = match[1]; - const url = match[2]; - return { - type: 'link', - content: link, - title: title, - url: url, - silent: silent - } as TextElementLink; -} -- cgit v1.2.3-freya