Markdown(Javascript)=>HTML ?

For an internal project , I need to convert markdown text to HTML in a preview mode with a Javascript implementation. The right choice is the Showdown javascript implemenation: Just after downloading the needed showdown.jsfile, you will be able to integrate it in your HTML page with a small JQuery javascript : $(function() { // When using more than one `textarea` on your page, change the following line to match the one you’re after var $textarea = $(‘textarea’), $preview = $(‘

‘).insertAfter($textarea), converter = new Showdown.converter(); $textarea.keyup(function() { $preview.html(converter.makeHtml($textarea.val())); }).trigger(‘keyup’); }); Thanks to Mathias Bynens for the smaple implemenattion. Et voilà ! Have fun ! McG.

Les commentaires sont fermés.

Propulsé par

Retour en haut ↑

%d blogueurs aiment cette page :