Saltycrane logo

SaltyCrane Blog

Notes on Python, Django, and web development on Ubuntu Linux

    

How to get syntax highlighting in Blogger with Pygments

  • $ sudo easy_install Pygments
  • $ pygmentize -f html myscript.py
  • copy html code to blog post
  • $ pygmentize -S default -f html
  • copy css to Blogger template

The Pygments website is located at: http://pygments.org

Update 5/21/2008: Andrew K. emailed me about a javascript syntax highlighter called highlight.js at http://softwaremaniacs.org/soft/highlight/en/. I have not tried it, but it looks pretty cool.

5 Comments — feed icon Comments feed for this post


#1 Felix commented on 2009-06-04:

Hey wow, so I wasn't the first one to think of that! :P

Anyway, I coded a little web app to help people use Pygments on their blog, you can check it out in my "website". I also wrote a blog post about making it, link is in the about section of the site, if you're interested. I would really like your opinion on the app :)


#2 Eliot commented on 2009-06-04:

Felix, that's great you built a Pygments web app. I tried to get to your site (http://pygmentool.mine.nu/) but I got a Network Timeout.


#3 Felix commented on 2009-06-05:

Ah, sorry about that. It seems my mother vacuumed around and unplugged my server :. Anyway, it's back up now and you should be able to use it :-)


#4 Eliot commented on 2009-06-05:

heh, that's classic. =)

your tool works well. nice job!


#5 Nate commented on 2009-07-22:

Where exactly do I dump the css code on Blogger.com...?

:( Sorry I am confused.

Post a comment

Required
Required, but not displayed
Optional

Format using Markdown. (No HTML.)
  • Code blocks: prefix each line by at least 4 spaces or 1 tab (and a blank line before and after)
  • Code span: surround with backticks
  • Blockquotes: prefix lines to be quoted with >
  • Links: <URL>
  • Links w/ description: [description](URL)
Created with Django | Hosted by Slicehost