Showing posts with label Posting Code in Blog Posts. Show all posts
Showing posts with label Posting Code in Blog Posts. Show all posts

Monday, 14 June 2010

Syntax Highlighter Success

Finally, I managed to get SyntaxHighlighter working.

I had tried a few things previously, but it seems that some of the tutorials I had seen were based on older versions. The joy arrived when I found this post.

Now I can post code snippets in a way which is actually readable!


SELECT
COUNT(dbid) as TotalConnections
FROM
sys.sysprocesses
WHERE
dbid > 0

Hurrah!

I'm still using Stanley Shilov's utility to escape my HTML so that I can post using these simple tags:


<pre class="brush: html">
</pre>

Thursday, 13 August 2009

Posting Code in Blog Posts

It's a nightmare trying to post any code in Blog posts. The tags confuse Blogger (fair enough) so if it happens, it won't let you post the code.

I tried to install SyntaxHiglighter from Google, but it requires you to host its code on a webserver somewhere and I couldn't get it to work.

Stanley Shilov came up with a nice alternative online tool which you can paste your code into, and it will parse it and replace any characters which will confuse your blogging engine with HTML tags which it'll love. You can access the tool here, and it needs zero set up and zero hassle.

The drawback is that it doesn't offer any syntax highlighting, but it's still useful and I'll certainly be using it in future!