1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-20 19:08:21 +00:00
This commit is contained in:
MichaelAn
2018-10-25 10:39:16 +08:00
committed by Daniel Pan
parent 67e19792aa
commit 91cbfc508e
5 changed files with 241 additions and 96 deletions

View File

@@ -14,30 +14,32 @@ var deepmerge = require('deepmerge').default;
function stringify(config) {
var settings = xtend(config, this.data('settings'));
var schema = deepmerge(gh, {
"attributes":{
"input": [
"type",
'attributes': {
'input': [
'type',
],
"li": [
"className"
'li': [
'className'
],
"code":[
"className",
'code': [
'className',
],
},
"tagNames": [
"input",
"code"
'tagNames': [
'input',
'code'
]
});
this.Compiler = compiler;
function compiler(tree) {
// use sanity to remove dangerous html, the default is
var hast = sanitize(tree, schema);
return toHTML(hast, settings);
}
}
// markdown -> mdast -> html AST -> html
var processor = unified()
.use(markdown, {commonmark: true})
.use(breaks)
@@ -49,6 +51,6 @@ var processor = unified()
var processorGetAST = unified()
.use(markdown, {commonmark: true})
.use(slug)
.use(slug);
export { processor, processorGetAST };