mirror of
https://github.com/hack-chat/main.git
synced 2024-03-22 13:20:33 +08:00
Highlight Hotfix
This commit is contained in:
parent
e64ee88e0f
commit
345dbfec41
@ -36,13 +36,13 @@ function $(query) {
|
||||
function localStorageGet(key) {
|
||||
try {
|
||||
return window.localStorage[key]
|
||||
} catch(e) {}
|
||||
} catch(e) { }
|
||||
}
|
||||
|
||||
function localStorageSet(key, val) {
|
||||
try {
|
||||
window.localStorage[key] = val
|
||||
} catch(e) {}
|
||||
} catch(e) { }
|
||||
}
|
||||
|
||||
var ws;
|
||||
@ -201,8 +201,7 @@ function pushMessage(args) {
|
||||
textEl.textContent = args.text || '';
|
||||
textEl.innerHTML = textEl.innerHTML.replace(/(\?|https?:\/\/)\S+?(?=[,.!?:)]?\s|$)/g, parseLinks);
|
||||
|
||||
if ($('#syntax-highlight').checked) {
|
||||
if (textEl.textContent.indexOf('#') == 0) {
|
||||
if ($('#syntax-highlight').checked && textEl.textContent.indexOf('#') == 0) {
|
||||
var lang = textEl.textContent.split(/\s+/g)[0].replace('#', '');
|
||||
var codeEl = document.createElement('code');
|
||||
codeEl.classList.add(lang);
|
||||
@ -211,7 +210,6 @@ function pushMessage(args) {
|
||||
hljs.highlightBlock(codeEl);
|
||||
textEl.innerHTML = '';
|
||||
textEl.appendChild(codeEl);
|
||||
}
|
||||
} else if ($('#parse-latex').checked) {
|
||||
// Temporary hotfix for \rule spamming, see https://github.com/Khan/KaTeX/issues/109
|
||||
textEl.innerHTML = textEl.innerHTML.replace(/\\rule|\\\\\s*\[.*?\]/g, '');
|
||||
|
Loading…
x
Reference in New Issue
Block a user