Markdown naar HTML omzetten
Total.js voegt markdown() toe aan strings. Het zet koppen, nadruk, lijsten, links, code en tabellen om in HTML en escapet ruwe HTML-tags in de tekst. Geef een optie-object mee om te kiezen wat wordt omgezet; handig zijn ul, links, formatting, headlines, code, tables en linetag (de tag voor alinea's).
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);
}