An introduction

This is a semi-public place to dump text too flimsy to even become a blog post. I wouldn't recommend reading it unless you have a lot of time to waste. You'd be better off at my livejournal. I also have another blog, and write most of the French journal summaries at the Eurozine Review.

Why do I clutter up the internet with this stuff at all? Mainly because I'm trying to get into the habit of displaying as much as possible of what I'm doing in public. Also, Blogger is a decent interface for a notebook

Friday, April 15, 2011

Syntax Highighting

Whenever I try to put code snippets up here, I end up frustrated that they turn up deprived of any highlighting. So I've tried following these instructions to fix things. With luck, this post should be an example ;)

So this goes in <head>:




And for the highlighted text you have 2 options.

First is with <pre> tags:


or a slightly more longwinded version, which provides for escaping of html tags:


<script type="syntaxhighlighter" class="brush:html"><![CDATA[ <a href="http://exampe.com/blah">blah</a>]]</script>


This, alas, interacts badly with blogger's pre-posting HTML validation. It's easier to handle the escaping from the command-line beforehand:


$ xclip -o | perl -MHTML::Entities -ne 'print encode_entities($_)' | xclip

No comments:

Post a Comment