Monday, April 29, 2013

Posting code in blogger

Alex Gorbatchev created a really awesome syntax highlighter for code. To add it to your blogger:
  1. Click "Template" on your main blogger menu
  2. Click "Edit HTML"
  3. Before "</head>" add the following code
  4. 
    
     
     
     
     
     
     
     
     
     
     
     
     
     
    
    
    Remove all the brush you don't need. Here's a list of all the available brush.
  5. Before "</body>", add the following code

Adding a test post

  1. Create a new post
  2. Click "HTML" on the left hand side to switch to the html view
  3. Enter the following
  4.     /**
         * SyntaxHighlighter
         */
        function foo()
        {
            if (counter <= 10)
                return;
            // it works!
        }
    
  5. Click "Preview" to view the test post
Resource: http://stackoverflow.com/questions/679189/formatting-code-snippets-for-blogging-on-blogger

0 comments:

Post a Comment