Share

November 8, 2008

Convert Raw HTML or Code to Escaped HTML

I been posting a few blog posting with code in the posting, i been trying to find some good software to make that task easy.... so far nothing the following steps looks some what promising

  1. Copy your Code into the following tool Convert Raw HTML to Escaped HTML
  2. Copy the Generated code and surround it with a div with a class of code and pre tags
  3. <div class="code">
    <pre>
    ...code ...
    ...code... 
    </pre>
    </div>
    

  4. Add the following CSS to your page
  5. pre {
    white-space: pre-wrap; /* css-3 */
    white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
    white-space: -pre-wrap; /* Opera 4-6 */
    white-space: -o-pre-wrap; /* Opera 7 */
    word-wrap: break-word; /* Internet Explorer 5.5+ */
    }
    .code{
    background-color: #FFFFFF;
    width: 98%;
    border: 1px ridge #999999;
    text-align: left;
    padding-left: 10px;
    padding-top: 15px;
    }
    


let me know what you think... or if you think there is a better way...

NOTE: Some of my old posts that have color code on a while background were done using a Mac OSX Software called Code (http://www.panic.com/coda/) which you can copy any text as XHTML.