如何给wordpress设置代码高亮?

前言:已经忍了wordpress很久了,最基本的markdown都支持不完美,自己的插件也已经停止更新了。所以只能找办法去找插件吧!不过总有变相的办法吧!

[cc lang=”php”]
protocol Config {
typealias ItemType
func append(item: ItemType)
var count:Int {
get
}

subscript(x:Int) -> ItemType {
get
}
}

[/cc]

 

2.给wordpress编辑器增加点功能 (以下代码复制到function.php中就ok)
[cc lang=’c’]
function add_editor_buttons($buttons) {
$buttons[] = ‘fontselect’;
$buttons[] = ‘fontsizeselect’;
$buttons[] = ‘cleanup’;
$buttons[] = ‘styleselect’;
$buttons[] = ‘hr’;
$buttons[] = ‘del’;
$buttons[] = ‘sub’;
$buttons[] = ‘sup’;
$buttons[] = ‘copy’;
$buttons[] = ‘paste’;
$buttons[] = ‘cut’;
$buttons[] = ‘undo’;
$buttons[] = ‘image’;
$buttons[] = ‘anchor’;
$buttons[] = ‘backcolor’;
$buttons[] = ‘wp_page’;
$buttons[] = ‘charmap’;
return $buttons;
}
add_filter(“mce_buttons_3”, “add_editor_buttons”);
[/cc]
 

发表回复

电子邮件地址不会被公开。 必填项已用*标注