From cd28504dd8e4623ed864de2ad76e88e1022b08b1 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 5 Aug 2018 12:33:51 +0900 Subject: Add new MFM syntax --- src/mfm/parse/elements/motion.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/mfm/parse/elements/motion.ts (limited to 'src/mfm/parse/elements') diff --git a/src/mfm/parse/elements/motion.ts b/src/mfm/parse/elements/motion.ts new file mode 100644 index 0000000000..555a989750 --- /dev/null +++ b/src/mfm/parse/elements/motion.ts @@ -0,0 +1,20 @@ +/** + * Motion + */ + +export type TextElementMotion = { + type: 'motion' + content: string + motion: string +}; + +export default function(text: string) { + const match = text.match(/^\(\(\((.+?)\)\)\)/); + if (!match) return null; + const motion = match[0]; + return { + type: 'motion', + content: motion, + motion: match[1] + } as TextElementMotion; +} -- cgit v1.2.3-freya