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/big.ts20
-rw-r--r--src/mfm/parse/elements/motion.ts20
2 files changed, 40 insertions, 0 deletions
diff --git a/src/mfm/parse/elements/big.ts b/src/mfm/parse/elements/big.ts
new file mode 100644
index 0000000000..8e39c75a55
--- /dev/null
+++ b/src/mfm/parse/elements/big.ts
@@ -0,0 +1,20 @@
+/**
+ * Big
+ */
+
+export type TextElementBig = {
+ type: 'big'
+ content: string
+ big: string
+};
+
+export default function(text: string) {
+ const match = text.match(/^\*\*\*(.+?)\*\*\*/);
+ if (!match) return null;
+ const big = match[0];
+ return {
+ type: 'big',
+ content: big,
+ big: match[1]
+ } as TextElementBig;
+}
diff --git a/src/mfm/parse/elements/motion.ts b/src/mfm/parse/elements/motion.ts
new file mode 100644
index 0000000000..9e7370e071
--- /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(/^\(\(\((.+?)\)\)\)/) || text.match(/^<motion>(.+?)<\/motion>/);
+ if (!match) return null;
+ const motion = match[0];
+ return {
+ type: 'motion',
+ content: motion,
+ motion: match[1]
+ } as TextElementMotion;
+}