Serendipity and dpSyntaxHighlighter plugin with bash support.
Posted by valqk on
I wanted a syntax highlighter for the previous post.
I've installed dpsyntaxhighlighter from serendipity plugins list. I wanted a JS code highlighter - not a php one (like GeSHi), so I've chosen this one. (it uses google syntaxhighlighter)
I've noticed that this nice lib don't have a bash syntax support which I needed now.
In the wiki of the project I've found this link to a script a guy wrote for bash syntax.
Great!
I've placed the js file in ROOT/plugins/serendipity_event_dpsyntaxhighlighter/dp.SyntaxHighlighter/Scripts/ and expected it to work.
No, it didn't.
It turned out that you have to add each language highliter js script file in ROOT/serendipity_event_dpsyntaxhighlighter.php
Around:
there is a list with all js files.
Simply add the new language (on both frontend_footer and backend_preview cases) and there you go!
How to highlight your text?
It is used very simple.
You add code like this in your post:
and you have nice formatted code.
More usage tips here.
That's all folks.
Hope that helps you.
I've installed dpsyntaxhighlighter from serendipity plugins list. I wanted a JS code highlighter - not a php one (like GeSHi), so I've chosen this one. (it uses google syntaxhighlighter)
I've noticed that this nice lib don't have a bash syntax support which I needed now.
In the wiki of the project I've found this link to a script a guy wrote for bash syntax.
Great!
I've placed the js file in ROOT/plugins/serendipity_event_dpsyntaxhighlighter/dp.SyntaxHighlighter/Scripts/ and expected it to work.
No, it didn't.
It turned out that you have to add each language highliter js script file in ROOT/serendipity_event_dpsyntaxhighlighter.php
Around:
switch($event) case 'frontend_header': echo ' <link rel="stylesheet" type="text/css" href="' . $pluginDir. '/SyntaxHighlighter.css" />' . "\n"; return true; break; case 'frontend_footer':
there is a list with all js files.
Simply add the new language (on both frontend_footer and backend_preview cases) and there you go!
How to highlight your text?
It is used very simple.
You add code like this in your post:
... some code here ...
and you have nice formatted code.
More usage tips here.
That's all folks.
Hope that helps you.
Trackbacks
Trackback specific URI for this entryThis link is not meant to be clicked. It contains the trackback URI for this entry. You can use this URI to send ping- & trackbacks from your own blog to this entry. To copy the link, right click and select "Copy Shortcut" in Internet Explorer or "Copy Link Location" in Mozilla.
No Trackbacks
Comments
Display comments as Linear | ThreadedNo comments