1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-05 12:25:54 +02:00
Files
misskey/src/mfm/parse.ts
2019-01-30 14:21:36 +09:00

12 lines
357 B
TypeScript

import parser, { plainParser, MfmForest } from './parser';
import { normalize } from './normalize';
export default (source: string, plainText = false): MfmForest => {
if (source == null || source == '') {
return null;
}
const raw = plainText ? plainParser.root.tryParse(source) : parser.root.tryParse(source) as MfmForest;
return normalize(raw);
};