Totally simple syntax highlighting in Blogger
Sometime you don’t need to host code, you just want to post it in a blog post. Google Code Prettify (archive.org) does this really well, either per post, or across the blog.
1. Copy the script tag.
Here’s what you need to copy into either your template, or into your post:
<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"
></script>
2. HTML-encode your code
There are a bunch of HTML encoders (archive.org) online, I haven’t found one that I’m really a fan of. They all do what they’re supposed to do, since it’s trivial.
3. Copy & paste the code into a PRE element
Copy and paste the following, then copy & paste your HTML encoded code into it.
<pre class="prettyprint">
(code comes here)
</pre>
Done!
Update in 2021: You may notice this is no longer running on Blogger, and no longer using this code.
Comments / questions
There's currently no commenting functionality here. If you'd like to comment, please use Bluesky and mention me there: @johnmu.com. Thanks!