dslreports logo
site
spacer

spacer
 
    «« DSL Hurdles Share Tool
spc

spacer




how-to block ads



As some of you may have noticed, if you try to post code (HTML, C, or other code), just by pasting it in and hitting PREVIEW, several bad things can happen.

  • Your code loses any formatting.
  • Your code may vanish completely if it contains angle brackets
  • If you spell-check, your code is spell-checked (pointless)
  • You get annoyed

The solution is to use [code] blocks.

Stuff within a [code] block is not mucked with, and is printed in a mono-spaced font, with all spaces (formatting) preserved.

To use a code block within a post, just post like so:

    [code]
    ... (your code goes here) ...
    [/code]

Note: the [code] and [/code] tags MUST APPEAR TO THE LEFT ON LINES BY THEMSELVES. Using [code]...[/code] inline, will not work.

The contents of the code block will be isolated from the post, shown in a mono-spaced font, and all angle and square brackets appear unmolested. Note, in order to preserve the right margin of the website, any lines longer than 90 characters are split, automatically, with notification at the bottom of the code block that this has happened.

Outside of code blocks, in order to use the characters: > < [ and ] use ASCII-ISO 8859-1 codes. These are codes that are specific to individual HTML characters:

    [ = &#91;
    ] = &#93;
    < = &lt;
    > = &gt;

Note: When using ASCII-ISO 8859-1 codes to post with, you can only preview your post once. If you preview twice, the second preview will convert the post. For example:

If you are making a long and detailed post using the ASCII-ISO 8859-1 codes, it is advisable to write it first into notepad and copy and paste it into your post when it is ready. This way you will keep the original coding intact.

Thank you Dooby for this FAQ.

Feedback received on this FAQ entry:
  • I must not be understanding something. I try it many different ways and my code is still converted. I am trying to send my code by email so someone else can use it. if you can email me at rossmcafee@hotmail.com and let me know if i'm doing something wrong that'd be GREAT!

    2008-10-21 21:58:26



Expand got feedback?

by graffixx See Profile edited by howe81 See Profile
last modified: 2004-01-07 17:21:49