WordPress – Impossible to post Code Snippets?
-
I am a developer who wants to share javascript code snippets he has written by using WordPress posts.
I find that WordPress 2.3 makes this impossible to do
I need to be able to post example code I have written in an unformatted manner, with spaces and HTML code syntax left in place.
In the real world you do this by placing your previously formatted code inside the PRE and /PRE tags. The HTML render engine in your browser does no formatting to the items inside the tags. Simply displaying them as it would plain text.
In the Post editor there is a “CODE” tab you can click on to to enable a “CODE” editor which lets you insert HTML tags. It’s here that you can insert the PRE tag.
BUT
The second you save the code it returns you to the GUI editor which then collapses all your spaces. This makes indentation in your code impossible to achieve. Every single line inside a loop, an if statment, etc.. all start in column one.
You can post once, then never edit it again, but that would be the only option you have.
P.S.
I’ve tried to use the SyntaxHighlighter pluggin instead of the PRE tag to display my code – but it currently has a bug in it which I am waiting to hear back about
- The topic ‘WordPress – Impossible to post Code Snippets?’ is closed to new replies.