Posting code snippets
-
I am very frustrated by WordPress’s apparent prejudice against code, and the ‘code’ and ‘pre’ tags in general! I tried switching from ‘code’ to ‘pre’ tags as advised here, but no joy.
On the HTML side of the post-editor, I will place my bounding ‘pre’ tags, put my code in between, (with the whitespace (indents, blank lines, linebreaks) just the way I like it. Then when I switch over to the “Editor” side of the post-editor, the code looks OK, except the editor decided to add an extra linebreak to all of my deliberate linebreaks. Clicking back to HTML, and then back to Editor, I get more linebreaks between the previous spurious linebreaks. As I keep clicking between “Editor” and “HTML”, the post changes every time.
Bizarrely, there comes a point (clicking back and forth), where the code, like an expanding universe inexorably halted by the force of gravity, begins to collapse, until eventually all of my code is on one line.
!!!
Please somebody
(a) tell me what I need to do to get WP.com to display, exactly, byte-for-byte, code that I have worked so hard to look pretty, and/or
(b) fix whatever bugs are causing this odd behavior!Thx any and all for your help!
r
-
Hmmm, still experimenting: it seems if I “Save and continue editing” directly from the HTML editor, the code between the ‘pre’ tags is left as-is … And “Save and continue editing” refreshes me into the “Editor” half of the editor. So maybe the workaround is:
* Click on “HTML” to edit the HTML, add pre-tags, paste&format code
* “Save and continue editing” if I ever want to get back to the WYSIWYG editor…Still, any advice/commiseration/bugfixes are welcome!
-
If you are looking to indent code using non-braking spaces, write, edit and publish from IE.
Firefox and Opera do not respect the -
Thx podz. I haven’t tried IE in a while (usually use Firefox).
Quick test: in IE6, the post editor doesn’t have any helpful buttons (bold, italic, strikethrough, …link, unlink, picture, spellcheck). And I can’t get out of the HTML editor — the “Editor” tab does nothing.
Firefox still OK (except for the WYSIWYG editor inserting all the extra lines still)
Odd. Maybe WP guruz are under the hood right now? Sprung into action in response to my original question?
-
- The topic ‘Posting code snippets’ is closed to new replies.