2012-06-02

Code in Blogger

To post code in Blogger I integrated SyntaxHighlighter based on a post of CraftyFella. I think it looks great and has just the right ease to use. For example check out how it leaves out the line numbers and gutter upon code-selection. However I am not a fan of its fondness for vertical scrollbars where they are not needed. So I added the following snipped to the blogger stylesheet to supress those.
.syntaxhighlighter{
  /* padding top/bottom 1em & left/right no padding */
  padding: 1em 0;
}
Put that within the area that keeps the CSS. Directly beneath the Heading "Content" for example.

Without it your code-blocks will look like this:
  /* 
    the vertical scrollbar looks silly, doesn't it? 
  */
On a side-note I would like to recommend reading the SyntaxHighlighter Configuration-Page which is short and helpful. I used the "class"-feature to switch the vertical-scrollbar back on by setting padding to zero. I particularly like the highlight-feature. You may also want to turn off the upper right attributation-questionmark with "toolbar:false".

No comments:

Post a Comment