summaryrefslogtreecommitdiff
path: root/src/mfm/parse.ts
blob: f8464121f3ad7b87b6ef6b9678d2be8005f3c393 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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));
}