I am trying to use Pagedown to convert some markdown into HTML.
I have a div with some markdown in it
<div id="text">
> This is supposed to be a blockquote
1 < 2
</div>
and I’m converting it to HTML with this code
$(function () {
var sanitizer = Markdown.getSanitizingConverter();
var text = $("#text").html();
$("#text").html(sanitizer.makeHtml(text));
});
There is no blockquote, and the left angle bracket (<) in the code block is converted to <.
You can observe my problem on jsFiddle.
What do I have to do to fix this?
Use
.text()when extracting the text from the DOM..html()will encode some symbols as entities.http://jsfiddle.net/fGNsM/3/