Need help? Check out our Support site, then


Code, Pre, Blockquote

  1. I tend to include a lot of code fragments in my blogs, and I'm particular about the presentation. I finally managed to work out how to get the layout I wanted using a combination of blockquote and code.

    Alas, anything contained within

    has this very nasty habbit of losing formatting between edits. So, for instance, if I write:

    <br /> void<br /> function()<br /> {<br /> ..if ( something )<br /> ....indentedByFourSpaces();<br /> }<br />

    ("."s to represent spacing that I can't get the post editor to retain)

    it will look fine first time around. But if I am using save and continue editing, the formatting has now been deleted so that next time I save it, or if I come back and edit it later, it gets munged down to

    void
    function()
    {
    if ( something )
    indentedByFourSpaces() ; // LIES!
    }

    Is there:
    a) A way to prevent this formatting loss?
    b) A way to enable code and pre tags on the WYSIWYG editor, might make it a lot easier to figure this out.
    c) A way to get the code tag to include pre like code tags everywhere else in the universe? I feel dirty marking code up with pre instead of code.

  2. - Turn off the WYSIWYG editor. You'll have better control over your code anyway.

    - Have you tried encoding your code?

  3. - Have you tried encoding your code?

    As GCC likes to say, "Insufficient context to resolve" :) Point me at an explanation or example and I'll figure it out.

    For now I'm going without the WYSIWYG editor, but that's kinda of a bummer, since the editor was one of the things that helped win me over vs staying at blogger ;) Whether I'm writing in C or English, I always need a preprocessor to catch my flurry of typos :)

  4. where exactly "everywhere else in the universe" <code> includes <pre> and since when?

    beg devs they'd created a decent CSS style for code formatting...

    or use an off-line client to post -- no sweat to typeset smth like this.

    there's even a couple of themes (like BinaryMoon) that use an adequate eligible typeface (height) to render formatted code.


  5. generaldisarray
    Member

    I've had the same problem. The best solution that I have found has been to replace the spaces with the non-breaking space entity (&nbsp). It's a pain, but it works.

Topic Closed

This topic has been closed to new replies.

About this Topic