Rob Garrett - Blogs

Welcome to Rob Garrett - Blogs Sign in | Join | Help
in Search
Google

Software/Technology Discussion

Software and Technology Tid-bits

dp.SyntaxHighlighter

I've just made an update to the version of .TEXT running my blogs to add code syntax highlighting. Rather than write my own, I incorporated dp.SyntaxHighlighter from Dream Projections Inc.

dp.SyntaxHighlighter is a Java script solution, so to get it to work I had to add the right CSS and Java script references in the blog entry pages. Drop me a line if you would like a list of changes.

With code syntax highlighting, source code in my blog now looks like:
dp.SyntaxHighlighter colorizes all code found in textarea tags, marked with a name attribute containing value code. Since RSS viewers will not render textarea tags I added some code to .TEXT to convert these to p tags when requesting blog pages as XML.

The whole thing works pretty well, except when using the design feature of the FreeTextBox control contained in .TEXT edit pages. Switching from HTML to design mode mangles the source code in the textarea tags. Also, any text following code in a textarea tag is not rendered properly when editing.

Solution: Write the entire post without source code, switch to HTML mode and add the code in textarea tags. Copy the HTML to the clipboard and then post without switching to design mode. If the post doesn't look right edits can be made by reusing the HTML on the clipboard.
Share this post: Email it! | bookmark it! | digg it! | reddit!
Published Tuesday, February 08, 2005 10:50 PM by Rob Garrett

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Anton Vishnyak said:

Check out this open source .NET project that colorizes source code...
http://puzzleware.net/codehtmler/
February 12, 2005 5:58 PM

Leave a Comment

(required) 
(optional)
(required) 
Submit

Blurb


Head Shot
Rob Garrett is a British Expat living in Maryland USA. Rob is a trained software engineer and experienced in Windows .NET development.

Rob enjoys listening to Rock music, posting to blogs, driving in the country with the sunroof open, beer (not in conjunction with country driving) and spending time with his family.

This Blog

Syndication

Powered by Community Server, by Telligent Systems