summaryrefslogtreecommitdiff
path: root/src/mfm/parse/elements
diff options
context:
space:
mode:
Diffstat (limited to 'src/mfm/parse/elements')
-rw-r--r--src/mfm/parse/elements/motion.ts20
1 files changed, 20 insertions, 0 deletions
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;
+}