SaltyCrane Blog — Notes on JavaScript and web development

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.

Comments


#1 Felix commented on :

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 :

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 :

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 :

heh, that's classic. =)

your tool works well. nice job!


#5 Nate commented on :

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

:( Sorry I am confused.


#6 silviud commented on :

Hi,

Thanks - works great !