Formatting problems and Syntax Highlighting in wordpress

As you may have realized, we use wordpress on our blog. Its simple and easy and nice to use, however it doesnt come without its oddities which can be a pain in the butt for a technical blog.

-- being translated into em-dash
When doing firewall scripts or shell scripts you often use the double dash, or --. In wordpress this is nicely translated into a em-dash — windows like dash. I am unsure why, if i had wanted that i surely would have typed that! This breaks any scripts or patches i happen to paste in unless i use the pre tags. The fix is simple, of course, its a mere hack of the code.
Open up wp-includes/formatting.php and go to line 56. It looks like this

$static_characters = array_merge(array('---', ' -- ', '--', ' - ', 'xn–', '...', '``', ''s', '''', ' (tm)'), $cockney);
$static_replacements = array_merge(array('—', ' — ', '–', ' – ', 'xn--', '…', $opening_quote, '’s', $closing_quote, ' ™'), $cockneyreplace);

Take out the first 4 elements of the array on both lines so it looks like this

 $static_characters = array_merge(array('xn–', '...', '``', ''s', '''', ' (tm)'), $cockney);
$static_replacements = array_merge(array('xn--', '…', $opening_quote, '’s', $closing_quote, ' ™'), $cockneyreplace);

Formatting/Syntax Highlight

Another formatting problem we had was of course syntax highlighting. I love syntax highlighting! and most of the plugins use GeSHi or similar.

We use the WP-Syntax plugin. This allows us to use <pre lang='bash'> code

and does pretty much most languages.

This entry was posted in Rimuhosting and tagged , , , , , , . Bookmark the permalink.

Comments are closed.