mirror of
https://github.com/paricafe/misskey.git
synced 2024-11-29 18:16:44 -06:00
19 lines
435 B
TypeScript
19 lines
435 B
TypeScript
import parser from './parser';
|
|
import { MfmForest } from './types';
|
|
import { normalize } from './normalize';
|
|
|
|
export default (source: string): MfmForest => {
|
|
if (source == null || source == '') {
|
|
return null;
|
|
}
|
|
|
|
return normalize(parser.root.tryParse(source));
|
|
};
|
|
|
|
export function parsePlain(source: string): MfmForest {
|
|
if (source == null || source == '') {
|
|
return null;
|
|
}
|
|
|
|
return normalize(parser.plain.tryParse(source));
|
|
}
|