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
@ -201,8 +201,7 @@ function pushMessage(args) {
|
|||||||
textEl.textContent = args.text || '';
|
textEl.textContent = args.text || '';
|
||||||
textEl.innerHTML = textEl.innerHTML.replace(/(\?|https?:\/\/)\S+?(?=[,.!?:)]?\s|$)/g, parseLinks);
|
textEl.innerHTML = textEl.innerHTML.replace(/(\?|https?:\/\/)\S+?(?=[,.!?:)]?\s|$)/g, parseLinks);
|
||||||
|
|
||||||
if ($('#syntax-highlight').checked) {
|
if ($('#syntax-highlight').checked && textEl.textContent.indexOf('#') == 0) {
|
||||||
if (textEl.textContent.indexOf('#') == 0) {
|
|
||||||
var lang = textEl.textContent.split(/\s+/g)[0].replace('#', '');
|
var lang = textEl.textContent.split(/\s+/g)[0].replace('#', '');
|
||||||
var codeEl = document.createElement('code');
|
var codeEl = document.createElement('code');
|
||||||
codeEl.classList.add(lang);
|
codeEl.classList.add(lang);
|
||||||
@ -211,7 +210,6 @@ function pushMessage(args) {
|
|||||||
hljs.highlightBlock(codeEl);
|
hljs.highlightBlock(codeEl);
|
||||||
textEl.innerHTML = '';
|
textEl.innerHTML = '';
|
||||||
textEl.appendChild(codeEl);
|
textEl.appendChild(codeEl);
|
||||||
}
|
|
||||||
} else if ($('#parse-latex').checked) {
|
} else if ($('#parse-latex').checked) {
|
||||||
// Temporary hotfix for \rule spamming, see https://github.com/Khan/KaTeX/issues/109
|
// Temporary hotfix for \rule spamming, see https://github.com/Khan/KaTeX/issues/109
|
||||||
textEl.innerHTML = textEl.innerHTML.replace(/\\rule|\\\\\s*\[.*?\]/g, '');
|
textEl.innerHTML = textEl.innerHTML.replace(/\\rule|\\\\\s*\[.*?\]/g, '');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user