Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SyntaxHighlighter not showing toolbar

I am using the latest SyntaxHighlighter within my app and for some reason the toolbars do not show in IE, Firefox or Chrome. The code highlights without issue, but I want to have toolbars. What makes things worse is that the toolbar demo on the official website is not working either.

Am I missing something obvious? Below are the code nuggets.

<script src="Scripts/syntaxhighlighter/scripts/shBrushCSharp.js" type="text/javascript"></script>
<link type="text/css" rel="stylesheet" href="Scripts/syntaxhighlighter/styles/shCoreDefault.css" />
<script type="text/javascript">
    // Highlight code
    SyntaxHighlighter.all();
</script>

<pre class="brush: csharp; ruler: true; title: 'Test'; toolbar: true;">
public static bool HelloWorld()
{
    // Return
    return false;
}
</pre>
like image 231
Keith Adler Avatar asked Jan 05 '11 18:01

Keith Adler


2 Answers

I've been trying to figure this one out myself. I won't claim to be 100% correct here, but from what I can tell, this is the answer:

  1. Toolbar was changed in update from version 2 to version 3.
  2. Toolbar no longer includes the icons and whatnot.
  3. The default toolbar is now the simple '?'.

This pretty much sucks, if it's true. The pop-up toolbar w/ icons is one of the things that made me choose SH over the other options.

This is what I'm guessing comparing the included CSS files in the latest package to the CSS available on sites that have a version with the "proper" toolbar enabled.

Here's a link to one I was snooping in: ramymostafa.com

like image 139
Tieson T. Avatar answered Oct 28 '22 12:10

Tieson T.


While I would like the toolbar myself, it seems that one of the toolbars features - copy & paste - have been included without the need for a toolbar item:

If you double click anywhere on the code, the entire code view is replaces with a pre-selected view from which users can copy with a simple Ctrl/Cmd-C. Clicking anywhere else returns the view to the original state. http://alexgorbatchev.com/SyntaxHighlighter/whatsnew.html#copytoclipboard

I would still like the pop out feature, but less buttons is a good thing, I guess?

like image 24
Mbrevda Avatar answered Oct 28 '22 12:10

Mbrevda