# Convertire Markdown in HTML

> Usa il prototipo String.markdown() per rendere testo Markdown in HTML, per contenuti salvati dagli utenti o in file.

Framework: total5
Product: Total.js 5 (total5@0.0.19)
Language: it
Content-SHA256: e62b8efa750d49e528d68d35bcddbbcd47120d0e49174807563aacb0311b6392
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: total5-installed@total5@0.0.19
Review: not-recorded

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).

```js 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);
}
```
