7
votes

I'm writing blog posts for my company blog and I would like code snippets to show up with syntax highlighting.

All I can do is write html/css.

Is there any app/webapp that will let me paste in a c++ code snippet and get a chunk of html with the highlighting?

4

4 Answers

10
votes

Try this Online syntax highlighting Site, and especially the C++ section.

You paste in your code and it does the hard work.

1
votes

I use emacs M-Xhtmlize-bufferRET. Also enscript is very powerful to generate colorized HTML from many source code formats.

1
votes

For others looking for a solution to this problem - you should checkout:

http://oneqonea.blogspot.com/2012/04/how-do-i-add-syntax-highlighting-to-my.html

It's a really easy "SyntaxHighlighter for Blogger" tutorial with screenshots and everything.

You should be up and running in only a few minutes.

Also, for your C++ application, make sure you have the shBrushCpp.js library referenced in your <head></head> section like this:

<head>
    <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCpp.js' type='text/javascript'/>
</head>
0
votes

Have a look at http://www.syntaxhighlight.com - supporting 222 languages. Paste your code and get the formatted html.