Thursday, October 30, 2008
Some suggestions for overcoming the code display problem
You will all have noticed that my attempts at doing indentation in Java code have failed miserably. My chunk in the book fragments blog does not contain this. If you go to the chunk there are some comments there which you might find useful. Many thanks to those who have suggested workarounds. Let me stress its no big deal not having indents in your blog since you will be delivering an MS Word or OpenOffice document to me. The chunk in your blog is to give everyone an idea of what you are writing about.
Subscribe to:
Post Comments (Atom)
1 comment:
If you have a couple of hundred quid to spend, or if there's someone in the dept who likes to tinker with css/js stylesheets, you could probably create a project stylesheet that incorporates one of the progressive enhancement style libraries that automatically colourises code. For example, I've used Syntax Highlighter before, though not in a Blogger blog.
Another, less elaborate approach, is to just use something like quick highlighter - paste in some code, generate the java view, then copy the java css into the Blogger template layout stylesheet you're using (you may need to make a couple of other tweaks to prettify it a little more).
Whenever you want to paste code into the blog, just use the quick highlighter to generate the marked up HTML (the css will already be in the stylesheet) and paste this into your blog post.
A crude example is here, which demonstrates that a few further tweaks need to be made to the stylesheet.
Post a Comment