<p>I want to highlight C/C++/Java/C# etc source codes in my website.</p>

<p>How can I do this?</p>

<p>Is it a CPU intensive job to highlight the source code?</p>

[{'answer_id': 70182, 'author': 'Brad Wilson', 'author_id': 1554, 'author_profile': 'https://Stackoverflow.com/users/1554', 'pm_score': 0, 'selected': False, 'text': '<p>I use <a href="http://code.google.com/p/syntaxhighlighter/wiki/Usage" rel="nofollow noreferrer">SyntaxHighligher</a> on <a href="http://bradwilson.typepad.com" rel="nofollow noreferrer">my blog</a>.</p>\n'}, {'answer_id': 70185, 'author': 'DJ Capelis', 'author_id': 10943, 'author_profile': 'https://Stackoverflow.com/users/10943', 'pm_score': 0, 'selected': False, 'text': '<p>Just run it through a tool like: <a href="http://www.gnu.org/software/src-highlite/" rel="nofollow noreferrer">http://www.gnu.org/software/src-highlite/</a></p>\n'}, {'answer_id': 70193, 'author': 'Paul Dixon', 'author_id': 6521, 'author_profile': 'https://Stackoverflow.com/users/6521', 'pm_score': 4, 'selected': False, 'text': '<p>I use <a href="http://qbnz.com/highlighter/" rel="noreferrer">GeSHi</a> ("Generic Syntax Highlighter") on <a href="http://pastebin.com" rel="noreferrer">pastebin.com</a></p>\n\n<p>pastebin has high traffic, so I do cache the results of the transformation, which certainly reduces the load.</p>\n'}, {'answer_id': 70204, 'author': 'Daniel Spiewak', 'author_id': 9815, 'author_profile': 'https://Stackoverflow.com/users/9815', 'pm_score': 6, 'selected': True, 'text': '<p>You can either do this server-side or client-side.  It\'s not very processor intensive, but if you do it client side (using Javascript) there will be a noticeable lag.  Most client side solutions revolve around Google Code\'s syntax highlighting engine.  This seems to be the most popular one: <a href="http://alexgorbatchev.com/SyntaxHighlighter/" rel="nofollow noreferrer">SyntaxHighlighter</a></p>\n\n<p>Server-side solutions tend to be more flexible, especially in the way of defining new languages and configuring how they are highlighted (e.g. colors used).  I use GeSHi, which is a PHP solution with a moderately nice plugin for Wordpress.  There are also a few libraries built for Java, and even some that are based upon VIM (usually requiring a Perl module to be installed from CPAN).</p>\n\n<p>In short: you have quite a few options, what are your criteria?  It\'s hard to make a solid recommendation without knowing your requirements.</p>\n'}, {'answer_id': 70209, 'author': 'Mark Embling', 'author_id': 6844, 'author_profile': 'https://Stackoverflow.com/users/6844', 'pm_score': 0, 'selected': False, 'text': '<p>If you are using PHP, you can use <a href="http://qbnz.com/highlighter/" rel="nofollow noreferrer">GeSHi</a> to highlight many different languages. I\'ve used it before and it works quite well. A quick googling will also uncover GeSHi plugins for <a href="http://wordpress.org/extend/plugins/wp-syntax/" rel="nofollow noreferrer">wordpress</a> and <a href="http://drupal.org/project/geshifilter" rel="nofollow noreferrer">drupal</a>.</p>\n\n<p>I wouldn\'t consider highlighting to be CPU intensive unless you are intending to display megabytes of it all at once. And even then, the CPU load would be minimal and your main problem would be transfer speed for it all.</p>\n'}, {'answer_id': 70252, 'author': 'Kristof Neirynck', 'author_id': 11451, 'author_profile': 'https://Stackoverflow.com/users/11451', 'pm_score': 3, 'selected': False, 'text': '<p>I use <a href="https://github.com/google/code-prettify" rel="nofollow noreferrer">google-code-prettify</a>. It is the simplest to set up and works great with all C-style languages.</p>\n'}, {'answer_id': 70257, 'author': 'Stacker', 'author_id': 6574, 'author_profile': 'https://Stackoverflow.com/users/6574', 'pm_score': 3, 'selected': False, 'text': '<p><a href="http://pygments.org/" rel="noreferrer">Pygment</a> is a good Python library to generate HTML, RTF, ANSI (terminal-style) or LaTeX code. It supports a <a href="http://pygments.org/languages/" rel="noreferrer">large range of languages</a> (C, C++, Lua, Erlang, ...) and you can even write your own output formatter.</p>\n'}, {'answer_id': 1618376, 'author': 'PhiLho', 'author_id': 15459, 'author_profile': 'https://Stackoverflow.com/users/15459', 'pm_score': 3, 'selected': False, 'text': "<p>Personally, I prefer offline tools: I don't see the point of parsing the code (particularly large ones) over and over, for each served page, or even worse, on each browser (for JS libraries), because as pointed above, these libraries often lag (you often see raw source before it is formatted).</p>\n\n<p>There are a number of tools to do this job, some pointed above. I just use the export feature of my favorite editor (SciTE) because it just respects the choices of color I carefully set up... :-) And it can output XML, PDF, RTF and LaTeX too.</p>\n"}, {'answer_id': 9382633, 'author': 'Javier', 'author_id': 1117429, 'author_profile': 'https://Stackoverflow.com/users/1117429', 'pm_score': 1, 'selected': False, 'text': '<p>If you use <a href="http://jedit.org/" rel="nofollow">jEdit</a>, you might want to use the <a href="http://plugins.jedit.org/plugins/?Code2HTML" rel="nofollow">Code2HTML</a> plugin.</p>\n'}]
['https://Stackoverflow.com/questions/70169', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/184/']