mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2024-12-16 18:29:01 +01:00
12 lines
383 B
TypeScript
12 lines
383 B
TypeScript
import parser, { plainParser } 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 ? plainParser.root.tryParse(source) : parser.root.tryParse(source) as MfmForest;
|
|
return normalize(raw);
|
|
};
|