The Hyphen, Hyphen, Double-Dash Dilemma

If you have been following along with my recent posts, you know that I had some difficulty in posting a bit of html code recently. The reason for the difficulty is that WordPress (which powers my blog) doesn’t like to display certain non-alphanumeric characters in duos. In particular it sometimes truncates double spaces (  ) and double hyphens (–) by only displaying a single space or hyphen.

Normally this is pretty innocuous.  At worst I have to paste in a dash when I want more than one hyphen displayed.  I use this all the time (—).  That works fine when I am using the dash as a grammar element.  However, when I am displaying code for users to copy—or merely to read—I can’t simply substitute the dash for the double hyphen.

I was pointed to a new WordPress plugin called SyntaxHighlighter Plus (here and here).  This is based on SyntaxHighlighter by Alex Gorbatchev.

This plugin allows me to surround various kinds of code in a new tag as follows:

Code Goes Here

Using this method will produce a formated code box with numbered lines of code:

[CODE=”HTML”]


Hello, World!


[/CODE]

The sourcecode tag supports at least the following code types: cpp, csharp, css, delphi, html, java, jscript, php, python, ruby, sql, vb, and xml.  I’m not clear how much the code type you enter matters because I used html for my code which contained both html and php. The type will adjust the format highlighting; however, there are some issues with getting things looking just so and your results will vary.

Best of luck.

Share

One thought on “The Hyphen, Hyphen, Double-Dash Dilemma

  1. You can simply use [CODE=”BASH”][/CODE].

    Yes, bash and even shell seem to be supported types, unfortunately if you want the pointy brackets to show up you’ll have to use html.

Leave a Reply

Your email address will not be published. Required fields are marked *