feat: 更新 vue-editormd 源码,以支持 PlantUML 解析
This commit is contained in:
parent
3f693be1bd
commit
ee74a79fef
@ -632,7 +632,7 @@
|
|||||||
|
|
||||||
_this.setToolbar();
|
_this.setToolbar();
|
||||||
|
|
||||||
editormd.loadScript(loadPath + "marked.min", function() {
|
editormd.loadScript(loadPath + "marked", function() {
|
||||||
|
|
||||||
editormd.$marked = marked;
|
editormd.$marked = marked;
|
||||||
|
|
||||||
@ -3674,6 +3674,29 @@
|
|||||||
: ( (pageBreakReg.test(text)) ? this.pageBreak(text) : "<p" + isTeXAddClass + ">" + this.atLink(this.emoji(text)) + "</p>\n" );
|
: ( (pageBreakReg.test(text)) ? this.pageBreak(text) : "<p" + isTeXAddClass + ">" + this.atLink(this.emoji(text)) + "</p>\n" );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解析 PlantUML。code 示例:
|
||||||
|
* @startuml
|
||||||
|
* participant User
|
||||||
|
* User -> Server: Reque
|
||||||
|
* Server --> User: Response
|
||||||
|
* @enduml
|
||||||
|
*
|
||||||
|
* @param {String} code
|
||||||
|
* @returns {Object} 生成后的 plantUML 图像
|
||||||
|
*/
|
||||||
|
markedRenderer.plantuml = function (code) {
|
||||||
|
/** 或者在 loadQueues() 中加载 plantumlEncoder,并在此处直接解析
|
||||||
|
editormd.loadScript(loadPath + "plantuml-encoder.min", function() {
|
||||||
|
editormd.$plantumlEncoder = plantumlEncoder;
|
||||||
|
});
|
||||||
|
const encoded = editormd.$plantumlEncoder.encode(code);
|
||||||
|
return `<img src="https://www.plantuml.com/plantuml/svg/${encoded}" />`;
|
||||||
|
**/
|
||||||
|
|
||||||
|
return marked.Renderer.prototype.plantuml.apply(this, arguments);
|
||||||
|
};
|
||||||
|
|
||||||
markedRenderer.code = function (code, lang, escaped) {
|
markedRenderer.code = function (code, lang, escaped) {
|
||||||
|
|
||||||
if (lang === "seq" || lang === "sequence")
|
if (lang === "seq" || lang === "sequence")
|
||||||
|
|||||||
1309
public/static/editor.md/lib/marked.js
Normal file
1309
public/static/editor.md/lib/marked.js
Normal file
File diff suppressed because it is too large
Load Diff
6
public/static/plantuml-encoder/plantuml-encoder.min.js
vendored
Normal file
6
public/static/plantuml-encoder/plantuml-encoder.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user