views:

98

answers:

2

I'm trying to post some code snippets on my WordPress blog, but when I copy and paste, it strips out all the leading spaces from each line of code. It doesn't seem to have a problem with leading spaces being there in general, since I can add them back in manually, but it doesn't like them being pasted in for whatever reason.

Is there some plugin I can use, or some simple code modification I can make, to make it accept the code I paste in without trying to format it for me?

A: 

I would use the FCKEditor (now called CKEditor) plugin, http://www.deanlee.cn/wordpress/fckeditor-for-wordpress-plugin/. I find it works a lot better than the built-in TinyMCE default editor. The only time I haven't used it is when I have sites that use the qTranslate plugin as it does not currently support CKEditor.

nickyt
+2  A: 

Use the code editor (NOT Visual) and wrap your code in

<pre></pre>

tags. Then format appropriately in your theme's CSS.

Here's Wordpress' explanation

randy melder
Thanks! That worked.
Mason Wheeler