1

I'm trying to add Syntax Highlighter to my new blog at blogger. For some reason I keep getting these errors:

Uncaught ReferenceError: SyntaxHighlighter is not defined Uncaught

ReferenceError: XRegExp is not defined shCore.js:123 Uncaught

TypeError: Cannot read property 'config' of undefined

Here is my code:

<script src='https://xarpixels.googlecode.com/files/shAutoloader.js'/>
<script src='https://xarpixels.googlecode.com/files/shCore.js'/>
<script type="text/javascript">
    $(document).ready(function(){
      SyntaxHighlighter.config.bloggerMode = true;
      SyntaxHighlighter.autoloader(
        'js  https://xarpixels.googlecode.com/files/shBrushJScript.js',
        'php  https://xarpixels.googlecode.com/files/shBrushPhp.js',
        'sass  https://xarpixels.googlecode.com/files/shBrushSass.js',
        'sql  https://xarpixels.googlecode.com/files/shBrushSql.js',
        'xml  https://xarpixels.googlecode.com/files/shBrushXml.js',
        'css  https://xarpixels.googlecode.com/files/shBrushCss.js'
      );
      SyntaxHighlighter.all();
    });
</script>

To me, everything looks correct?

EDIT: I noticed that when I change the path to any of the files in the demo, the script breaks and doesn't work. This isn't making any sense at all...

Community
  • 1
  • 1
Xarcell
  • 2,011
  • 6
  • 33
  • 65
  • Is this anything like [this other Blogger Syntax Highlighter issue](http://stackoverflow.com/questions/12464924/blogger-syntaxhighlighter-doesnt-work-at-all)? Maybe something to do with the template you are using? – summea Apr 28 '13 at 02:57
  • It's possible it could be a template issue, but I'm using a custom one based of of the "Simple" theme. Nothing fancy. In the link you provided, all those issues were based of the "Dynamic View" theme. I dunno what the problem is... – Xarcell Apr 28 '13 at 03:02
  • I even tried the solution in that post you gave. It didn't work. – Xarcell Apr 28 '13 at 03:07
  • Not sure... I didn't down vote this question ;) Anyhow, sorry to hear that the other post didn't seem to help. Have you tried the Syntax Highlighter by itself in a simple, separate HTML file (just to verify that your script lines work?) – summea Apr 28 '13 at 03:42
  • Why the hell did someone vote to close this? – Xarcell Apr 28 '13 at 14:51

2 Answers2

4

I followed this method here: http://oneqonea.blogspot.com/2012/04/how-do-i-add-syntax-highlighting-to-my.html

It may not be using the autoloader(as I want to prevent http requests), but it gives me a working example to work from and perhaps I can get the autoloader working.

Thanks.

Xarcell
  • 2,011
  • 6
  • 33
  • 65
2

Easy alternatives using highlight js will be very easy and has many very interesting views

for demo see here from the official website

<!– Syntax highlighter –>
<link href=‘//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.0.0/styles/github.min.css’ rel=‘stylesheet’/>
<script src=‘//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.0.0/highlight.min.js’/>
<script>hljs.initHighlightingOnLoad();</script>
<!– end Syntax highlighter –>
Faisal Halim
  • 231
  • 3
  • 11