hinesboy / mavonEditor

mavonEditor - A markdown editor based on Vue that supports a variety of personalized features
http://www.mavoneditor.com/
MIT License
6.45k stars 918 forks source link

本地按需加载代码高亮无效 #452

Closed re1oaded closed 4 years ago

re1oaded commented 5 years ago
hljs_css: function(css) {
      // 这是你的代码高亮配色文件路径
      return '/highlightjs/styles/' + css + '.min.css';
},
 hljs_lang: function(lang) {
       // 这是你的代码高亮语言解析路径
       return '/highlightjs/languages/' + lang + '.min.js';
 },

这两个文件加载不了,代码无法高亮,其余都能加载,包括highlight.min.js

mmd0308 commented 5 years ago

我也遇到相同的问题,请问你们解决了吗?

zong209 commented 5 years ago

image 看如上源代码可以看到,当externalLink不为对象或者externalLink['markdown_css']不为函数时codeStyle才起作用 因此可以修改 externalLink 里面的 markdown_css 配置 markdown_css: false,

mmd0308 commented 5 years ago

image 看如上源代码可以看到,当externalLink不为对象或者externalLink['markdown_css']不为函数时codeStyle才起作用 因此可以修改 externalLink 里面的 markdown_css 配置 markdown_css: false,

使用false就禁用了markdown_css样式,不行的

zong209 commented 5 years ago

image 看如上源代码可以看到,当externalLink不为对象或者externalLink['markdown_css']不为函数时codeStyle才起作用 因此可以修改 externalLink 里面的 markdown_css 配置 markdown_css: false,

使用false就禁用了markdown_css样式,不行的

那你试着把&&typeof ...的删掉,再重新编译一下mavonEditor;或者可以另外加载markdown_css,我这边就是因为另一个插件引入了,所以没造成影响.

mmd0308 commented 5 years ago

image 看如上源代码可以看到,当externalLink不为对象或者externalLink['markdown_css']不为函数时codeStyle才起作用 因此可以修改 externalLink 里面的 markdown_css 配置 markdown_css: false,

使用false就禁用了markdown_css样式,不行的

那你试着把&&typeof ...的删掉,再重新编译一下mavonEditor;或者可以另外加载markdown_css,我这边就是因为另一个插件引入了,所以没造成影响.

准备这么干

re1oaded commented 4 years ago

image 看如上源代码可以看到,当externalLink不为对象或者externalLink['markdown_css']不为函数时codeStyle才起作用 因此可以修改 externalLink 里面的 markdown_css 配置 markdown_css: false,

使用false就禁用了markdown_css样式,不行的

那你试着把&&typeof ...的删掉,再重新编译一下mavonEditor;或者可以另外加载markdown_css,我这边就是因为另一个插件引入了,所以没造成影响.

准备这么干

怎么样?

payonesmile commented 4 years ago

在网站头部另外引入: link rel="stylesheet" href="https://cdn.bootcss.com/github-markdown-css/2.9.0/github-markdown.min.css"

把markdown_css:设置为false

externalLink:{ markdown_css: false, //false后 highlight 才生效,在head中引用 markdown_css hljs_js: function() { return 'https://cdn.bootcss.com/highlight.js/9.12.0/highlight.min.js'; }, hljs_lang: function(lang) { return 'https://cdn.bootcss.com/highlight.js/9.12.0/languages/' + lang + '.min.js'; }, hljs_css: function(css) { return 'https://cdn.bootcss.com/highlight.js/9.12.0/styles/' + css + '.min.css'; }, katex_js: function() { return 'https://cdn.bootcss.com/KaTeX/0.8.3/katex.min.js'; }, katex_css: function() { return 'https://cdn.bootcss.com/KaTeX/0.8.3/katex.min.css'; } },