Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Community Announcements and Feedback (http://www.programmingforums.org/forum14.html)
-   -   Better Syntax Highlighting (http://www.programmingforums.org/showthread.php?t=10720)

big_k105 Jul 14th, 2006 1:21 PM

Better Syntax Highlighting
 
We know have a better syntax highlighting system. Before today the only code blocks we had were php, html, and code(which has no highlighting). Today I have gotten Geshi to work with vbulletin and this allows us to be able to highlight many more languages. The current list of of languages is as follows:
Quote:

apache
asm
asp
bash
c
c_mac
caddcl
cadlisp
cpp
csharp
css
d
delphi
diff
div
eiffel
gml
html4strict
java
javascript
lisp
lua
matlab
mpasm
nsis
objc
oobas
oracle8
pascal
perl
php
php-brief
python
qbasic
smarty
sql
vb
vbnet
vhdl
visualfoxpro
xml
Now to use this highlighting you will have to use the following bbcode:
Quote:

[*highlight=lang*] Code [*/highlight*]
Remember to remove the * from the tags so that this will work.
Here are a few examples to show you that it works:

:

  1. // HelloWorld.cpp
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     cout << "Hello World!" << endl;
  9.     return 0;
  10. }


:

  1. // HelloWorld.cs
  2. using System;
  3.  
  4. public class HelloWorld
  5. {
  6.     public static void Main()
  7.     {
  8.         Console.WriteLine("Hello World!");
  9.     }
  10. }


:

  1. // HelloWorld.java
  2. class HelloWorld
  3. {
  4.     public static void main(String[] args)
  5.     {
  6.         System.out.println("Hello World!");
  7.     }
  8. }


:

  1. #!/usr/bin/perl -w
  2. # HelloWorld.pl
  3. use strict;
  4. print "Hello World!\n";


:

  1. // HelloWorld.php
  2. <?php
  3. echo 'Hello World!';
  4. ?>


You can still use the php and html bbcode tags for those 2 languages if you want but you can also now use the new highlight=php or highlight=html4strict tags as well.

Prm753 Jul 14th, 2006 1:27 PM

:

  1. #include <iostream>
  2. int main()
  3. {
  4.     std::cout << "Cool cool. Thanks Big K!" << std::endl;
  5.     // :)
  6.     return 0;
  7. }


coldDeath Jul 14th, 2006 1:41 PM

Thats really useful thanks!

v0id Jul 14th, 2006 2:16 PM

Two words: Damn nice!
Only two things I can think of that I don't like, it's the underline and bold text.
Imo it should only be coloured and italic text.
Maybe one thing more, they have some damn stange colours.
:

  1. std::cout << "..." << std::endl; // <- :o


Infinite Recursion Jul 14th, 2006 2:21 PM

This will help a great deal Kyle, thanks.

Pizentios Jul 14th, 2006 2:27 PM

pretty sweet feature, we should probably make this thread sticky. Or even place a link to it under the link for the forum rules.

big_k105 Jul 14th, 2006 2:28 PM

void what do you mean by bold and underline text? The stuff that is underline is normally a link. go up and click on them and they bring you to a page explaining what that command means, it works best for the php commands I have noticed that the java ones just do a google search and the perl ones don't seem to work. I will see what I can do to make sure they work.

Sane Jul 14th, 2006 2:41 PM

I found a problem.

It doesn't accept left square brackets properly. It converts it to ascii. And then interprets the pound sign in the ascii as a comment.

This has only been tested with Python highlighting.

:

  1.  
  2. my_list = []


Not sure if you have control over being able to fix this though. =S

big_k105 Jul 14th, 2006 2:48 PM

yeah sykkn found that before I announced it too. I didn't think it would be this quick before someone else found it but I am currently trying to figure out the problem :) if you do [[ the second one works but the first one gets converted to ascii for some wierd reason.

:

  1. my_list = []


Now it works :D

:

  1. my_list2 = []


Jessehk Jul 14th, 2006 4:27 PM

Request: Ruby

Otherwise: Pretty good. :)


All times are GMT -5. The time now is 12:18 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC