Alrighty, EVERYONE has asked for this at least once, and up until now I did not have a good solution, but tonight, I present to you.... syntax highlighting in the forums!
The old
[code] tag is still available, but now you can use
[code=language] to highlight the code you're posting.
Here's an example:
[code=php]echo 'Hello World';[/code]Looks like this:
php
Or a little better example, this time using "cpp" for the language:
cpp
string StringToUpper(string strToConvert)
{//change each element of the string to upper case
for(unsigned int i=0;i {
strToConvert[i] = toupper(strToConvert[i]);
}
return strToConvert;//return the converted string
}
string StringToLower(string strToConvert)
{//change each element of the string to lower case
for(unsigned int i=0;i {
strToConvert[i] = tolower(strToConvert[i]);
}
return strToConvert;//return the converted string
}
You MUST type the language in all lower case, and it MUST be one of the following languages:
- cpp
- csharp
- css
- delphi
- java
- jscript
- php
- python
- ruby
- sql
- vb
- xml
So just another example of how to use the new code tag:
[code=vb] would highlight Visual Basic, or (I believe) VB.NET, and
[code=csharp] will highlight in C# mode.
Go ahead and test it out in this thread, and start using it when you post!!!
Enjoy.