diff options
author | Wu Cheng-Han | 2016-10-17 17:54:58 +0800 |
---|---|---|
committer | Wu Cheng-Han | 2016-10-17 17:54:58 +0800 |
commit | fe912f73ecaaca340dca049dc5eb79c056cd8497 (patch) | |
tree | 327cd2a61da2853e095c089cd364ccc1879929e2 /public/js | |
parent | 5e72a69d18ce6a41932a520484ca712822f889b1 (diff) |
Fix code block highlighting html not escaped when no languages specified
Diffstat (limited to 'public/js')
-rw-r--r-- | public/js/extra.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/public/js/extra.js b/public/js/extra.js index bec7fc78..fd22fc80 100644 --- a/public/js/extra.js +++ b/public/js/extra.js @@ -449,13 +449,16 @@ function finishView(view) { var langDiv = $(value).find('code.hljs'); if (langDiv.length > 0) { var reallang = langDiv[0].className.replace(/hljs|wrap/g, '').trim(); - if (!reallang) return; var codeDiv = $(value).find('.code'); var code = ""; if (codeDiv.length > 0) code = codeDiv.html(); else code = langDiv.html(); code = md.utils.unescapeAll(code); - if (reallang == "tiddlywiki" || reallang == "mediawiki") { + if (!reallang) { + var result = { + value: md.utils.escapeHtml(code) + }; + } else if (reallang == "tiddlywiki" || reallang == "mediawiki") { var result = { value: Prism.highlight(code, Prism.languages.wiki) }; |