summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorWu Cheng-Han2016-09-18 16:42:27 +0800
committerWu Cheng-Han2016-09-18 16:42:27 +0800
commit23008bc1e152998aec0c5b74ac20b1c10c12a386 (patch)
tree0962c4d71f300c705d0acecb91fd5e49c213d593 /public
parent42145e401983994d813ce0bf0ea775e6473a070e (diff)
Update to support wiki markup syntax highlighting in view using prism
Diffstat (limited to 'public')
-rw-r--r--public/js/extra.js14
-rw-r--r--public/views/foot.ejs2
-rw-r--r--public/views/head.ejs1
-rw-r--r--public/views/pretty.ejs3
4 files changed, 16 insertions, 4 deletions
diff --git a/public/js/extra.js b/public/js/extra.js
index 8fa99ce2..77f298f9 100644
--- a/public/js/extra.js
+++ b/public/js/extra.js
@@ -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) {
diff --git a/public/views/foot.ejs b/public/views/foot.ejs
index c1197605..9fa79d55 100644
--- a/public/views/foot.ejs
+++ b/public/views/foot.ejs
@@ -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>
diff --git a/public/views/head.ejs b/public/views/head.ejs
index 5fed27be..5d8e44b6 100644
--- a/public/views/head.ejs
+++ b/public/views/head.ejs
@@ -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">
diff --git a/public/views/pretty.ejs b/public/views/pretty.ejs
index 1de3610c..2546b1ac 100644
--- a/public/views/pretty.ejs
+++ b/public/views/pretty.ejs
@@ -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>