Syntax Highlighting Revisited: SnippetCompiler.

0 comments suggest edit

CompilerRegarding Syntax Highlighting, Daniel Turini pointed out that SnippetCompiler has the ability to export code to the clipboard (and to a file) as HTML.

Snippet Compiler has a lot of nice features and is a welcome addition to my toolbox, but purely for syntax highlighting, it has a few disadvantages compared to the website I mentioned previously. First of all, although you can view snippets with line numbers, the line numbers aren’t exported to HTML like Manoli does. Secondly, Manoli handles XML/HTML along with C# and VB, while SnippetCompiler seems to do well only with C# and VB.NET. Lastly, Manoli uses CSS for styling and you can have it embed the CSS definitions in the generated HTML, or reference the provided stylesheet. This is a really nice feature.

One thing I do like about the SnippetCompiler is how the summary tags in the comments are gray while the actual comment is green. That’s a nice touch.


///Manages cool things
public class ThisIsSoCool
    /// This is seriously neat. 
    public void YouShouldTryThis()
Found a typo or error? Suggest an edit! If accepted, your contribution is listed automatically here.



5 responses

  1. Avatar for Noah Coad (C# MVP)
    Noah Coad (C# MVP) June 17th, 2004

    Syntax highlighting in blogs has been a journey for me. I started copy-pasting from Word which was messy so was abandoned. Then I needed a programmatic interface for parsing the code from my own blog posting application, NovaBlog. CodeHighligher from Actipro Software is a free ASP.NET based solution which allows copy-pasting, custom coloring, and code access.

    CodeHighligher by Actipro Software:

    NovaBlog is Born for One-Touch Blogging:

    Moving Away from Word Based Blogs:

    Well Formatted Blog, Can't Directly Copy from MS Word:

  2. Avatar for Noah Coad (C# MVP)
    Noah Coad (C# MVP) June 17th, 2004

    If you are using VS.NET 2003, you may find this CoadTools Quick Test C# Project Template for VS.NET 2003 to be useful. It is just a small "New Project" template for VS.NET 2003 specifically for small code tests.

  3. Avatar for Jonathan de Halleux
    Jonathan de Halleux June 17th, 2004


    If you are interrested, I have written this syntax highlighter in jscript ( and ported it to C# ( It can render C#, VB, xml, C, C++.

    The grammars are entierly written in xml and the rendering is done through xsl templates. This makes it very easy to edit and customize.


  4. Avatar for Jeff Key
    Jeff Key June 18th, 2004

    The Export to HTML option is handled entirely by the syntax editor control, so I really don't have control of it. I'm trying to get my hands on a better one, but if that doesn't work out I'll add an extensibility point so people can write add-ins to use whatever highlighter they'd like.

    Regarding the [X|HT]ML: I've already added pluggable languages, which include custom syntax highlighting, so you could add a [X|HT]ML "language" that would do do proper syntax highlighting. I haven't released this yet[1], so for it in the next version.

    [1] While writing the language add-in model I lost my mind and started writing a Commodore 64 BASIC.NET compiler. Once I remove my head from my ass I'll release the new version.

  5. Avatar for Pavel Vladov
    Pavel Vladov October 1st, 2012

    Nice article! Thanks for sharing. If you need a free online C# syntax highlighting service that colorizes C# code like Visual Studio and produces HTML ready to be inserted in a website or blog take a look at:
    Free Online C# Code Colorizer