CodeColorer 使用-WordPress

  1. 如需添加Code, 需要禁用可视化,否则会被自动修改.
  2. 使用方法<code lang=”perl” line_numbers=”true” tab_size=”2”> </code>
  3. 其他参数,可能不是很常用:
  • lang (string) – source language.
  • tab_size (integer) – how many spaces would represent TAB symbol.
  • line_numbers (boolean) – when true line numbers will be added.
  • first_line (integer) – a number of the first line in the block.
  • highlight (string) – a comma-separated list of line numbers to highlight (e.g. 1,5,8,9).
  • no_links (boolean) – when false keywords will be represented as links to manual.
  • lines (integer) – how many lines would be block height without scroll; could be set to -1 to remove vertical scrollbar.
  • width (integer or string) – block width.
  • height (integer or string) – height in pixels; used when lines number is greater then “lines” value.
  • rss_width (integer or string) – block width in RSS feeds.
  • theme (string) – color theme (default, blackboard, dawn, mac-classic, twitlight, vibrant).
  • inline (boolean) – when true forces code block to render inside <code></code> tag. Used to paste a single line of code into the regular text.
  • strict (boolean) – when true strict mode will be enabled. By default CodeColorer tries to guess whether strict mode is needed, so this option allows to force it on or off when automatic suggestion is wrong.
  • nowrap (boolean) – when false no horizontal scrollbar will be shown; instead code will be wrapped in the end of code box.
  • noborder (boolean) – when true no border will be shown around the code block.
  • no_cc (boolean) – when true the syntax in code block will not be highlighted, code will be rendered inside <code></code> tag.
  • class (string) – additional CSS classes to add to the wrapper HTML element.

参考网页: https://kpumuk.info/projects/wordpress-plugins/codecolorer/

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
写在前面 用WordPress以来,本站一直是用CodeColorer来实现代码高亮,但原版的汉化不够完全,且与不少主题都冲突,因此本人将原版修改过后使用,并加入了可视化代码插入功能,之前也想发布出来,但因为懒,一直推迟到现在才把它打包出来提供给大家。 CodeColorer CodeColorer是一款基于GeSHi库的WordPress代码语法高亮插件,功能简单,使用方便,是一款比较轻量的插件。 属性说明 属性列表如下,括号内是参数类型.string是字符串;integer是整数;boolean是布尔型(开关),可接受“true” “false”, “on” “off”, 整数 1 or 0. lang (string) – 代码使用的语言。 tab_size (integer) – 用以替换制表符的空格数,可在设置界面更改。 line_numbers (boolean) – 是否显示行号,可在设置界面更改。 first_line (integer) – 指定代码块第一行的行号 highlight (string) – 用于指定整行高亮的代码行行数,参数是用半角逗号分隔的数字串(如 1,5,8,9)。 no_links (boolean) – 当值为false时,关键字将会添加一个到官方文档的链接,可在设置界面更改。 lines (integer) –指定代码块显示的行数,当值设置为-1时,不出现纵向滚动条,可在设置界面更改。 width (integer or string) – 代码块宽度,可在设置界面更改。 height (integer or string) – 代码块高度,当这个高度可显示的行数比lines指定的值大才会生效,可在设置界面更改。 rss_width (integer or string) – 代码块在RSS输出时的宽度,可在设置界面更改。 theme (string) – 代码块颜色风格 (default, blackboard, dawn, mac-classic, twitlight, vibrant),可在设置界面更改。 inline (boolean) – 内嵌模式开关,用于将一行代码插入到文本中。 strict (boolean) – 严格模式的开关。 nowrap (boolean) – 当值指定为false时,过长的行将会被自动换行,以避免出现横向滚动条。 noborder (boolean) – 是否显示边框的开关。 no_cc (boolean) – 当值为true时,code标签将会被解析,但代码块不会有格式。 class (string) – 添加一个新的CSS。 escaped (string) – 当值为false,代码块里的html转义字符不会被转义,如<不会转义为<,默认为false。 What's New? 添加可视化代码插入按钮并汉化界面; 可视化代码插入界面添加Java,CSS两种语言; 兼容官方主题及各种自定义主题; 修复不自动换行时行号显示不正确的问题; 优化高亮代码显示方式,放弃Table布局,改用Div+CSS,兼容多种浏览器乃至IE6以及移动浏览器; 添加代码工具栏,实现一键复制等功能,同样兼容多种浏览器。 等待你们去发现…… 更新时间: 2012-5-27 13:58:36 演示地址: http://lanfei.sinaapp.com/about
写在前面 用WordPress以来,一直是用CodeColorer来实现代码高亮,但原版的汉化不够完全,且与不少主题都冲突,因此本人将原版修改过后使用,并加入了可视化代码插入功能,之前也想发布出来,但因为懒,一直推迟到现在,既然大家希望我提供下载,因此我把它打包出来提供给大家。 CodeColorer CodeColorer是一款基于GeSHi库的WordPress代码语法高亮插件。功能简单,使用方便,是一款比较轻量的插件。CodeColorer支持[ccei_html][cc lang="lang"]code[/cc][/ccei_html] 和[ccei_html]<code lang="lang">code</code>[/ccei_html]两种语法。 属性说明 属性列表如下,括号内是参数类型.string是字符串;integer是整数;boolean是布尔型(开关),可接受“true” “false”, “on” “off”, 整数 1 or 0. lang (string) – 代码使用的语言。 tab_size (integer) – 用以替换制表符的空格数,可在设置界面更改。 line_numbers (boolean) – 是否显示行号,可在设置界面更改。 first_line (integer) – 指定代码块第一行的行号 highlight (string) – 用于指定整行高亮的代码行行数,参数是用半角逗号分隔的数字串(如 1,5,8,9)。 no_links (boolean) – 当值为false时,关键字将会添加一个到官方文档的链接,可在设置界面更改。 lines (integer) –指定代码块显示的行数,当值设置为-1时,不出现纵向滚动条,可在设置界面更改。 width (integer or string) – 代码块宽度,可在设置界面更改。 height (integer or string) – 代码块高度,当这个高度可显示的行数比lines指定的值大才会生效,可在设置界面更改。 rss_width (integer or string) – 代码块在RSS输出时的宽度,可在设置界面更改。 theme (string) – 代码块颜色风格 (default, blackboard, dawn, mac-classic, twitlight, vibrant),可在设置界面更改。 inline (boolean) – 内嵌模式开关,用于将一行代码插入到文本中。 strict (boolean) – 严格模式的开关。 nowrap (boolean) – 当值指定为false时,过长的行将会被自动换行,以避免出现横向滚动条。 noborder (boolean) – 是否显示边框的开关。 no_cc (boolean) – 当值为true时,code标签将会被解析,但代码块不会有格式。 class (string) – 添加一个新的CSS。 escaped (string) – 当值为false,代码块里的html转义字符不会被转义,如<不会转义为<,默认为false。 我的博客: http://lanfei.sinaapp.com/ http://blog.csdn.net/CooLanfei 欢迎访问交流。
写在前面 用WordPress以来,本站一直是用CodeColorer来实现代码高亮,但原版的汉化不够完全,且与不少主题都冲突,因此本人将原版修改过后使用,并加入了可视化代码插入功能,之前也想发布出来,但因为懒,一直推迟到现在,既然大家希望我提供下载,因此我把它打包出来提供给大家。 CodeColorer CodeColorer是一款基于GeSHi库的WordPress代码语法高亮插件。功能简单,使用方便,是一款比较轻量的插件。CodeColorer支持[cc lang="lang"]code[/cc]和<code lang="lang">code</code>两种语法。 属性说明 属性列表如下,括号内是参数类型.string是字符串;integer是整数;boolean是布尔型(开关),可接受“true” “false”, “on” “off”, 整数 1 or 0. lang (string) – 代码使用的语言。 tab_size (integer) – 用以替换制表符的空格数,可在设置界面更改。 line_numbers (boolean) – 是否显示行号,可在设置界面更改。 first_line (integer) – 指定代码块第一行的行号 highlight (string) – 用于指定整行高亮的代码行行数,参数是用半角逗号分隔的数字串(如 1,5,8,9)。 no_links (boolean) – 当值为false时,关键字将会添加一个到官方文档的链接,可在设置界面更改。 lines (integer) –指定代码块显示的行数,当值设置为-1时,不出现纵向滚动条,可在设置界面更改。 width (integer or string) – 代码块宽度,可在设置界面更改。 height (integer or string) – 代码块高度,当这个高度可显示的行数比lines指定的值大才会生效,可在设置界面更改。 rss_width (integer or string) – 代码块在RSS输出时的宽度,可在设置界面更改。 theme (string) – 代码块颜色风格 (default, blackboard, dawn, mac-classic, twitlight, vibrant),可在设置界面更改。 inline (boolean) – 内嵌模式开关,用于将一行代码插入到文本中。 strict (boolean) – 严格模式的开关。 nowrap (boolean) – 当值指定为false时,过长的行将会被自动换行,以避免出现横向滚动条。 noborder (boolean) – 是否显示边框的开关。 no_cc (boolean) – 当值为true时,code标签将会被解析,但代码块不会有格式。 class (string) – 添加一个新的CSS。 escaped (string) – 当值为false,代码块里的html转义字符不会被转义,如<不会转义为<,默认为false。 What's New? 添加可视化代码插入按钮并汉化界面; 可视化代码插入界面添加Java,CSS两种语言; 兼容官方主题及各种自定义主题; 修复不自动换行时行号显示不正确的问题; 优化高亮代码显示方式,放弃Table布局,改用Div+CSS,兼容多种浏览器乃至IE6; 添加代码工具栏,实现一键复制等功能,同样兼容多种浏览器。 等待你们去发现…… 我的博客: http://lanfei.sinaapp.com/ http://blog.csdn.net/CooLanfei 欢迎访问交流。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值