开发者

Markdown previewer

I'm using Python markdown with Django.开发者_StackOverflow中文版 It works perfectly. But static HTML previewer it is not enough for an admin panel. I can't find any dynamic JS markdown previewer (I don't need a full converter). Please, advise a javascript markdown previewer.


You're probably looking for showdown.js

Here's an article about it: Using Showdown with and without jQuery

It boils down to this:

var converter = new Showdown.converter();
var input = $("textarea");
var preview = $("#preview");
$(input).keyup(function() {
    preview.html(converter.makeHtml(input.val());
});


As another approach, you can use the free API provided in this page:

https://helloacm.com/markdown/

https://helloacm.com/api/markdown/?cached&s=Markdown rocks!

It will return JSON-encoded data:

"<p>Markdown rocks!<\/p>"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜