Skip to content

Instantly share code, notes, and snippets.

@hexorx
Created November 11, 2012 07:39
Show Gist options
  • Save hexorx/4054088 to your computer and use it in GitHub Desktop.
Save hexorx/4054088 to your computer and use it in GitHub Desktop.
prettify-blogger.js
// based on http://blog.jpillora.com/2012/06/easy-syntax-highlighting-for-blogs.html
(function() {
function jQueryExists() { return typeof jQuery !== 'undefined'; }
//get jquery
if(jQueryExists())
$(window.prettyPrint);
else {
var interval = setInterval(function() {
if (jQueryExists()) {
clearInterval(interval);
$(window.prettyPrint);
}
}, 100);
}
})();
/* Pretty printing styles. Used with prettify.js.
*
* This version is slight modified based on the original version.
*
* Name: Stanley Ng
* Email: stanleyhlng@googlegroups.com
*
* Reference:
* http://code.google.com/p/google-code-prettify/source/browse/trunk/src/prettify.css
*/
.pln {
color: #bd3613; }
.str {
color: #269186; }
.kwd {
color: #859900; }
.com {
color: #586175;
font-style: italic; }
.typ {
color: #b58900; }
.lit {
color: #2aa198; }
.pun {
color: #839496; }
.opn {
color: #839496; }
.clo {
color: #839496; }
.tag {
color: #268bd2; }
.atn {
color: #586175; }
.atv {
color: #2aa198; }
.dec {
color: #268bd2; }
.var {
color: #268bd2; }
.fun {
color: #FF0000; }
/* Put a border around prettyprinted code snippets. */
pre.prettyprint {
background-color: #042029;
padding: 10px;
border: 1px solid #E1E1E8; }
/* Specify class=linenums on a pre to get line numbering */
ol.linenums {
color: #4c666c;
margin: 0 0 0 40px; }
ol.linenums li {
line-height: 18px;
padding-left: 12px; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment