wp-Syntax wordpress高亮插件使用方法
<p><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>首先简单了解下 wp-Syntax 插件,wp-Syntax 是一个针对wordpress的代码高亮插件,最大的优点是简单易用,兼容性非常好。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><strong style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>wp-Syntax 插件使用方法 </strong><br><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>首先请到 wordpress 官方下载 wp-Syntax 插件。</span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><strong style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>下载后解压安装激活,过程不再赘述。 </strong><br><br><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>下面的操作我们要把 wp-Syntax 插件加入到 wordpress 文章编辑器上面(这一步可选,熟悉代码操作的朋友可以跳过),这样的话不必要我们每次手动输入代码,非常方便。找到\wp-includes\js\quicktags.js这个文件,然后在本页下方下载园子提供修改好的 quicktags.js 文件覆盖,刷新后台页面,在编辑文章时切换到代码模式就可以看到多出一个“syntax”按钮。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>如果您想加入css代码,在输入相应的CSS代码后选中代码,然后点击“syntax”按钮,在弹出窗口中输入对应的语言如“CSS”,这样在发布文章后我们就可以看到代码高亮的效果了。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><strong style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>wp-Syntax 代码高亮代码书写格式为: </strong><br>
</p>
<div style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
<p style="margin: 0px; padding: 0px; outline: none; float: right; line-height: 25.2px; font-size: 14px;">
<span style="line-height: 25.2px; cursor: pointer;"><u>复制代码</u></span></p>
<p>
代码如下:</p>
</div>
<p style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
<br>
< pre lang="html" line="1"> <br>
这里是相关代码…… <br>
< /pre> </p>
<p>
<br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>上面是演示代码,在使用时请自行去掉pre前面的空格。如果不想显示行号去掉“line=”1″”即可! </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>友情提示:代码高亮的效果必须在代码编辑器里面实现,也就是你粘贴的代码一定要在代码编辑器里面,不要在代码和可视化之间来回切换,这样会出现错误。如果不想显示代码高亮效果,按照平时的习惯书写代码即可。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><strong style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>wp-syntax 插件支持的 language 列表: </strong><br>
</p>
<div style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
<p style="margin: 0px; padding: 0px; outline: none; float: right; line-height: 25.2px; font-size: 14px;">
<span style="line-height: 25.2px; cursor: pointer;"><u>复制代码</u></span></p>
<p>
代码如下:</p>
</div>
<p style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
<br>
'actionscript' =&gt; array('as'), <br>
'ada' =&gt; array('a', 'ada', 'adb', 'ads'), <br>
'apache' =&gt; array('conf'), <br>
'asm' =&gt; array('ash', 'asm', 'inc'), <br>
'asp' =&gt; array('asp'), <br>
'bash' =&gt; array('sh'), <br>
'bf' =&gt; array('bf'), <br>
'c' =&gt; array('c', 'h'), <br>
'c_mac' =&gt; array('c', 'h'), <br>
'caddcl' =&gt; array(), <br>
'cadlisp' =&gt; array(), <br>
'cdfg' =&gt; array('cdfg'), <br>
'cobol' =&gt; array('cbl'), <br>
'cpp' =&gt; array('cpp', 'hpp', 'C', 'H', 'CPP', 'HPP'), <br>
'csharp' =&gt; array('cs'), <br>
'css' =&gt; array('css'), <br>
'd' =&gt; array('d'), <br>
'delphi' =&gt; array('dpk', 'dpr', 'pp', 'pas'), <br>
'diff' =&gt; array('diff', 'patch'), <br>
'dos' =&gt; array('bat', 'cmd'), <br>
'gettext' =&gt; array('po', 'pot'), <br>
'gml' =&gt; array('gml'), <br>
'gnuplot' =&gt; array('plt'), <br>
'groovy' =&gt; array('groovy'), <br>
'haskell' =&gt; array('hs'), <br>
'html4strict' =&gt; array('html', 'htm'), <br>
'ini' =&gt; array('ini', 'desktop'), <br>
'java' =&gt; array('java'), <br>
'javascript' =&gt; array('js'), <br>
'klonec' =&gt; array('kl1'), <br>
'klonecpp' =&gt; array('klx'), <br>
'latex' =&gt; array('tex'), <br>
'lisp' =&gt; array('lisp'), <br>
'lua' =&gt; array('lua'), <br>
'matlab' =&gt; array('m'), <br>
'mpasm' =&gt; array(), <br>
'mysql' =&gt; array('sql'), <br>
'nsis' =&gt; array(), <br>
'objc' =&gt; array(), <br>
'oobas' =&gt; array(), <br>
'oracle8' =&gt; array(), <br>
'oracle10' =&gt; array(), <br>
'pascal' =&gt; array('pas'), <br>
'perl' =&gt; array('pl', 'pm'), <br>
'php' =&gt; array('php', 'php5', 'phtml', 'phps'), <br>
'povray' =&gt; array('pov'), <br>
'providex' =&gt; array('pvc', 'pvx'), <br>
'prolog' =&gt; array('pl'), <br>
'python' =&gt; array('py'), <br>
'qbasic' =&gt; array('bi'), <br>
'reg' =&gt; array('reg'), <br>
'ruby' =&gt; array('rb'), <br>
'sas' =&gt; array('sas'), <br>
'scala' =&gt; array('scala'), <br>
'scheme' =&gt; array('scm'), <br>
'scilab' =&gt; array('sci'), <br>
'smalltalk' =&gt; array('st'), <br>
'smarty' =&gt; array(), <br>
'tcl' =&gt; array('tcl'), <br>
'vb' =&gt; array('bas'), <br>
'vbnet' =&gt; array(), <br>
'visualfoxpro' =&gt; array(), <br>
'whitespace' =&gt; array('ws'), <br>
'xml' =&gt; array('xml', 'svg'), <br>
'z80' =&gt; array('z80', 'asm', 'inc') </p>
頁:
[1]