An MFM parser as for an extension of markdown, written with TypeScript.
MFM Copyright (C) syuilo and Misskey project
npm i mfm-marked-extension
// 1: Apply each of rules seperatedly
import { marked } from "marked";
import { markedMfmFn, markedMfmMention } from "mfm-marked-extension";
marked.use({extensions: [markedMfmFn, markedMfmMention]});
marked.parse('$[tada hello!]');
// <p><span style="display: inline-block; font-size: 1.5rem; animation: 5s linear infinite both global-tada;">hello!</span></p>
// 2: Auto-implement all the rules at once
import { mfm4marked } from "mfm-marked-extension";
const marked = mfm4marked.marked();
// use this as of 'marked'
// if cjs, you can use like this:
// const marked = (await require('mfm-marked-extension')).mfm4marked.marked();
- Clone the repository
- Install packages:
- npm:
npm i
- pnpm:
pnpm i
- Build components
npm run build
pnpm build
This software is released under the MIT License.