Register Members List Search Today's Posts Mark Forums Read

Reply
 
Mod Options
Better code syntax highlighting Details »
Better code syntax highlighting
Mod Version: 0.04a, by Sarteck (Coder) Sarteck is offline
Developer Last Online: Jun 2020 I like it Show Printable Version Email this Page

vB Version: 4.x.x Rating: (4 votes - 4.00 average) Installs: 40
Released: 25 Jul 2012 Last Update: 01 Aug 2012 Downloads: 301
Not Supported Uses Plugins Additional Files  

This Modification is meant more as an example than an actual modification, but will work fine as is.

vBulletin by default has three "code" BB Codes.

The [CODE] tag simply gives us monospaced text.

The [HTML] and [PHP] tags give us some highlighted code that's highlighted pretty much how our webserver software decides how to highlight it. For "serious" coding, that's often insufficient.

GeSHi provides much more accurate highlighting and in a vast number of different languages. It's relatively simple to add these languages to your own BB Codes for highlighting, too.

Attached is the latest version of the GeSHi files, 1.0.8.10. You may go to their website at any time and download newer releases, though the latest was released well over a year ago. (I had to repackage it as a ZIP file, because vB.org doesn't accept tar.gz files.)

Download and extract this file. Upload the geshi.php file and the geshi folder to your FORUMROOT/includes folder.

Download the XML product file and Import it as you would a regular Product through your Admin Control Panel. It will install a plugin that contains BB Code functions for the following languages:
  • PHP (as [PHPS])
  • JavaScript (as [JSS])
  • CSS (as [CSSS])
  • SQL (as [SQLS])
  • C++ (as [CPPS])
  • HTML (as [HTMLS])
  • Java (as [JAVAS])
  • Tcl (as [TCLS])
  • BASH (as [BASHS])
(If you're wondering, the "S" stands for "Source".)

By looking through those examples, you can see how to easily add other languages GeSHi handles as well (Lua for some of you game programmers, for example).



This has really helped me communicate code stuff withmy Admins for our forum a lot better than the default vBulletin stuff, and it's nice to have for the coders at my forum as well.



Updated (25.JUL.12) [0.02a]
Included install and uninstall scripts that INSERT or DELETE the above BB Codes to/from your database. WARNING! If you have a BB Code named the same as one of the above that you do NOT want deleted, this product will delete that BB Code from the database if you use the Uninstall script. Just wanted to make that clear.

Updated (01.AUG.12) [0.03a]
Product was previously Disabled by default AND (even after enabling product) the Plugin was disabled. Both are now enabled by default.

Updated (01.AUG.12) [0.04a]
Fixed an error from 0.03a that gave SQL errors when trying to update the product. >_>

Download Now

Only licensed members can download files, Click Here for more information.

Show Your Support

  • To receive notifications regarding updates -> Click to Mark as Installed.
  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Comments
  #2  
Old 25 Jul 2012, 10:21
Sarteck's Avatar
Sarteck Sarteck is offline
 
Join Date: Mar 2008
I'd also request that the Staff here consider using GeSHi for making stuff all prettified. X3 It's obviously not a necessity, but it'd be nice to have code highlighting for SQL, CSS, and JavaScript at least.
Reply With Quote
  #3  
Old 25 Jul 2012, 12:06
Sarteck's Avatar
Sarteck Sarteck is offline
 
Join Date: Mar 2008
Updated to include Install/Uninstall scripts that will add (or delete) the BB Codes automatically for you. Now all you need to do is upload the files and import the XML.
Reply With Quote
  #4  
Old 01 Aug 2012, 07:46
ryohnosuke's Avatar
ryohnosuke ryohnosuke is offline
 
Join Date: Nov 2010
it's working? I'm only getting:

{PlaceHolder}

Saludos.
Reply With Quote
  #5  
Old 01 Aug 2012, 10:05
Sarteck's Avatar
Sarteck Sarteck is offline
 
Join Date: Mar 2008
The product was previously disabled by default, and even after enabling the Product, the Plugin was disabled by default.

Both are now enabled by default in v0.03a, so you can download and over-write to fix, or you can simply enable both the Product and then Plugin.

My bad, oops. ^^;
Reply With Quote
  #6  
Old 01 Aug 2012, 16:50
ryohnosuke's Avatar
ryohnosuke ryohnosuke is offline
 
Join Date: Nov 2010
I uninstalled it and when I want to install your fixed version:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Last edited by ryohnosuke; 01 Aug 2012 at 17:10.
Reply With Quote
  #7  
Old 01 Aug 2012, 20:48
Sarteck's Avatar
Sarteck Sarteck is offline
 
Join Date: Mar 2008
Sorry, man. My bad for including install code where not necessary. (Thought I needed one for each version, apparently I only need it for the earliest version.)

Everything fixed in 0.04a.

Or... hopefully. XD That's what the "a" is there for, after all.
Reply With Quote
  #8  
Old 01 Aug 2012, 20:49
Sarteck's Avatar
Sarteck Sarteck is offline
 
Join Date: Mar 2008
Also, En Taro Adun.
Reply With Quote
  #9  
Old 01 Aug 2012, 21:02
ryohnosuke's Avatar
ryohnosuke ryohnosuke is offline
 
Join Date: Nov 2010
Ok it works! : D, how can I set up the number lines?

Saludos.
Reply With Quote
  #10  
Old 02 Aug 2012, 03:07
Sarteck's Avatar
Sarteck Sarteck is offline
 
Join Date: Mar 2008
There's a line,

//$geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS);// (Disabled Line Numbers)

Uncomment that.
Reply With Quote
  #11  
Old 02 Aug 2012, 13:38
tcarr9 tcarr9 is offline
 
Join Date: Jul 2010
Thanks so much - installed and working nicely. I even modified it to include an AS3S tag for ActionScript3 since that is used on my forums frequently.
Reply With Quote
  #12  
Old 02 Aug 2012, 13:47
Sarteck's Avatar
Sarteck Sarteck is offline
 
Join Date: Mar 2008
You're welcome, but thank the GeSHi coders more than me. :P All I did was show how to use it for vBulletin--they're the ones who provided such an awesome project. :3
Reply With Quote
  #13  
Old 06 Aug 2012, 19:58
SolidSnakeLive SolidSnakeLive is offline
 
Join Date: Jul 2011
How to add button for lua ?

I added a lines in XML file for lua

But the button didn't show up in Editor ... I have already put a pic for it !

Can you tell me how to add a button in editor or make this mod with buttons ?
Reply With Quote
  #14  
Old 07 Aug 2012, 03:16
Sarteck's Avatar
Sarteck Sarteck is offline
 
Join Date: Mar 2008
On the plugin GeSHi BB Codes (hook location bbcode_create), add the following:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

In the Admin Control Panel, Custom BB Codes ---> Add New BB Code.
Title: Lua Source Code
BB Code Tag Name: luas
Replacement: {Placeholder}
Example: print("Herro World")
Description: Prints out Lua code all nicely formatted.
Use {option}: No
Button Image (Optional): --here is where you would specify a button image.
Remove Tag If Empty: Yes
Disable BB Code Within This BB Code: Yes (well, depends on if you want or not)
Disable Smilies Within This BB Code: Yes
Disable Word Wrapping Within This BB Code: No
Disable Automatic Link Parsing Within This BB Code: Yes

Then test it out.
Reply With Quote
  #15  
Old 07 Aug 2012, 05:14
SolidSnakeLive SolidSnakeLive is offline
 
Join Date: Jul 2011
Originally Posted by Sarteck View Post
On the plugin GeSHi BB Codes (hook location bbcode_create), add the following:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

In the Admin Control Panel, Custom BB Codes ---> Add New BB Code.
Title: Lua Source Code
BB Code Tag Name: luas
Replacement: {Placeholder}
Example: print("Herro World")
Description: Prints out Lua code all nicely formatted.
Use {option}: No
Button Image (Optional): --here is where you would specify a button image.
Remove Tag If Empty: Yes
Disable BB Code Within This BB Code: Yes (well, depends on if you want or not)
Disable Smilies Within This BB Code: Yes
Disable Word Wrapping Within This BB Code: No
Disable Automatic Link Parsing Within This BB Code: Yes

Then test it out.
Well thanks for reply

But this did not work ...

There is no LUA button in editor

I did what you say exactly
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Mod Options

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 15:30.

Layout Options | Width: Wide Color: