summaryrefslogtreecommitdiffstats
path: root/js/field.js
diff options
context:
space:
mode:
authorAlbert Ting <altlist@gmail.com>2016-07-06 22:47:46 +0200
committerDylan William Hardison <dylan@hardison.net>2016-07-06 22:57:41 +0200
commit3f75ddd65da6a5753fa90b429ed6f43b4eeae088 (patch)
treecc1ad97a6bd0907fb91717b1bc88e3a8f8cb5191 /js/field.js
parentc844a29d89b0fd5841e0020ec62a206c319f25ba (diff)
downloadbugzilla-3f75ddd65da6a5753fa90b429ed6f43b4eeae088.tar.gz
bugzilla-3f75ddd65da6a5753fa90b429ed6f43b4eeae088.tar.xz
Bug 1203960 - Add syntax highlighting to markdown
r=dylan Initial implementation by Koosha KM <koosha.khajeh@gmail.com>
Diffstat (limited to 'js/field.js')
-rw-r--r--js/field.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/js/field.js b/js/field.js
index 063d48c47..5ec7574bc 100644
--- a/js/field.js
+++ b/js/field.js
@@ -949,6 +949,14 @@ function show_comment_preview(bug_id, refresh) {
last_comment_text = comment.value;
last_markdown_cb_value = markdown_cb.checked;
}
+ if (markdown_cb.checked) {
+ var pres = document.getElementById('comment_preview_text').getElementsByTagName("pre");
+ for (var i = 0, l = pres.length; i < l; i++) {
+ if (pres[i].firstChild && pres[i].firstChild.tagName == "CODE") {
+ hljs.highlightBlock(pres[i].firstChild);
+ }
+ }
+ }
},
failure: function(res) {
Dom.addClass('comment_preview_loading', 'bz_default_hidden');