code tag

  • Unknown's avatar
  • Unknown's avatar

    Sorry for the earlier empty post, my bad!

    The <code></code> tag does not show the indentation. Any suggestions for displaying code in posts?

    Regards,
    Abhijit.

  • Unknown's avatar

    The indentation (I believe) is specific per theme, dependent on what is set in the theme’s CSS.

    The code tag itself will just allow you to show html (and stuff) without the editor translating or stripping it.

    Collin

  • Unknown's avatar
  • Unknown's avatar

    <pre> does work, but in most of the themes, the font size is too small to be readable. <code> should maintain the formatting and indentation, otherwise a block of code in that will not be readable. I have tried this in multiple themes.

  • Unknown's avatar

    Only thing I can think of is encoding the code in question and placing it within blockquotes.

    But, of course, blockquotes don’t indent on all themes….

    Could always do a table with an extra column on each side, still encode your code and place it in the middle with empty &nbsp;‘s on either side.

  • Unknown's avatar

    iface: CODE is a ‘Phrase’ (i.e. inline) element, hence it won’t preserve formatting. it just renders text enclosed with a CSS-monospaced font face.

    the only legitimate (as of 4.01) way to preserve formatting *and* indentation of long (multi-line) fragments of code is to use a PRE element (PREformatted).

    you may file a feedback asking to change appropr. CSS style, but actually those who really have to use a web-browser*) to read sources (probably web2.0 enthusiasts ;-) use custom <PRE> and .monospaced font size and face of their own.

    so it won’t be a problem for them to see a precious masterpiece of the code poetry.

    *) usually people who read sources master some other tools besides browser

  • The topic ‘code tag’ is closed to new replies.