avatar

professional geek ramblings
est. 2003
About

It has begun or Does size really matter?

I finally decided on a name for my project - PostModern. I had already gotten syntax highlighting worked out, but I ended up using a different component than I had originally planned. I'm using a component from SquishyWare called squishySyntaxHighlighter. It's really nice...simple, easy to modify, and it looks pretty spiffy too.

So here's the thing. It creates a little bit of markup by using [span style=] tags where you would expect coloration, so if you're posting any sizeable amount of code, it can get bloated. (That's why I put the second part of the title in there, you nasty nelly you!)

I've found that it's a little bit difficult, if possible at all, to grab the selected text in the HtmlComponent that I'll probably be using, so a drawback of syntax highlighting is that you'll more than likely have to do it from the [html] tab that we're all so familiar with. Also, I've found that the HtmlComponent (and others too, so it must be a mshtml thing) will colorize text pasted from Visual Studio. Here's the difference:

[pasted directly into the design surface]
using System;

namespace HighlightTest

{

///

/// Summary description for SampleCs.

///

public class SampleCs

{

public SampleCs()

{

//

// TODO: Add constructor logic here

//

}

public void DoSomething( string s ) {

if( s == "string literal" ) {

return;

}

}

#region This is a Region

private void DoSomethingElse( int i ) {

int x = i;

}

#endregion

}

}

 [using the SyntaxHighlighter]

1using System;
2
3namespace HighlightTest
4{
5	/// 
6	/// Summary description for SampleCs.
7	/// 
8	public class SampleCs
9	{
10		public SampleCs()
11		{
12			//
13			// TODO: Add constructor logic here
14			//
15		}
16
17		public void DoSomething( string s ) {
18			if( s == "string literal" ) {
19				return;
20			}
21		}
22
23		#region This is a Region
24		
25		private void DoSomethingElse( int i ) {
26			int x = i;
27		}
28		#endregion
29	}
30}
31

So there's a little bit more work to go thru, but the end result is that it's already formatted the way I like. What do you think about that?