Extract parsePlain function
This commit is contained in:
@@ -2,11 +2,18 @@ import parser from './parser';
|
||||
import { MfmForest } from './types';
|
||||
import { normalize } from './normalize';
|
||||
|
||||
export default (source: string, plainText = false): MfmForest => {
|
||||
export default (source: string): MfmForest => {
|
||||
if (source == null || source == '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
const raw = plainText ? parser.plain.tryParse(source) : parser.root.tryParse(source) as MfmForest;
|
||||
return normalize(raw);
|
||||
return normalize(parser.root.tryParse(source));
|
||||
};
|
||||
|
||||
export function parsePlain(source: string): MfmForest {
|
||||
if (source == null || source == '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return normalize(parser.plain.tryParse(source));
|
||||
}
|
||||
|
Reference in New Issue
Block a user