Add new MFM syntax
This commit is contained in:
parent
f762cf2770
commit
cd28504dd8
5 changed files with 50 additions and 2 deletions
20
src/mfm/parse/elements/motion.ts
Normal file
20
src/mfm/parse/elements/motion.ts
Normal file
|
|
@ -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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue