g-t*_*g-t 16 blogger syntaxhighlighter blogger-dynamic-views
我一直试图在Blogger上安装SyntaxHighlighter 3.0.83几个小时.我已经尝试了很多教程,但它仍然无效.我的意思是它看起来像正常文本插入nto 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>
Run Code Online (Sandbox Code Playgroud)
......就在关闭头标签之前.上面粘贴的代码在这里生成: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>
Run Code Online (Sandbox Code Playgroud)
但是相同的预标记对博客不起作用.
我也尝试过粘贴
<script language="javascript" type="text/javascript">
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.all();
</script>
Run Code Online (Sandbox Code Playgroud)
在身体的末端和b末尾的粘贴风格:皮肤标签.两者都不起作用.而且我不会将代码粘贴到Compose部分:)我很困惑,所以任何帮助都将非常感激.
Ste*_*fan 19
对于动态视图,帖子的内容似乎是在引导语法高亮过程的脚本之后加载的.你可以解决它:
<pre class="brush: js" title="test" id="sh3-123">
var f = function () {
return 1;
};
</pre>
<script type="text/javascript">
// code snippet is loaded here, use SH3 API to highlight it
var element = document.getElementById('sh3-123');
SyntaxHighlighter.highlight(undefined, element);
</script>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4081 次 |
| 最近记录: |