华丽乐章 發表於 2023-9-15 00:00:00

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>
&lt; pre lang="html" line="1"&gt; <br>
这里是相关代码…… <br>
&lt; /pre&gt; </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' =&amp;gt; array('as'), <br>
'ada' =&amp;gt; array('a', 'ada', 'adb', 'ads'), <br>
'apache' =&amp;gt; array('conf'), <br>
'asm' =&amp;gt; array('ash', 'asm', 'inc'), <br>
'asp' =&amp;gt; array('asp'), <br>
'bash' =&amp;gt; array('sh'), <br>
'bf' =&amp;gt; array('bf'), <br>
'c' =&amp;gt; array('c', 'h'), <br>
'c_mac' =&amp;gt; array('c', 'h'), <br>
'caddcl' =&amp;gt; array(), <br>
'cadlisp' =&amp;gt; array(), <br>
'cdfg' =&amp;gt; array('cdfg'), <br>
'cobol' =&amp;gt; array('cbl'), <br>
'cpp' =&amp;gt; array('cpp', 'hpp', 'C', 'H', 'CPP', 'HPP'), <br>
'csharp' =&amp;gt; array('cs'), <br>
'css' =&amp;gt; array('css'), <br>
'd' =&amp;gt; array('d'), <br>
'delphi' =&amp;gt; array('dpk', 'dpr', 'pp', 'pas'), <br>
'diff' =&amp;gt; array('diff', 'patch'), <br>
'dos' =&amp;gt; array('bat', 'cmd'), <br>
'gettext' =&amp;gt; array('po', 'pot'), <br>
'gml' =&amp;gt; array('gml'), <br>
'gnuplot' =&amp;gt; array('plt'), <br>
'groovy' =&amp;gt; array('groovy'), <br>
'haskell' =&amp;gt; array('hs'), <br>
'html4strict' =&amp;gt; array('html', 'htm'), <br>
'ini' =&amp;gt; array('ini', 'desktop'), <br>
'java' =&amp;gt; array('java'), <br>
'javascript' =&amp;gt; array('js'), <br>
'klonec' =&amp;gt; array('kl1'), <br>
'klonecpp' =&amp;gt; array('klx'), <br>
'latex' =&amp;gt; array('tex'), <br>
'lisp' =&amp;gt; array('lisp'), <br>
'lua' =&amp;gt; array('lua'), <br>
'matlab' =&amp;gt; array('m'), <br>
'mpasm' =&amp;gt; array(), <br>
'mysql' =&amp;gt; array('sql'), <br>
'nsis' =&amp;gt; array(), <br>
'objc' =&amp;gt; array(), <br>
'oobas' =&amp;gt; array(), <br>
'oracle8' =&amp;gt; array(), <br>
'oracle10' =&amp;gt; array(), <br>
'pascal' =&amp;gt; array('pas'), <br>
'perl' =&amp;gt; array('pl', 'pm'), <br>
'php' =&amp;gt; array('php', 'php5', 'phtml', 'phps'), <br>
'povray' =&amp;gt; array('pov'), <br>
'providex' =&amp;gt; array('pvc', 'pvx'), <br>
'prolog' =&amp;gt; array('pl'), <br>
'python' =&amp;gt; array('py'), <br>
'qbasic' =&amp;gt; array('bi'), <br>
'reg' =&amp;gt; array('reg'), <br>
'ruby' =&amp;gt; array('rb'), <br>
'sas' =&amp;gt; array('sas'), <br>
'scala' =&amp;gt; array('scala'), <br>
'scheme' =&amp;gt; array('scm'), <br>
'scilab' =&amp;gt; array('sci'), <br>
'smalltalk' =&amp;gt; array('st'), <br>
'smarty' =&amp;gt; array(), <br>
'tcl' =&amp;gt; array('tcl'), <br>
'vb' =&amp;gt; array('bas'), <br>
'vbnet' =&amp;gt; array(), <br>
'visualfoxpro' =&amp;gt; array(), <br>
'whitespace' =&amp;gt; array('ws'), <br>
'xml' =&amp;gt; array('xml', 'svg'), <br>
'z80' =&amp;gt; array('z80', 'asm', 'inc') </p>
頁: [1]
查看完整版本: wp-Syntax wordpress高亮插件使用方法