Convertire Markdown in HTML
Total.js aggiunge markdown() alle stringhe. Trasforma titoli, enfasi, elenchi, link, codice e tabelle in HTML ed esegue l'escape dei tag HTML grezzi nel testo. Passa un oggetto di opzioni per scegliere cosa convertire; le più utili sono ul, links, formatting, headlines, code, tables e linetag (il tag usato per i paragrafi).
exports.install = function() {
ROUTE('POST /markdown/', render);
};
function render($) {
var html = ($.body.text || '').markdown({ linetag: 'p', ul: true, links: true, formatting: true, headlines: true, code: true });
$.html(html);
}