Pages

Thursday 20 November 2014

Hello to SyntaxHighlighter

I am trying to check if I can make SyntaxHighlighter work on my blog. This would really help me in a number of future blogposts.

#include <iostream>

int main()
{
     std::cout << "Hello SyntaxHighlighter" << std::endl;
     return 0;
}
I use html encode from here to encode the < > characters as they conflict with the HTML Tag Syntax . The code is copied directly into HTML code for this post using the <pre> Tag as:
 
<pre class="brush:cpp">
#include <iostream>

int main()
{
std::cout << "Hello SyntaxHighlighter" << std::endl;

return 0;
}
</pre>


This is very useful and I think I will try to update all my codes in previous posts with this.
Source: http://www.craftyfella.com/2010/01/syntax-highlighting-with-blogger-engine.html