mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 09:46:30 -05:00
Fix code block highlighting html not escaped when no languages specified
This commit is contained in:
parent
5e72a69d18
commit
fe912f73ec
1 changed files with 5 additions and 2 deletions
|
@ -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)
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue