After sharing my struggles with trying to format .NET code on my blog, my co-worker and friend jeff pointed me to this excellent must-have tool for bloggers who post code.
It's a Syntax Highlighter/formatter implemented in javascript so you don't have to mess with the complexity of posting code to your blog anymore. Just wrap your code in a <textarea name="code" class="c#"> and wow! It supports about 12 different languages including, but not limited to C#, VB.Net, SQL, XML.
See examples on my site here on my blog, or see every language sample here on the Syntax Highlighter web site.
3.27.2007
Handy Javascript Syntax Highlighter for Blog Posting
Labels:
blog,
javascript,
syntax,
utilities
Subscribe to:
Post Comments (Atom)


6 comments:
If you use Windows Live Writer to compose blog entries, you could also use the Code Formatter for Windows Live Writer by Steve Dunn. I believe the code formatter does the formatting at composition-time rather than at view-time. It's another option to consider at the very least.
Hi Monty,
I modified my template as said in here
But still my blog looks the same, the SyntaxHighlighter has no effect. I compared your blog source with mine and I dint find much difference. I have no idea on web design and XML, so I am not able to fix this. Could you please help me fix this. This is my blog. Thanks.
Arun - you'll need to add the javascript for C syntax...you've added the one for C#...
Instead of referencing shBrushCSharp.js (C# support) you'll want to use shBrushCpp.js (for C and C++ support).
Indeed, when we refresh the page, the code is flashing on the post and goes off immediately.
Hi Monty, I was using the "pre" tag instead of "textarea" tag.
I just replaced the tag in my post to "textarea" and is working now. Thanks a lot.
Post a Comment