# Markdown in HTML umwandeln

> Nutze den Prototyp String.markdown(), um Markdown-Text in HTML zu rendern, für Inhalte von Benutzern oder aus Dateien.

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

Total.js fügt Strings `markdown()` hinzu. Es wandelt Überschriften, Hervorhebungen, Listen, Links, Code und Tabellen in HTML um und maskiert rohe HTML-Tags im Text. Übergib ein Optionsobjekt, um zu wählen, was umgewandelt wird; nützlich sind `ul`, `links`, `formatting`, `headlines`, `code`, `tables` und `linetag` (das Tag für Absätze).

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