admin管理员组文章数量:1418437
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='.js'/>
<script src='.js'/>
<script type="text/javascript">
$(document).ready(function(){
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.autoloader(
'js .js',
'php .js',
'sass .js',
'sql .js',
'xml .js',
'css .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...
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./files/shAutoloader.js'/>
<script src='https://xarpixels.googlecode./files/shCore.js'/>
<script type="text/javascript">
$(document).ready(function(){
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.autoloader(
'js https://xarpixels.googlecode./files/shBrushJScript.js',
'php https://xarpixels.googlecode./files/shBrushPhp.js',
'sass https://xarpixels.googlecode./files/shBrushSass.js',
'sql https://xarpixels.googlecode./files/shBrushSql.js',
'xml https://xarpixels.googlecode./files/shBrushXml.js',
'css https://xarpixels.googlecode./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...
Share Improve this question edited Jun 20, 2020 at 9:12 CommunityBot 11 silver badge asked Apr 28, 2013 at 2:54 XarcellXarcell 2,0116 gold badges35 silver badges66 bronze badges 5- Is this anything like this other Blogger Syntax Highlighter issue? Maybe something to do with the template you are using? – summea Commented Apr 28, 2013 at 2: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 Commented Apr 28, 2013 at 3:02
- I even tried the solution in that post you gave. It didn't work. – Xarcell Commented Apr 28, 2013 at 3: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 Commented Apr 28, 2013 at 3:42
- Why the hell did someone vote to close this? – Xarcell Commented Apr 28, 2013 at 14:51
2 Answers
Reset to default 4I followed this method here: http://oneqonea.blogspot./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.
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./ajax/libs/highlight.js/9.0.0/styles/github.min.css’ rel=‘stylesheet’/>
<script src=‘//cdnjs.cloudflare./ajax/libs/highlight.js/9.0.0/highlight.min.js’/>
<script>hljs.initHighlightingOnLoad();</script>
<!– end Syntax highlighter –>
本文标签: javascriptProblems Adding Syntax Highlighter To BloggerStack Overflow
版权声明:本文标题:javascript - Problems Adding Syntax Highlighter To Blogger - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745280184a2651385.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论