Blogger SyntaxHighlighter根本不起作用 [英] Blogger SyntaxHighlighter doesn't work at all

查看:112
本文介绍了Blogger SyntaxHighlighter根本不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图在Blogger上安装SyntaxHighlighter 3.0.83几个小时. 我已经尝试了许多教程,但仍然无法正常工作.我的意思是,它看起来就像普通文本插入到pre标签一样.

I've been trying to install SyntaxHighlighter 3.0.83 on Blogger for couple hours. I've tried many tutorials but it still doesn't work. I mean it looks just as normal text inserted nto pre tag.

我创建了一个新博客并粘贴:

I created a new blog and pasted:

<link href='http://alexgorbatchev.com/pub/sh/current/styles/shCore.css'     rel='stylesheet' type='text/css'/>
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css' rel='stylesheet' type='text/css'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js'     type='text/javascript'></script>
<script language="javascript" type="text/javascript">
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.all();
</script>

...恰好在关闭磁头标签之前. 上面粘贴的代码已在此处生成:生成器

...just before closing head tag. The code pasted above had been generated here: generator

奇怪的是,它可以在我自己的html文档中工作.例如:

The strange thing is that it works in my own html document. As an example:

<html>
<head>
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shCore.css' rel='stylesheet' type='text/css'/>
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css' rel='stylesheet' type='text/css'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js' type='text/javascript'></script>
<script language="javascript" type="text/javascript">
    SyntaxHighlighter.config.bloggerMode = true;
    SyntaxHighlighter.all();
</script>
</head>
<body>
<pre class='brush:java;'>import gt.memorize;
public class Test
{
    private static final String test = "test";
}</pre>
</body>

</html>

但是相同的pre标签在博客中不起作用.

But the same pre tag doesn't work on blogger.

我也尝试粘贴

<script language="javascript" type="text/javascript">
    SyntaxHighlighter.config.bloggerMode = true;
    SyntaxHighlighter.all();
</script>

正文末尾的

和b:skin标签末尾的粘贴样式.都行不通. 而且我不会将代码粘贴到Compose部分中:) 我很困惑,所以我们将不胜感激.

at the end of body and pasting styles at the end of b:skin tag. Neither works. And I don't paste the code into Compose part :) I'm very confused so any help will be extremely appreciated.

推荐答案

我遇到了同样的问题.设置SyntaxHighlighter的说明似乎很容易.所有的教程或多或少都具有可比性,包括评论在我的博客上它有用,如果它对您不起作用,那么您一定在做错事".对我没有任何帮助,我没有突出显示.

I had the same problem. The instructions to set up SyntaxHighlighter seemed easy enough. And all tutorials were more or less comparable including the comment "on my blog it works, if it doesn't work for you then you must be doing something wrong". Nothing worked for me, I got no highlighting.

解决方案是切换到另一个Blogger模板.它只是不适用于我选择的动态模板.切换到一个简单的模板就可以了.现在突出显示即可.

The solution was to switch to another Blogger template. It just didn't work with the dynamic template I chose. Switching to a simple template did the trick. Highlighting now works.

顺便说一句:在追寻错误的同时,我还尝试了美化作为替代方法.它也没有用.好像动态模板所做的某件事导致两个语法突出显示都失败了.

By the way: While chasing for errors I also tried Prettify as an alternative. It also didn't work. Seems like the dynamic template did something which caused both syntax highlighters to fail.

这篇关于Blogger SyntaxHighlighter根本不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆