Syntax Highlighter extension

Discuss PivotX 2.0.x extensions here, and view extensions that are available for download.

Syntax Highlighter extension

Postby hansfn » Sun Sep 05, 2010 4:12 pm

This is the discussion topic for the Syntax Highlighter extension.

Just released: version 0.2 (see log in extension zip for changes)

Visit http://extensions.pivotx.net/entry/41/syntax-highlighter for download and more info.
hansfn
Developer
 
Posts: 3278
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Syntax Highlighter extension

Postby marius » Sun Sep 05, 2010 5:43 pm

Hi,

After having uploaded the Syntax Highlighter extension and changing some of it's settings, it doesn't work and I don't understand why (this already makes clear where the error most likely is ; ).

So I've got a post here with some Python code:
http://www.beteredingen.nl/?e=396
And I changed the entry so that the opening code tag now looks like this:
Code: Select all
<code class="brush:python">


I changed the file snippet_highlighter.php to allow 'plain' and 'python' brushes. When I check the source code of the page there are some lines at the start that suggest that this got through:
Code: Select all
<script type="text/javascript" src="/pivotx/extensions/syntaxhighlighter/scripts/shBrushPython.js"></script>


This is apparently not enough to get it going. What am I missing / doing wrong?

Cheers, Marius.
User avatar
marius
 
Posts: 20
Joined: Tue Jun 24, 2008 6:46 am
Location: Marburg, DE

Re: Syntax Highlighter extension

Postby hansfn » Sun Sep 05, 2010 6:37 pm

Oh, I think there is a tiny problem with the paths - rename the directory pivotx/extensions/syntax-highlighter/ to pivotx/extensions/syntaxhighlighter/ (This is just a work-around.) I'll update the extension ASAP.

ADDED

Actually, a much, much better fix is to edit the file pivotx/extensions/syntax-highlighter/snippet_highlighter.php and change the line

Code: Select all
$path = $PIVOTX['paths']['extensions_url']."syntaxhighlighter/";

to

Code: Select all
$path = $PIVOTX['paths']['extensions_url']."syntax-highlighter/";

This is not a work-around ;-)
hansfn
Developer
 
Posts: 3278
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Syntax Highlighter extension

Postby marius » Sun Sep 05, 2010 7:32 pm

Hi Hans,

Thanks for your quick reaction! I did as described in your second solution. The links to the .js files in the source code of the page now work. But the code is still shown without highlighting. More ideas?

Cheers, Marius.
User avatar
marius
 
Posts: 20
Joined: Tue Jun 24, 2008 6:46 am
Location: Marburg, DE

Re: Syntax Highlighter extension

Postby habbekak » Sun Sep 05, 2010 8:08 pm

Does it work when you edit templates(template editor)?
Follow me on twitter, so you can check my time line.....
www.twitter.com/habbekak
habbekak
 
Posts: 46
Joined: Sun Jan 24, 2010 10:56 am
Location: Petten (NL, North-Holland)

Re: Syntax Highlighter extension

Postby marius » Sun Sep 05, 2010 8:34 pm

I guess you mean if I add some code to a template starting with <code class="brush:python">?
In that case: no. It's shown as code, but without highlighting.
User avatar
marius
 
Posts: 20
Joined: Tue Jun 24, 2008 6:46 am
Location: Marburg, DE

Re: Syntax Highlighter extension

Postby hansfn » Sun Sep 05, 2010 9:02 pm

It seems you have to use pre instead of code. Please test - it worked for me testing PHP code.

ADDED

Confirmed - it's a bug in the extension documentation - SyntaxHighlighter only supports pre tags for code.

FINAL ADDITION

The path bug and the incorrect documentation is fixed in version 0.1.1 - see first post for download link.
hansfn
Developer
 
Posts: 3278
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Syntax Highlighter extension

Postby marius » Mon Sep 06, 2010 7:07 am

Hans,

That works, thanks a bunch man!

Marius.
User avatar
marius
 
Posts: 20
Joined: Tue Jun 24, 2008 6:46 am
Location: Marburg, DE

Re: Syntax Highlighter extension

Postby leandrocpo » Fri May 09, 2014 12:45 pm

Dear,

I am having problem with the Syntax Highlighter component. He's breaking the line every code word.

I made the following entry:
Code: Select all
<pre class="brush:css">
  body, td, pre {color:#000; font-family:Tahoma, Arial, Helvetica, sans-serif; }
  body {background:#FFF;}
  body.mceForceColors {background:#FFF; color:#000;}
  h1 {font-size: 2em}
  h2 {font-size: 1.5em}
  h3 {font-size: 1.17em}
</pre>


and is coming out as follows: http://codigoeprosa.6te.net/?e=7&previe ... e9b8183d28
I'm using version 2.3.9 Pivotx.
leandrocpo
 
Posts: 6
Joined: Thu May 08, 2014 2:01 pm
Location: Brazil

Re: Syntax Highlighter extension

Postby Harm10 » Sat May 10, 2014 9:45 am

Hi! I tried your code on my own site and it comes out like attached.

So I guess there is something on your site that influences the display?
Are there any errors in the browser console?
Perhaps you can provide a life link to a page that displays this code?
Attachments
example_leandrocpo.png
Display looks OK on my site
example_leandrocpo.png (10.37 KiB) Viewed 10374 times
Quality is in the detail of things............

Want to change or update your PivotX site? Mail or PM me!
I can also convert your site to a Wordpress site!
Harm10
Developer
 
Posts: 2010
Joined: Wed Jun 17, 2009 9:37 am
Location: Somewhere in The Netherlands (aka Holland)

Next

Return to 2.x Extensions

Who is online

Users browsing this forum: No registered users and 1 guest

cron