htmlToMarkdown

Textarea
stable

Converts a pre-sanitised HTML string (as produced by OrigamTextareaField in rich mode) to a Markdown string. Only the subset of tags emitted by the rich toolbar is translated; everything else is unwrapped and its text content kept.

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

input
requis
string
A pre-sanitised HTML string. Null, empty string, and non-string values are returned as an empty string. If DOMParser is unavailable (SSR), the input is returned as-is.

API

Valeur de retour

La valeur retournée par cet util.

The Markdown representation of the HTML content. Returns an empty string when input is null or empty.

Usage

Exemples

Extraits de code prêts à coller.

Convert bold and italic HTML

typescript