mirror of https://gitee.com/godoos/godoos.git
9 changed files with 96 additions and 95 deletions
@ -1,38 +1,12 @@ |
|||||
import 'cherry-markdown/dist/cherry-markdown.css'; |
import 'cherry-markdown/dist/cherry-markdown.css'; |
||||
import Cherry from 'cherry-markdown'; |
import CherryEngine from 'cherry-markdown/dist/cherry-markdown.engine.core'; |
||||
const cherryConfig:any = { |
|
||||
editor: { |
|
||||
height: 'auto', |
|
||||
defaultModel: 'previewOnly', |
|
||||
}, |
|
||||
engine: { |
|
||||
global: { |
|
||||
// 开启流式模式 (默认 true)
|
|
||||
flowSessionContext: true, |
|
||||
}, |
|
||||
syntax: { |
|
||||
codeBlock: { |
|
||||
selfClosing: false, |
|
||||
}, |
|
||||
header: { |
|
||||
anchorStyle: 'none', |
|
||||
}, |
|
||||
table: { |
|
||||
selfClosing: false, |
|
||||
}, |
|
||||
fontEmphasis: { |
|
||||
selfClosing: false, |
|
||||
} |
|
||||
} |
|
||||
}, |
|
||||
previewer: { |
|
||||
enablePreviewerBubble: false, |
|
||||
}, |
|
||||
isPreviewOnly: true, |
|
||||
}; |
|
||||
|
|
||||
export function renderMarkdown(currentText: string) { |
export function renderMarkdown(currentText: string) { |
||||
const currentCherry = new Cherry(cherryConfig); |
console.log(currentText) |
||||
currentCherry.setMarkdown(currentText); |
const cherryEngineInstance:any = new CherryEngine({}); |
||||
return currentCherry.getHtml(); |
return cherryEngineInstance.makeHtml(currentText); |
||||
|
// const currentCherry = new Cherry(cherryConfig);
|
||||
|
// currentCherry.setMarkdown(currentText);
|
||||
|
// console.log(currentCherry.getHtml())
|
||||
|
// return currentCherry.getHtml();
|
||||
} |
} |
Loading…
Reference in new issue