Syntax highlighter not working

Skyyy picture Skyyy · May 21, 2014 · Viewed 7k times · Source

I am just following the instruction over here and its not working any help?

<script type="text/javascript" src="sh/src/shCore.js"></script>

<script type="text/javascript" src="sh/scripts/shBrushJScript.js"></script>

<link href="sh/styles/shCore.css" rel="stylesheet" type="text/css" />
<!--<link href="sh/styles/shCoreDefault.css" rel="stylesheet" type="text/css" />-->
<link href="sh/styles/shThemeDefault.css" rel="stylesheet" type="text/css" />

<pre class="brush: js">
    /**
     * SyntaxHighlighter
     */
    function foo()
    {
        if (counter <= 10)
            return;
        // it works!
    }
</pre>
<script type="text/javascript">
     SyntaxHighlighter.all()
</script>

Found some error in console don't know wt to do with it.

Uncaught ReferenceError: XRegExp is not defined shCore.js:123 Uncaught TypeError: Cannot read property 'Highlighter' of undefined shBrushJScript.js:45 Uncaught TypeError: Cannot read property 'all' of undefined test.php:21 Attr.specified is deprecated. Its value is always true.

Answer

Imran Bughio picture Imran Bughio · May 21, 2014

I found this LINK

Try to keep all your local files for syntax highliter in same directory like this:

<script type="text/javascript" src="sh/src/shCore.js"></script>

<script type="text/javascript" src="sh/src/shBrushJScript.js"></script>

OR

<script type="text/javascript" src="sh/scripts/shCore.js"></script>

<script type="text/javascript" src="sh/scripts/shBrushJScript.js"></script>