Serendipity and dpSyntaxHighlighter plugin with bash support.

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.
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

                case 'frontend_header':
                    echo '    <link rel="stylesheet" type="text/css" href="' . $pluginDir.  '/SyntaxHighlighter.css" />' . "\n";
                    return true;
                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.


Trackback specific URI for this entry

This 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


Display comments as Linear | Threaded

No comments

Add Comment

You can use [geshi lang=lang_name [,ln={y|n}]][/geshi] tags to embed source code snippets.
Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.
To leave a comment you must approve it via e-mail, which will be sent to your address after submission.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.