Code Tag Whitespace

  • Author
    Posts
  • #21287

    maximilion
    Member

    I know a couple of blogging coder friends, and they seem to have ditched the built-in code tags and use their own plugins, using the WordPress software and their own hosts. I don’t have that option right now, though.

    The major disadvantage of the built-in code tag is that tabs and multiple spaces all get converted to one space, causing beautiful code to become unreadable and ugly.

    I’d like to humbly suggest that multiple spaces are treated as multiple spaces and that a tabsize option be added to the code tag? I.e. <code tabsize=8>my code</code>

    Any possibility for this?

    #21434

    use
    <code><pre>
    some code here
    </pre></code>

    example:
    http://sunburntkamel.wordpress.com/2006/07/03/flickrrss-is-now-a-widget/

    #21477

    maximilion
    Member

    Hey kamel, great tip!

    I notice the tab size is 8, which should suit most ASCII texts, but not all. Any way to change it?

    #21480

    not really sure, no.
    pre stands for ‘preformatted’, so you could try just pasting in something with a different tab size, and seeing if it picks it up.

    i’m not much of an ASCII guy.

    #21578

    maximilion
    Member

    ASCII has no tab size information, no. Each tab is just an ASCII code 9 character. So I guess not?

    #21580

    engtech
    Member

    You could use a text editor that converts tabs to spaces on the fly and then use the code/pre tags.

    #21581

    engtech
    Member

    Have you tried just using the pre tags without the code tag? That’s how I normally put code in HTML.

The topic ‘Code Tag Whitespace’ is closed to new replies.