markdown_to_html()
Render Markdown text to HTML (using Markdown Extra). Handy for turning a plain Markdown field into HTML for an email body or a PDF.
Syntax
markdown_to_html(text)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
text |
string | yes | The Markdown source. |
Returns
An HTML string.
Example
$html = markdown_to_html("## " . $record["title"] . "\n\n" . $record["notes"]);
pdf_generate("reports", $record["_meta"]["id"], "pdf", $html, ["filename" => "report.pdf"]);
Example output
<h2>Quarterly review</h2>
<p>Revenue up 12% ...</p>
Notes
- Supports Markdown Extra (tables, fenced code, etc.).
- Pair with pdf_generate() or an email body to render user-entered Markdown.
See also: strip_tags_gf(), pdf_generate()