You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
488 B
19 lines
488 B
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;
|
|
}; |