By default pygment requires that php code starts with <?php
for highlighting to work. Enabling startinline
as highlight php startinline
corrects it. For example, below code shows no syntax highlights because pygment generates class=x
for all lines.
if (current_user_can( 'manage_options' ) // Admin allowed || ( ($comment->user_id == $user_ID) // User matches && ( $time_ago < (60 * 24 * 60)) ) // Live for 24 hours ) edit_comment_link(__('Edit', 'sandbox'), ' ', '');
Per pygment documentation for php defining startinline as highlight php startinline
, starts highlighing without a need of <?php
tag as shown below.
if (current_user_can( 'manage_options' ) // Admin allowed || ( ($comment->user_id == $user_ID) // User matches && ( $time_ago < (60 * 24 * 60)) ) // Live for 24 hours ) edit_comment_link(__('Edit', 'sandbox'), ' ', '');