我已经尝试在 Blogger 上安装 SyntaxHighlighter 3.0.83 几个小时了。我已经尝试了很多教程,但它仍然不起作用。我的意思是它看起来就像插入到 pre 标签中的普通文本一样。
我创建了一个新博客并粘贴:
<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 标签之前。上面粘贴的代码是在这里生成的:generator
奇怪的是它可以在我自己的 html 文档中使用。举个例子:
<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 标签在博客上不起作用。
我也试过粘贴
<script language="javascript" type="text/javascript">
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.all();
</script>
在 b:skin 标签末尾的 body 和粘贴样式的末尾。两者都不起作用。而且我不会将代码粘贴到撰写部分:) 我很困惑,所以任何帮助都将不胜感激。