How do I get WordPress to format leading spaces?

I'm trying to post some code snippets on my WordPress blog, but when I copy and paste, it removes all leading spaces from every line of code. It seems to have no problem with leading spaces in general, as I can add them back in manually, but they don't like being inserted for whatever reason.

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

+2


source to share


2 answers


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

<pre></pre> 

      



tags. Then format the CSS appropriately in your theme.

Here's a Description of Wordpress

+5


source


I would use the FCKEditor plugin (now called CKEditor), http://www.deanlee.cn/wordpress/fckeditor-for-wordpress-plugin/ . I find it performs much better than TinyMCE's built-in 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.



+1


source







All Articles