ForgeTotal.js 5
ro

Total.js 5

Convertirea Markdown în HTML

Total.js 5 · total5@0.0.19 contentmarkdown Executată cu Total.js 5

Total.js adaugă markdown() șirurilor. Transformă titlurile, accentele, listele, linkurile, codul și tabelele în HTML și escapează etichetele HTML brute din text. Dă un obiect de opțiuni ca să alegi ce se convertește; cele utile sunt ul, links, formatting, headlines, code, tables și linetag (eticheta folosită pentru paragrafe).

controllers/content.js
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);
}