From 1c15fe67c72b4591feaceeffec0951e34a6c2e46 Mon Sep 17 00:00:00 2001 From: clsr Date: Fri, 18 Aug 2017 14:08:04 +0200 Subject: Initial commit --- static/hlraw.js | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 static/hlraw.js (limited to 'static/hlraw.js') diff --git a/static/hlraw.js b/static/hlraw.js new file mode 100644 index 0000000..8d57bb4 --- /dev/null +++ b/static/hlraw.js @@ -0,0 +1,39 @@ +(function() { + 'use strict'; + + var highlight = function(block, lang) { + var langs = lang.split('_'); + if (langs.length > 1) { + lang = langs[langs.length-1]; + } + if (!lang || typeof hljs.getLanguage(lang) === 'undefined') { + return; + } + var hl = hljs.highlight(lang, block.textContent, true); + block.innerHTML = hl.value; + }; + + var highlightAll = function() { + var rawBlocks = document.querySelectorAll('pre.cnm-raw code'); + for (var i=0; i