mirror of https://github.com/status-im/codimd.git
Update to support wiki markup syntax highlighting in view using prism
This commit is contained in:
parent
42145e4019
commit
23008bc1e1
|
@ -58,7 +58,8 @@
|
|||
"visibilityjs": "^1.2.3",
|
||||
"pdfobject": "pdfobject2#*",
|
||||
"gist-embed": "*",
|
||||
"keymaster": "^1.6.3"
|
||||
"keymaster": "^1.6.3",
|
||||
"prism": "^1.5.1"
|
||||
},
|
||||
"resolutions": {
|
||||
"jquery": "~3.1.0"
|
||||
|
|
|
@ -755,11 +755,17 @@ function highlightRender(code, lang) {
|
|||
return '<div class="mermaid raw">' + code + '</div>';
|
||||
}
|
||||
var reallang = lang.replace(/\=$|\=\d+$|\=\+$/, '');
|
||||
var languages = hljs.listLanguages();
|
||||
if (languages.indexOf(reallang) == -1) {
|
||||
var result = hljs.highlightAuto(code);
|
||||
if (reallang == "tiddlywiki" || reallang == "mediawiki") {
|
||||
var result = {
|
||||
value: Prism.highlight(code, Prism.languages.wiki)
|
||||
};
|
||||
} else {
|
||||
var result = hljs.highlight(reallang, code);
|
||||
var languages = hljs.listLanguages();
|
||||
if (languages.indexOf(reallang) == -1) {
|
||||
var result = hljs.highlightAuto(code);
|
||||
} else {
|
||||
var result = hljs.highlight(reallang, code);
|
||||
}
|
||||
}
|
||||
var showlinenumbers = /\=$|\=\d+$|\=\+$/.test(lang);
|
||||
if (showlinenumbers) {
|
||||
|
|
|
@ -50,6 +50,8 @@
|
|||
<script src="<%- url %>/vendor/xss/dist/xss.min.js" defer></script>
|
||||
<script src="<%- url %>/vendor/string/dist/string.min.js" defer></script>
|
||||
<script src="<%- url %>/vendor/highlightjs/highlight.pack.min.js" defer></script>
|
||||
<script src="<%- url %>/vendor/prism/prism.js" defer></script>
|
||||
<script src="<%- url %>/vendor/prism/components/prism-wiki.min.js" defer></script>
|
||||
<script src="<%- url %>/vendor/js-cookie/src/js.cookie.js" defer></script>
|
||||
<script src="<%- url %>/vendor/handlebars/handlebars.min.js" defer></script>
|
||||
<script src="<%- url %>/vendor/emojify/js/emojify.min.js" defer></script>
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
<link rel="stylesheet" href="<%- url %>/vendor/codemirror/mode/mediawiki/mediawiki.css">
|
||||
<link rel="stylesheet" href="<%- url %>/css/github-extract.css">
|
||||
<link rel="stylesheet" href="<%- url %>/vendor/highlightjs/styles/github-gist.css">
|
||||
<link rel="stylesheet" href="<%- url %>/vendor/prism/themes/prism.css">
|
||||
<link rel="stylesheet" href="<%- url %>/vendor/emojify/css/emojify.min.css">
|
||||
<link rel="stylesheet" href="<%- url %>/vendor/showup/showup.css">
|
||||
<link rel="stylesheet" href="<%- url %>/css/mermaid.css">
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
<link rel="stylesheet" href='<%- url %>/css/github-extract.css'>
|
||||
<link rel="stylesheet" href='<%- url %>/css/gist.css'>
|
||||
<link rel="stylesheet" href='<%- url %>/vendor/highlightjs/styles/github-gist.css'>
|
||||
<link rel="stylesheet" href="<%- url %>/vendor/prism/themes/prism.css">
|
||||
<link rel="stylesheet" href="<%- url %>/css/mermaid.css">
|
||||
<link rel="stylesheet" href='<%- url %>/css/markdown.css'>
|
||||
<link rel="stylesheet" href='<%- url %>/vendor/emojify/css/emojify.min.css'>
|
||||
|
@ -115,6 +116,8 @@
|
|||
<script src="<%- url %>/vendor/gist-embed/gist-embed.min.js" defer></script>
|
||||
<script src="<%- url %>/vendor/string/dist/string.min.js" defer></script>
|
||||
<script src="<%- url %>/vendor/highlightjs/highlight.pack.min.js" defer></script>
|
||||
<script src="<%- url %>/vendor/prism/prism.js" defer></script>
|
||||
<script src="<%- url %>/vendor/prism/components/prism-wiki.min.js" defer></script>
|
||||
<script src="<%- url %>/vendor/js-cookie/src/js.cookie.js" defer></script>
|
||||
<script src="<%- url %>/vendor/emojify/js/emojify.min.js" defer></script>
|
||||
<script src="<%- url %>/vendor/raphael/raphael.min.js" defer></script>
|
||||
|
|
Loading…
Reference in New Issue