I’ve tried a few WordPress plugins to properly format shell output and the best I’ve found so far is wp-syntax. I simply use lang=”" as using lang=”bash” doesn’t work for me since I use a hash (#) to represent the shell prompt. Anyway, I noticed a problem where using a pipe (|) doesn’t display correctly and looking at the page’s HTML source the pipe seems to get replaced with <PIPE>. Obviously, the browser doesn’t render that and no pipe is displayed. Looking through wp-content/plugins/wp-syntax, I noticed str_replace in geshi/geshi.php that seems to replace | with <PIPE>. I guess it should get replaced again at a later stage but something seems broken. I’ve since changed this code in geshi/geshi.php from:
$result = str_replace(array('<semi>', '<pipe>'), array(';', '~'), $result);
$aTransSpecchar = array(
'&' => '&',
'"' => '"',
'<' => '<',
'>' => '>',
//This fix is related to SF#1923020, but has to be applied
//regardless of actually highlighting symbols.
//Circumvent a bug with symbol highlighting
//This is required as ; would produce undesirable side-effects if it
//was not to be processed as an entity.
';' => '<semi>', // Force ; to be processed as entity
'~' => '<pipe>' // Force | to be processed as entity
); // ENT_COMPAT set
To:
$result = str_replace(array('<semi>', '<pipe>'), array(';', '~'), $result);
$aTransSpecchar = array(
'&' => '&',
'"' => '"',
'<' => '<',
'>' => '>'
//This fix is related to SF#1923020, but has to be applied
//regardless of actually highlighting symbols.
//Circumvent a bug with symbol highlighting
//This is required as ; would produce undesirable side-effects if it
//was not to be processed as an entity.
//';' => '<semi>', // Force ; to be processed as entity
//'~' => '<pipe>' // Force | to be processed as entity
); // ENT_COMPAT set
This seems to that fix the immediate problem, while probably breaking something else (as per the comments).