WP-dp.SyntaxHighlighterにしようかとも思いましたが、以前から使用していて慣れているこちらに。ダウンロードはここから。syntax_hilight-1.3.phpで、bタグを小文字で出力するように、BEGIN enscript、END enscriptというコメントを出力しないように、preタグにclass=”syntaxhilighter”を追加するように修正。また、cssファイルを使用するために以下を追加。
<?php
function meta_syntaxhilighter() {
$css = get_settings('siteurl') . '/wp-content/plugins/syntax_hilight.css';
echo '
<!-- for Syntax Highlighter Enscript -->
<link rel="stylesheet" type="text/css" href="' . $css . '" />
';
}
add_action('wp_head', 'meta_syntaxhilighter');
?>
syntax_hilight.cssは、PHP Hilight Stringのcssを少し変更して以下のように定義。
pre.syntaxhilighter {
-moz-border-radius: 5px;
background-color: #F9FBFC;
border: 1px solid #C3CED9;
padding: 8px;
margin-bottom: 5px;
width: 95%;
overflow: scroll;
text-align: left;
font: normal 9pt 'Courier New', monospace;
}
コンソールからGNU Enscriptをインストール。
$ sudo aptitude install enscript
コードの色付けにはGNU Source-highlightを使うようにしてもいいかも。

0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.
Leave a Comment