EDAInsight Posted February 19, 2010 Posted February 19, 2010 For some technical forums, syntax highlighting is a key feature. Recently, I find GeSHi is a great product, and have used it in my wikis. I hope it will be integrated in IP.Board 3.1, or act as an extension. BTW, My english is very poor. I hope you have understand what's my meaning.
Mark Posted February 19, 2010 Posted February 19, 2010 We use prettyprint in code boxes <?php $foo = 'bar'; function baz( $p ) { } echo <<<ECHO Hello World! ECHO; ?>
EDAInsight Posted February 19, 2010 Author Posted February 19, 2010 How it distinguish different programing laguage? for example, C, C++, Verilog... Thanks.
Mark Posted February 19, 2010 Posted February 19, 2010 It just does... int foo (int k) { if (k < 0 || k > 2) { printf ("out of range\n"); printf ("this function requires a value of 1 or 2\n"); } else { printf ("Switching\n"); switch (k) { case 1: printf ("1\n"); break; case 2: printf ("2\n"); break; } } } This is the program we use: http://code.google.com/p/google-code-prettify/
bfarber Posted February 19, 2010 Posted February 19, 2010 Technically, prettyprint does have a way to explicitly set the language, but you don't generally need to do that. If you use[sql]This is an SQL query[/sql] it does This is an SQL query </pre><pre class='prettyprint lang-sql'> You could adapt another bbcode to do something similar if you needed (i.e. have an option parameter to specify the language, then pass that as a class to prettyprint).
Recommended Posts
Archived
This topic is now archived and is closed to further replies.