jqueryhtmlcssmarkdownwmd-markdown

Markdown blockquote failure


I'm using this jQuery markdown for my pages. The jQuery code is as follows:

var converter = new Markdown.Converter();
$(document).ready(function(e) {
    $('#content').html( converter.makeHtml($('#content').html()) );
    /* and some more */
});

This has been working perfectly. None of my pages had a blockquote until now. Today, I tried using a blockquote content and the page isn't parsing the HTML correctly.

The text is stored inside a MySQL table. Consider the following:

Just some

> random blockquote content. let's see if it works or not

This text is shown correctly on the markdown editor box:

WMD

But when opening it as a web-page (I use Opera; but the problem is still there in all other browsers, namely Firefox, Chrome and IE)

  1. The normal page shows

    page

  2. Opera Dragonfly

    dragonfly

  3. Raw text as page source

    source

P.S.: All images are thumbnails. Click for larger size.

Here is a fiddle link which shows the above problem: http://jsfiddle.net/atdEP/


Solution

  • Thanks to @Jay I've found a solution to the problem.

    Instead of using .html() in the converter, it performs perfectly with .text().

    var converter = new Markdown.Converter();
    $(document).ready(function(e) {
        $('#content').html( converter.makeHtml($('#content').text()) );
        /* and some more --------------------- RIGHT HERE  >>>^ */
    });
    

    Here is the updated fiddle: http://jsfiddle.net/atdEP/1/