yumechi-no-kuni/src/mfm/parse.ts
2019-01-30 17:04:49 +09:00

19 lines
458 B
TypeScript

import { mfmLanguage } from './language';
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));
}