wujingjing
2024-08-12 4df2f8b18bca292d3cc4d147a8e844c9610bef3b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
const md = require('./parse/markdown/index'),
    parse = require('./parse/index')
 
module.exports = (str,type,option)=>{
    option = option || {};
    let result;
    switch (type) {
        case 'markdown':
            result = parse(md(str),option);
        break;
        case 'html':
            result = parse(str,option);
        break;
        default:
            throw new Error('Invalid type, only markdown and html are supported');
        break;
    };
    return result;
};