markdown(text) Last updated: 24. Apr 2026
Converts Markdown-formatted text to HTML.
Parameters
| Name | Type | Description |
|---|---|---|
| text | string | The Markdown-formatted text to convert to HTML. |
Returns
String containing the HTML representation of the input Markdown.
Example
Code example (#JS)
#JS is mixed HTML (or other text file) with inline JavaScript with # starting and ending each inline statement.#{
// Convert Markdown to HTML
let md = "# Hello World\n\nThis is **bold** and *italic*.\n\n- Item 1\n- Item 2\n- Item 3";
let html = docly.markdown(md);
write(html);
}# Output
The #JS code above produces the output shown below:<h1 id="hello-world">Hello World</h1>
<p>This is <strong>bold</strong> and <em>italic</em>.</p>
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>