Skip to content

Commit

Permalink
Handle all code blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
OxCom authored Oct 18, 2018
1 parent e270a67 commit 74040bb
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions styles/all/template/js/init.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
$(function() {
$(function () {
hljs.configure({
useBR: true,
tabReplace: ' ' // 4 spaces
});
$('code[data-bind="phpbbch-code"]').each(function (i, block) {
hljs.highlightBlock(block);
});

$('code')
.each(function (i, block) {
if ($(block).data('bind') !== 'phpbbch-code') {
var content = $(block).html();

content = content.replace(/(?:\r\n|\r|\n)/g, '<br>');
$(block).html(content);
}

hljs.highlightBlock(block);
});
});

0 comments on commit 74040bb

Please sign in to comment.