aboutsummaryrefslogtreecommitdiffstats
path: root/client/client.js
diff options
context:
space:
mode:
authorNeel Kamath <neelkamath@pop-os.localdomain>2018-05-17 18:34:14 +0200
committerNeel Kamath <neelkamath@pop-os.localdomain>2018-05-17 18:34:14 +0200
commitebe187463daeee9ab729868e2739b94ca5aedf77 (patch)
tree1ef4cbf18b7f5de3e8b559f03ffba3abb7c974ee /client/client.js
parentUpdate for #14 (diff)
downloadhackchat-ebe187463daeee9ab729868e2739b94ca5aedf77.tar.gz
hackchat-ebe187463daeee9ab729868e2739b94ca5aedf77.zip
Again
Diffstat (limited to 'client/client.js')
-rw-r--r--client/client.js20
1 files changed, 9 insertions, 11 deletions
diff --git a/client/client.js b/client/client.js
index bc16721..53f2856 100644
--- a/client/client.js
+++ b/client/client.js
@@ -201,17 +201,15 @@ 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) {
- var lang = textEl.textContent.split(/\s+/g)[0].replace('#', '');
- var codeEl = document.createElement('code');
- codeEl.classList.add(lang);
- var content = textEl.textContent.replace('#' + lang, '');
- codeEl.textContent = content.trim();
- hljs.highlightBlock(codeEl);
- textEl.innerHTML = '';
- textEl.appendChild(codeEl);
- }
+ 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);
+ var content = textEl.textContent.replace('#' + lang, '');
+ codeEl.textContent = content.trim();
+ 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, '');