Blogging code samples stays easy [Update to free ConvertClipboardRtfToHtmlText tool and source code for Visual Studio 2010!]


This blog has moved to a new location and comments have been disabled.

All old posts, new posts, and comments can be found on The blog of dlaa.me.

See you there!

Comments (4)
  1. sameerct says:

    Very elegant solution. Thanks for this.

    I noticed few glitches though… For a code line ‘public partial class’ the output need to have just one span tag specifying the blue color (because all three words are keywords marked in blue color). But your code gives out six span tags (one each for the word and one each for the space in between using the black color).

  2. mrjvdveen says:

    Hi there,

    I’ve build something similar a while back with a WPF UI and templating support (XSLT). Check it out on my blog. It’s called CodeEmbed4Web.

    Another great tool to embed code in blog posts is Live Writer plugin Code Snippet.

    Greets,

    Jonathan

  3. Delay says:

    sameerct,

    Thanks – I’m glad you like it!

    Regarding your feedback about extra spans, other than an initial (possibly blank) span, every span that ConvertClipboardRtfToHtmlText uses is due to a color transition in the RTF source from Visual Studio. In other words, Visual Studio is responsible for the extra stuff and ConvertClipboardRtfToHtmlText just passes it on. :)

    That said, there’s no reason it needs to do so. I’ve thinking about spending a bit more time on this to remove the unnecessary spans and decrease the size of the resulting HTML. Depending on how busy the holidays turn out to be, I may or may not get to this in the next couple of weeks… :)

  4. Delay says:

    mrjvdveen,

    Thanks for sharing – good luck with that!

Comments are closed.