From 23008bc1e152998aec0c5b74ac20b1c10c12a386 Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Sun, 18 Sep 2016 16:42:27 +0800 Subject: Update to support wiki markup syntax highlighting in view using prism --- public/js/extra.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'public/js') 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 '
' + code + '
'; } 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) { -- cgit v1.2.3