AnchorCMSにSyntax Highlighterを導入した
目次
コードとか綺麗に見せたいよね
Syntax Highlighter is 何
コードに色を付けて綺麗に表示してくれるアレです(どれ)
今回はPrismを使いました
導入方法
DLページから適当にDLするprism.jsをthemes/{your-theme-name}/jsに、prism.cssをthemes/{your-theme-name}/cssに置く
header.phpに以下を追記
<link rel="stylesheet" type="text/css" href="<?php echo theme_url('css/prism.css'); ?>">
<script type="text/javascript" src="<?php echo theme_url('js/prism.js'); ?>"></script>使い方
<pre><code class="language-hogehoge>で囲んであげる
<pre><code class="language-php>
<link rel="stylesheet" type="text/css" href="<?php echo theme_url('css/prism.css'); ?>">
<script type="text/javascript" src="<?php echo theme_url('js/prism.js'); ?>"></script>
</code></pre> phpとかhtmlとかうまくSyntax Highlightされない時があるんですけど助けてください