代码生成预览语言根据后缀名高亮显示

pull/267/head
RuoYi 2021-02-20 11:06:36 +08:00
parent d2cb20024f
commit fd8caa01e9
1 changed files with 3 additions and 2 deletions

View File

@ -143,10 +143,11 @@
if (result.code == web_status.SUCCESS) {
var items = [];
$.each(result.data, function(index, value) {
var highCode = hljs.highlightAuto(value).value;
var templateName = index.substring(index.lastIndexOf("/") + 1, index.length).replace(/\.vm/g, "");
if(!$.common.equals("sql", templateName) && !$.common.equals("tree.html", templateName) && !$.common.equals("sub-domain.java", templateName)){
items.push({
var language = templateName.substring(templateName.lastIndexOf(".") + 1);
var highCode = hljs.highlight(language, value).value;
items.push({
title: templateName , content: "<pre class=\"layui-code\"><code>" + highCode + "</code></pre>"
})
}