SyntaxHighlighter for .NET problems fixed
Update: I should have proofread this first…my original intent was to just post about the problems; but after writing about them I decided to pack up a new release but I didn’t change the text to acknowledge that.
Looking back at the previous post I noticed I wasn’t very clear in how to use it. And I’ve also squashed some killer bugs with a ton of help from Nish.
In particular, it would ignore the language specification in a pre block unless the language is in quotes (“”); breaking compatibility with the PHP version. There were also a couple bugs dealing with how comments were handled; one was a simple copy/paste error on my part where instead of looking for block comments it looked for line comments again. The other is more sinister in that the sorting routines between PHP and .NET differ enough that the same same sorting routine will work fine in PHP but cause an infinite loop in .NET.
Both are now fixed.
The demo application has been cleaned up a bit; and the base code is now more forgiving of multiple language registrations and handling unregistered languages.
To use the demo application put the files you want to highlight into a directory with a “.src” extension. Run the ConsoleDemo.exe program with the directory name as the only paramter (or set your current directory to the same place the source files are and run it). The highlighted versions will be written out with the same name, but with a “.html” extension.
Once its done it will spit out some very basic stats: the number of bytes output, total time taken, and average time taken.
Download links follow:
SyntaxHighlighter.zip – Demo application (10KB)
SyntaxHighlighter_src.zip – Source code (15KB)
Nish is starting to use this on his regular website now so as long as it doesn’t completely thrash his site my next goal is going to be the ASP.NET control.
I haven’t uploaded the updated site yet – but it works okay on my local copy
Great stuff, Jambo!
Nish
July 13, 2005 at 7:04 am
[...] I just installed SyntaxHighlighter for .NET written by Jambo Johnson (Mr .NET) on my website, and now the articles on my site have syntax colorization for the code snippets – just as in my blog. My blog uses Jambo’s WordPress colorizer plugin developed in PHP and this new .NET colorizer is a .NET port of the PHP version, though Jambo has re-done the entire design. To add any new language, you just need to add a new language template (very easy to do); in fact Jambo gave me just his C# and plain text language templates, and it took me less than 15 minutes to generate a C++ language template (this time I have decided to use a single template for native C++, Managed C++ and C++/CLI). Anyway, please feel free to check out the now syntax colorized articles here :- Nish’s Articles. Thanks goes to Jambo for developing a really awesome component – BTW, he has plans of writing an ASP.NET web control wrapping the colorizer that you can just drag/drop into your ASP.NET web-application projects, so those of you who want it can keep reminding him frequently till he succumbs to pressure • • • [...]
void Nish(char* szBlog);»Blog Archive » Mr .NET colorized my articles!
July 14, 2005 at 4:56 am