1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-12-22 18:48:34 +09:00
misskey/src/mfm/parse.ts
2020-04-04 08:46:54 +09:00

20 lines
490 B
TypeScript

import { mfmLanguage } from './language';
import { MfmForest } from './prelude';
import { normalize } from './normalize';
export function parse(source: string | null): MfmForest | null {
if (source == null || source === '') {
return null;
}
return normalize(mfmLanguage.root.tryParse(source));
}
export function parsePlain(source: string | null): MfmForest | null {
if (source == null || source === '') {
return null;
}
return normalize(mfmLanguage.plain.tryParse(source));
}