![]() |
Advanced Syntax Highlighting - BBCode [highlight]
Advanced Syntax Highlighting
This Hack provides a [highlight] BBCode to highlight a wide range of Languages such as XML, HTML, Java, Javascript, SQL and so on. It uses GeSHi, which is included in this ZIP. Details 1 Product XML with 2 Plugins and 2 Templates Please only click Install if you actually have installed/are using this Hack, and click Uninstall whan you don't use it any longer! |
Quote:
Edit: I re-uploaded geshi.php and it worked - Odd :speechless: Satan |
great idea. thanks kirby :)
but html highlightning does not show up colored. what am i doing wrong? greets |
You must use the Names of the Files in Directory geshi, eg. for HTML you must use html4strict:
[hightlight=html4strict] <!-- some HTML here --> [/highlight] |
ah thank you. that's pretty easy. didn't really look into the geshi dir.
|
Is there a way we can make a bbcode replacement for like sql and xml tags? And is there any way to take the numbers out of the code on each line at the beginning?
|
It looks like xml hightlighting gets broken.
|
Line Numbers -> Edit the Plugin (Hook bbcode_create) and comment out $geshi->enable_line_numbers
Furure Versions might include a setting for this. As for the Screenshot: Can you post the Text which generated this output? If you want to have [sql] and [xml] Tags, I guess you would have to create similar handlers that would then call handle_bbcode_highlight |
Sure thing. ;)
Here you go. Quote:
|
This is the Output I get on my Board ...
|
Quote:
Because that's where it seems to break in my pic. |
If I comment this line out in the plug-in, then it shows just like yours.
Quote:
|
Hmm, I didn't change anything - I just copypasted your XML and seems to work fine for me.
So can you tell me exactly how to reproduce the Problem? |
Ok, I figured it out now. You're hack is smarter than I am (big surprise, I know).
I was using & instead of & in my original code. It messes up with just &. I guess it was trying to teach me the proper xml way to do it. Any way to catch that for noobies? |
Well, just & is invalid XML :)
I guess GeSHIi doesn't like that too much. I don't think there is any way to detect such things ... |
Quote:
Is there any way to keep the spacing at the beginning of each line so it looks like the code we enter instead of lining it all up the the left? The indents were there before I posted the code for highlighting. |
Hi, is this hack compatible to older versions, maybee the 3.0.8 Board, or what do i have to modify to make it work?
regards Disi |
No, it's not compatible.
Feel free to backport it, I won't do so :) |
Well i've made a 3.5rc2 Test installation on my pc and i don't now why but it doesn't work, its not parsing the code.
example: Code:
[hightlight='php'] |
Well, it's [highlight] not [hightlight] :)
|
Quote:
Big thx! Works great now! |
KirbyDE,
Thanks for the mod, I have been looking for something to do this. I added my own format called webfocus (yes its a report language) and it works great. -Wilky49 |
BEAUTIFUL!!!
Great addon :up: |
Well last question How do i make a Button (for example html) which adds the tags automaticly?
thx in advice :) Disi |
That would be a cool addition to the hack.
KirbyDE ... Hint Hint. -Wilky49 |
Yeah would be nice if we get some hints :)
mfg Disi |
If somebody can make a nice Button Image that fi's with the Default Style i'll make it so it does automatically show up.
And an explanation on how to use this (for the Users) at misc.php?do=bbcode is also missing. |
WEll maybe a button is not the best solution, whats about a Listbox?
remove the php tag and replace it with a Lisbox, nice to have is something in the ACP where you can select included languages or something?! What do you think Kirby? |
Wouldn't it be better to make it a tag that isn't already in use by default with vBulletin (or maybe it was be design since it requires a parameter)?
|
@digitalpoint
Well, it highlights Text so I thought that highlight would be best, and it also doesn't conflict as the default [hjighlight] does not have paramaters. Anyway, you can easily change the Tag by editing the Plugin - should be obvious what to do. |
Is there a way to get it to not parse bbcode within the highlight tags?
For example, try this: [highlight=php]<?php echo '[b]test'; ?>[/highlight] It gives me: Quote:
PHP Code:
PHP Code:
|
The comments being output looks like it was caused by a bug in RC2, which was fixed for the next release already, so I got that squared away. Very nice plug-in BTW... I changed it to be CODE instead of HIGHLIGHT (more natural to me) and I added a little extra to have it intercept the normal PHP and HTML tag calls. :)
|
Hi Kirby,
This looks like an awesome plugin. I'm interested in knowing if it can be changed such that a tag like [as] automatically invokes this plugin using ActionScript as the type. I know I can use [highlight=ActionScript] but the problem is my board is 4 years old and already has a few hundred thousand posts which used the [as] syntax. I've tried playing around with it but to no avail. Primarily I changed: Code:
$this->tag_list['option']['highlight'] Code:
$this->tag_list['option']['as'] Any help much appreciated. Cheers Jesse |
It does not work on v3.0.7, right? ;)
Good Job! |
Quote:
|
Quote:
also interesting on a solution. |
If you just want [as] for ActionScript, then change it to
PHP Code:
PHP Code:
PHP Code:
|
Thanks Andreas. I figured that our just yesterday myself and it worked pretty well. The only problem I'm finding is that all NEW posts will highlight correctly but all the old posts which have [as]foobar[/as] just remain as plain text. What's with that? How can I fix it up?
Any help much appreciated. Cheers Jesse |
[sql]truncate post_parsed[/sql]
|
Works great. Thanks!
|
All times are GMT. The time now is 05:05 PM. |
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:
|