quote:
Originally posted by warmth
so what are going to be the solution of this thread???
The thread isn't over yet. ;o
I still have some work to do on the syntax highlighting feature, but it's mostly done now. To use it, just specify a language within the opening code tag, like [code=php]...[/code].
jscript code:
// Some random code posted by matty :p
function ReadFile(File) {
var oLineArray = new Array();
var oFile = FileSys.OpenTextFile(File, 1 /* ForReading */, false);
while (!oFile.AtEndOfStream) oLineArray.push(oFile.ReadLine());
return oLineArray;
}
Without a language, [code] will behave the same as always (for backward compatibility).
code:
without language attribute
Here's the full list of supported languages: apache, asm, asp, bash, c, cpp, csharp, css, delphi, diff, dos, email, html4strict, ini, inno, java, javascript, make, mirc, mysql, nsis, objc, perl, php-brief, php, povray, powershell, python, rails, reg, robots, ruby, smalltalk, smarty, sql, tcl, text, vb, vbnet, xml
I deleted some of the more obscure ones (GeSHi comes with like 120 languages), and added aliases so you can use c++, c#, html, xhtml, js, jscript, etc.
To make a certain line stand out, surround it with >>> and <<< like this:
php code:
$line = 1;
>>>$line = 2;<<<
$line = 3;
>>>/* Another important line */<<<
(Idea stolen from a phpBB modification)
I'll add all this info to the BBcode help page eventually.
Also on the todo list:
- Add some MsgPlus-specific stuff, like automatic links to the scripting API documentation, which would be kinda cool.
- The colors and styles might need some tweaking if people complain that they're ugly .
- Modify the "MyCode inserter" thingy to support the new tag format?
- Somehow update all old posts containing code tags so they can take advantage of the syntax highlighting?
P.S. To see some examples of the highlighting in action, search the board for [code=. I edited a bunch of posts in the Scripting forum to test the highlighter.