SyntaxHighter插件

插件名字:syntaxhighlighter.zip

下载地址:https://wordpress.org/plugins/syntaxhighlighter/

启用后,效果示例:

php example

使用要点:

  • 在Wordpress的文本编辑模式下,不要用可视化;
  • 用sourcecode关键字把代码包括起来:

    [sourcecode language=’php’]
    The code is placed here.
    [/sourcecode]

php换成语言类别即可。——打开syntaxhighlighter.php可以看到语言列表,摘录如下:

// Create list of brush aliases and map them to their real brushes
// The key is the language alias
// The value is the script handle suffix: syntaxhighlighter-brush-ThisBitHere  (your plugin needs to register the script itself)
$this->brushes = (array) apply_filters( 'syntaxhighlighter_brushes', array(
    'as3'           => 'as3',
    'actionscript3' => 'as3',
    'bash'          => 'bash',
    'shell'         => 'bash',
    'coldfusion'    => 'coldfusion',
    'cf'            => 'coldfusion',
    'clojure'       => 'clojure',
    'clj'           => 'clojure',
    'cpp'           => 'cpp',
    'c'             => 'cpp',
    'c-sharp'       => 'csharp',
    'csharp'        => 'csharp',
    'css'           => 'css',
    'delphi'        => 'delphi',
    'pas'           => 'delphi',
    'pascal'        => 'delphi',
    'diff'          => 'diff',
    'patch'         => 'diff',
    'erl'           => 'erlang',
    'erlang'        => 'erlang',
    'fsharp'        => 'fsharp',
    'groovy'        => 'groovy',
    'java'          => 'java',
    'jfx'           => 'javafx',
    'javafx'        => 'javafx',
    'js'            => 'jscript',
    'jscript'       => 'jscript',
    'javascript'    => 'jscript',
    'latex'         => 'latex', // Not used as a shortcode
    'tex'           => 'latex',
    'matlab'        => 'matlabkey',
    'objc'          => 'objc',
    'obj-c'         => 'objc',
    'perl'          => 'perl',
    'pl'            => 'perl',
    'php'           => 'php',
    'plain'         => 'plain',
    'text'          => 'plain',
    'ps'            => 'powershell',
    'powershell'    => 'powershell',
    'py'            => 'python',
    'python'        => 'python',
    'r'             => 'r', // Not used as a shortcode
    'splus'         => 'r',
    'rails'         => 'ruby',
    'rb'            => 'ruby',
    'ror'           => 'ruby',
    'ruby'          => 'ruby',
    'scala'         => 'scala',
    'sql'           => 'sql',
    'vb'            => 'vb',
    'vbnet'         => 'vb',
    'xml'           => 'xml',
    'xhtml'         => 'xml',
    'xslt'          => 'xml',
    'html'          => 'xml',
) );

问题:用这个插件后,在打开[sourcecode/]这种有代码的页面时,速度明显下降。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值