WordPress themes and converting 2 dashes to a long dash – ndash vs mdash

I’ve had a problem for a while where command line text that contains 2 dashes appears as a long dash when viewed in WordPress.

Even though the line below was entered in the WordPress visual editor with two keyboard dashes (ndash), for many people it comes across as one longer dash (mdash).

$ git clone git://github.com/GoldenCheetah/GoldenCheetah.git –branch release_3.5.0

 

One quick and dirty trick is to go to the text editor and replace normal dashes with straight html  – in the text editor.
Which will appear as:
$ git clone git://github.com/GoldenCheetah/GoldenCheetah.git ––branch release_3.5.0

Or if you are already in the WordPress text editor just highlight the line and select the “code” tab at on the top menu of the text editor, and you get
$ git clone git://github.com/GoldenCheetah/GoldenCheetah.git --branch release_3.5.0

For my purposes I think I will use code going forward to prevent any alteration of my intended syntax.

Leave a Reply

Line and paragraph breaks automatic.
XHTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Comments Protected by WP-SpamShield Spam Filter