I have a Tumblr-managed blog, on which I post a lot of Python-related posts. How do I make the Python snippets in my posts show color-coded?
If you have too many, I would say go for google-code-prettify.
Check some examples and here is the setup:
- Download a distribution
- Include the script and stylesheets in your document (you will need to make sure the css and js file are on your server, and adjust the paths in the script and link tag)
<link href="prettify.css" type="text/css" rel="stylesheet"/>
- Add onload="prettyPrint()" to your document's body tag.
- Modify the stylesheet to get the coloring you prefer
You can use hilite.me
hilite.me converts your code snippets into pretty-printed HTML format, easily embeddable into blog posts, emails and websites.
I use Github's gist to do this. Paste in and create the gist and you can then embed them in any web page including tumblr.