19 lines
456 B
TypeScript
19 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));
|
|
}
|