markdown - Liquid Filter Reference
On this page
Description
Converts a Markdown string to HTML using GitHub-Flavored Markdown (GFM). The output is sanitized using an HTML allowlist — only permitted tags and attributes pass through; all others are stripped.
Permitted HTML tags: p, br, h1–h6, ul, ol, li, a, strong, em, code, pre, blockquote, table, thead, tbody, tr, th, td, hr, del, img, span, div
Permitted HTML attributes: href, src, alt, title, id, class, lang
| Property | Value |
|---|---|
| Return Type | String (HTML) |
| Category | Text |
Syntax
```liquid
{{ string | markdown }} ```
Supported Markdown features
- Headings (
#through######, with auto-generated IDs) - Bold (
**text**), italic (*text*), strikethrough (~~text~~) - Inline code (
`code`) and fenced code blocks with optional language - Links and images
- Ordered and unordered lists (with nesting)
- Blockquotes
- Tables
- Horizontal rules
Examples
Inline formatting
```liquid
{{ “This is bold, italic, and inline code.” | markdown }}
```
Output:
```html
This is bold, italic, and inline code.
```
Headings
```liquid
{{ “# Page title” | markdown }} ```
Output:
```html
Page title
```
Links
```liquid
{{ “Visit our store” | markdown }} ```
Output:
```html
```
Unordered list
```liquid
{{ “- Item 1\n- Item 2\n- Item 3” | markdown }} ```
Output:
```html
- Item 1
- Item 2
- Item 3
```
Ordered list
```liquid
{{ “1. First\n2. Second\n3. Third” | markdown }} ```
Output:
```html
- First
- Second
- Third
```
Using a Liquid variable
```liquid
{% assign description = product.s_c__description__c %} {{ description | markdown }} ```
:::note
If the input is nil or an empty string, the filter returns an empty string.
:::
Was this article helpful?
Thanks for your feedback! It helps us improve our docs.