mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-24 09:49:05 +01:00
13 lines
362 B
TypeScript
13 lines
362 B
TypeScript
import parser from './parser';
|
|
import { MfmForest } from './types';
|
|
import { normalize } from './normalize';
|
|
|
|
export default (source: string, plainText = false): MfmForest => {
|
|
if (source == null || source == '') {
|
|
return null;
|
|
}
|
|
|
|
const raw = plainText ? parser.plain.tryParse(source) : parser.root.tryParse(source) as MfmForest;
|
|
return normalize(raw);
|
|
};
|