![]() |
Better code syntax highlighting
1 Attachment(s)
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:
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. >_> |
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.
|
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.
|
it's working? I'm only getting:
{PlaceHolder} Saludos. |
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. ^^; |
I uninstalled it and when I want to install your fixed version:
Code:
Database error in vBulletin 4.2.0: |
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. |
Also, En Taro Adun.
|
Ok it works! : D, how can I set up the number lines?
Saludos. |
There's a line,
//$geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS);// (Disabled Line Numbers) Uncomment that. |
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.
|
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
|
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 ? |
On the plugin GeSHi BB Codes (hook location bbcode_create), add the following:
PHP 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. |
Quote:
But this did not work ... There is no LUA button in editor I did what you say exactly :( |
Its works the problem is I was using a plugin that add more buttons to editor such as pdf / flash / advanced colors ...etc
when i disabled it .... it works ! I don't know if there a solution to keep both works :confused: |
Hmm. What's the modification? Can you link it? Maybe I can modify my thing to be compatible with it (although I'm not sure why it would be incompatible).
|
Quote:
This Product : http://www.wahtaljouf.com/wahtools/wah-tools-editor.zip same but UTF-8 Encoding : http://www.wahtaljouf.com/wahtools/w...ditor-utf8.zip Info : http://www.traidnt.net/vb/traidnt1998010/ Its in Arabic language not English but you can see the images to have the idea about this product |
When I've tried using this mod, at least with the php code, it actually was causing an error when you try to load the thread. Has anyone else experienced this?
|
Can you make this script looks like this codebox
http://forum.mtasa.com/viewtopic.php...=47798#p473505 appears as code with using lua highlight support & ofcource with rows id |
Quote:
Anyone know how to fix this? |
this does nto work for 4.2.0
each time an post is edited the BBCode is removed |
I've successfully installed your product and have successfully added GLSL! Yay! Thank you.
I have one issue though: We use the fancy editor in vBulletin, and once we add the tags--for any code block-- and preview or save the post, the tags are removed and the code is saved as converted already into its fancy format. If we come back to edit the code, and save, our code is all smushed up onto one line. Is there a way to have the tags remain in our posts and not get converted, much like how the normal BB Code tags work? Thank you. Screen shot of issue for clarity https://skitch.com/outofcontrol/eaxw...reply-to-topic |
Quote:
|
Did anybody get this working in 4.2 in the end or is it still removing the BBCode when a post is edited?
|
is this working on 4.2.1 ?
|
I got it to work on vb 4.2.1
No problems so far. |
And anyone know how to hide the contents of the code in the post for guest?
|
Quote:
It still removes the codebox when the post is edited until thats fixed its pretty useless for me unfortunatley |
Quote:
|
it seems geshi support vb codes. but there is no vb tag after installation.
is there any way to solve it? |
Quote:
Quote:
Quote:
is there any solution? :confused: |
Is there anyway to add these to a single BB Code? I would like to add all of them to the "Code" BB Code, and have them automatically detect and highlight the correct Code Syntax. I think it will be easier for members, then using Multiple Code BB Codes for different Code Languages.
|
Language highlighting is typically determined by the extension used on the file name. Since there is no file name extension given in a vbulletin code box the individual BBCODES are probably necessary. Note - I have not looked at the code to this modification. :)
|
Any chance to change the colors for a dark theme? Is that to much of a hassle?
Cheers |
|
There are a demo?
|
Not that I have seen, best way to demo something is to install it and test it out. :)
|
Hi. Maybe for somebody its steel actual.
To correct the problem with disappearing content after editing the message , it is necessary in the module GeSHi BB Codes, at hook bbcode_create to add the following code: PHP Code:
|
Quote:
works in vb 4.2.3 |
All times are GMT. The time now is 05:48 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|