jcu*_*bic 3 php markdown syntax-highlighting jekyll kramdown
我正在使用Jekyll与kramdown和pygments,它适用于javascript或python代码,但当我创建PHP像:
{% highlight php %}
header('Content-Type: application/json');
echo json_encode(array(
'jsonrpc' => "2.0",
'result' => $result,
'id' => $request->id,
'error' => null
));
{% endhighlight %}
Run Code Online (Sandbox Code Playgroud)
每行是一个带有x类的跨度:
<code class="language-php" data-lang="php"><span class="x">header('Content-Type: application/json');</span>
<span class="x">echo json_encode(array(</span>
<span class="x"> 'jsonrpc' => "2.0",</span>
<span class="x"> 'result' => $result,</span>
<span class="x"> 'id' => $request->id,</span>
<span class="x"> 'error' => null</span>
<span class="x">));</span></code>
Run Code Online (Sandbox Code Playgroud)
为什么我的PHP代码没有不同类的令牌?
如果你想忘记代码块开头的php开始标记,你必须将Pygments startinline参数设置为true.
{% highlight php startinline=true %}
Run Code Online (Sandbox Code Playgroud)
请参阅Pygments文档