sharkey/src/mfm/parse.ts
2019-01-30 16:56:27 +09:00

20 lines
456 B
TypeScript

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