Skip to content
Log in

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, h1h6, 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

```

```liquid

{{ “Visit our store” | markdown }} ```

Output:

```html

Visit our store

```

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

  1. First
  2. Second
  3. 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?

Was this article helpful?