evilstreak / markdown-js

A Markdown parser for javascript
7.7k stars 863 forks source link

Keep code format #50

Closed wayn closed 12 years ago

wayn commented 12 years ago

Hi, I want to know how show it works for a code block and keep the codes format. I use it like this function flipbook_theme() { return array( 'flipbook' => array( 'template' => 'flipbook', 'variables' => array('node' => NULL), ), ); } but he shows these code in one line, pls help.

ashb commented 12 years ago

In the currently released version you to get literal code blocks you need to preface all the lines with 4 spaces. I.e. something like below

Look at this code:

    function flipbook_theme() {
       return array(
           'flipbook' => array(
               'template' => 'flipbook',
               'variables' => array('node' => NULL),
           ),
       );
    }
wayn commented 12 years ago

Thank you, ashb. But really I used 4 spaces, but also in one line. This is the site: http//:wayn.info I opend the edit link, can you give me a hand.

ashb commented 12 years ago

Running the above codeblock from my previous reply into the md2html provided by this does what i'm expecting.

What HTML output are you expecting?

wayn commented 12 years ago

I'm use this: markdown.toHTML funtion