Last active
March 3, 2016 11:07
-
-
Save TheCodeDestroyer/3bc2b3b371db96e02245 to your computer and use it in GitHub Desktop.
CJS code for highlighting syntax
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.2.0/highlight.min.js | |
$('head').append('<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.2.0/styles/default.min.css">'); | |
$(document).click(function(event){ | |
var hljsSelector = 'pre'; | |
setTimeout(function() { | |
if($(document).has(hljsSelector).length > 0) { | |
var codeBlockSelector = hljsSelector + ' code'; | |
if($(document).has(codeBlockSelector).length > 0) { | |
hljsSelector = codeBlockSelector; | |
} | |
$(hljsSelector).each(function (i, block) { | |
hljs.highlightBlock(block); | |
}); | |
} | |
}, 200); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment