给blog增加了代码高亮插件-SyntaxHighlighter
代码高亮插件-SyntaxHighlighter,安装了好几次都不好用!readme只有简单的语法没有配置,就去google上,最终找到了个配置方法,现在转载过来,做个记录!
SyntaxHighlighter支持的语法
C# — c#、c-sharp、csharp
CSS — css
Delphi — delphi、pascal
Java — java
JavaScript — js、jscript、javascript
PHP — php
Python — py、python
Ruby — rb、ruby、rails、ror
SQL — sql
VB — vb、vb.net
XML/HTML — xml、html、xhtml、xslt
SyntaxHighlighter 的下载
下载地址
SyntaxHighlighter 的安裝
1、将下载的文档解压,会生成一个syntaxhighlighter文件夹,然后将文件夹放到/wp-content/plugins/ 下面。
2、后台启用该插件。
3、编辑你正使用主题的header.php文件,然后将下面的语句复制到<head>与</head>标记之间。
1.link rel=&amp;quot;stylesheet&amp;quot; href=&amp;quot;&amp;lt; ?php echo get_bloginfo(‘wpurl’).‘/wp-content/plugins/syntaxhighlighter/files/SyntaxHighlighter.css’; ?&amp;gt;&amp;quot; type=&amp;quot;text/css&amp;quot; media=&amp;quot;screen&amp;quot; /&amp;gt;4、上述步骤完成后检查你使用主题的footer.php文件,看看其中是否有这个的语句<?php wp_footer(); ?>,如果没有则该插件的JavaScript 不能使用。
SyntaxHighlighter 的使用
在遇到想用程序语法的时候,下面的方式择一使用:
(红色的部分请选择相应的语言)
您的程序代码
您的程序代码
您的程序代码
您的程序代码
您的程序代码
您的程序代码
您的程序代码
您的程序代码
您的程序代码
PHP范例
1.&amp;lt; ?php 2.define(‘ABSPATH’, dirname(__FILE__).‘/’);&amp;lt;span class=&amp;quot;MyColor1&amp;quot;&amp;gt;&amp;lt; ?php wp_footer(); ?&amp;gt; 3.require_once(ABSPATH.‘wp-settings.php’); 4.?&amp;gt;CSS范例
1.div.Test { 2. width: 190px; 3. font-size: 13px; 4. font-family: Verdana, Serif; 5.} /* 测试 */JavaScript范例
1.var a = 1; 2.var b = 5; 3.flag1 = new Boolean(a &amp;lt; b); 4. document.write(&amp;quot;1 &amp;lt; 5 是 &amp;quot; + flag1); 5.flag2 = new Boolean(a &amp;gt; b); 6. document.write(&amp;quot;1 &amp;gt; 5 是 &amp;quot; + flag2);
Hmm… I read blogs on a similar topic, but i never visited your blog. I added it to favorites and i’ll be your constant reader.
In truth, immediately i didn’t understand the essence. But after re-reading all at once became clear.
I really like your blog and i respect your work. I’ll be a frequent visitor.
these words made me stronger. i really loves this a lot!
I want this blog,hi
Here is my magical moment. I want to share it with you.
thank you so much for sharing those moments with us…it made want to do the same path…
Just wish to thank you for all the lights that you put on my path via your quotes, your themes, your issues, your works.
Carpe diem and love are always in my heart
Beautiful, I hope the universe opens an opportunity for me to be able to visit this!
Yes, to learn what your very own signs are. It can be a fun experience.