• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
  • This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

[xxsY] XenXero Syntax Highlighter

EQnoble

Well-known member
#1
XenXero Syntax Highlighter

powered by Google Prettify

____________________________________​

Requirements: King Kovifors BBCM ( BBcode Manager ) , xxsY_bbcode

Simple explanation: A js based syntax highlighter addon​

Long winded: Another quick addon I finally got around to making possible without template edits being required for the end users of this mod. This basically colorizes code based on language which it auto detects. The addon package includes a bbcode which must be imported into BBCM which is what allows the end user to print out beautiful looking code snippets of many languages.​

To test it register@... http://xenxero.com/threads/xxsy-demo-thread.12/

Thanks very much to Jake Bunce who basically took the foul attempts I made at stripping the url tags and showed me the right way to apply it.

Usage: [syntax]paste code here[/syntax]​
_________________________________​

Installation:
  1. Extract the contents of the xxsY.v.1.1.0.zip file.
  2. Upload the contents of the UPLOAD directory to the folder you have xenforo installed in.
  3. Install/import the addon-xxsY.xml
  4. Import the bbcode_syntax.xml into the custom BBcode manager
Upgrade:
  1. Extract the contents of the xxsY.v.1.1.0.zip file.
  2. Upgrade addon with the addon-xxsY.xml file from the zip file.
  3. Delete the old bbcode and re-import the new one.
updated 10.11.11
 

Attachments

James

Well-known member
#2
IDEA: Create the custom BB Codes in the syntax highlighting code to avoid having to use the BBCM if you don't have it installed (installing 2 mods for a syntax highlighter seems a little excessive)

Nice mod though, did you fix the problem with the BB Codes embedding inside the syntax?
 

EQnoble

Well-known member
#3
I just did right now :) ...forgot about that bro...good memory there.

package updated...if you already installed it just delete the bbcode and re-import the new one.

IDEA: Create the custom BB Codes in the syntax highlighting code to avoid having to use the BBCM if you don't have it installed (installing 2 mods for a syntax highlighter seems a little excessive)
Now if you could explain how I would start even going about that...lol This does not use php at all unlike GeSHi so I don't even know how I would include it (bbcodes) in the script which is all js.

I figured most people looking to use this would probably also be using bbcm but that was just a guess.
 

lasertits

Active member
#5
This is nice, but it increased the page load times by quite a bit, disabled and the site sped right back up, enabled and it slowed right back down, even on pages with no syntax highlighting embedded. :confused:
 

EQnoble

Well-known member
#6
What happens to indentation?
I haven't figured out just yet how to preserve the formatting of pasted text. Ok I lied after starting to write this post instead of wasting time I looked at what I can do to fix this. I have I think and am just testing it now...will update shortly.

This is nice, but it increased the page load times by quite a bit, disabled and the site sped right back up, enabled and it slowed right back down, even on pages with no syntax highlighting embedded. :confused:
It runs on all pages waiting for a class to convert into a syntax highlighted code box and automatically guesses the language. I can't really do anything about that. Again this is why I am moving on to GeSHi. Sorry I can't help you there...if the experience is that bad with it I recommend uninstalling it and deleting the files uploaded with the package.
 

EQnoble

Well-known member
#10
Very nice app, Love it.

I would like this to work on the existing links. ;)

Code:
[URL='http://mysite.com']mysite.com[/URL]
Anything i can do?
Thanks! I already was planning on doing this tonight. :) (assuming that I can that is)
The column for line number is too small. For line X00+, you can hardly see the X number.
I thought I fixed that...ok maybe I forgot to upload the updated package. (it really is just a few pixels of padding on the left) I am going to eat an early dinner then I will get back to work...I got all caried away with some css for another mod so I kinda got sidetracked today lol. I'll update here tonight.
 

Andy.N

Well-known member
#11
Sounds good.
So what happens to the default bb [code| tag? Can we hook it to use this instead of asking people to use a new bbcode?

My forum default code syntax is C++ so if it's an option, it would be nice.[/code]
 

EQnoble

Well-known member
#12
I was going to look into extending that...which is why I released this as a final release sort of. I want to move to GeSHi which would be a better choice to use if one was to try and extend xf's default code tag. The first step is going to be integrating GeSHi then I will try to refactor it into the default code tag. no eta though on that. Could have a miracle and be tomorrow...or I may just croak and bequeath this job as a debt to my closet kin of coders :) Hard to tell lol
 
#13
Thanks! I already was planning on doing this tonight. :) (assuming that I can that is)

I thought I fixed that...ok maybe I forgot to upload the updated package. (it really is just a few pixels of padding on the left) I am going to eat an early dinner then I will get back to work...I got all caried away with some css for another mod so I kinda got sidetracked today lol. I'll update here tonight.
Any news on the links EQnoble. :whistle:
 

Andy.N

Well-known member
#19
Oh wait, I see what happens. When you first use the [syntax] code, and save the post, the editor will not show the color and line number. Only after a bit or a page refresh it starts to show.
Is there anyway we can get the editor to show the effect right away?

Gimme a link to a post on your site with the bbcode in use and I'll take a look.
I reread what was posted on #5 and #6 and I see I have to wait for the page load to activate this changes.
I guess I will have to wait till you or someone gets around to do geshi on XF.
Thanks again for your time.