diff options
author | Wu Cheng-Han | 2016-09-18 16:42:27 +0800 |
---|---|---|
committer | Wu Cheng-Han | 2016-09-18 16:42:27 +0800 |
commit | 23008bc1e152998aec0c5b74ac20b1c10c12a386 (patch) | |
tree | 0962c4d71f300c705d0acecb91fd5e49c213d593 /public/js | |
parent | 42145e401983994d813ce0bf0ea775e6473a070e (diff) |
Update to support wiki markup syntax highlighting in view using prism
Diffstat (limited to 'public/js')
-rw-r--r-- | public/js/extra.js | 14 |
1 files changed, 10 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) { |