---
title: Mustache helpers
description: Mustache `TemplateDelimiter` configuration and operation renderers for
  HTML previews and Markdown export.
order: 7
---
Pass `MUSTACHE` as `templates=MUSTACHE` to [`parse_md`](parse.md#parse_md) or [`md2mdhtml`](parse.md#md2mdhtml), paired with [`mustache_pill`](mustache.md#mustache_pill) for HTML preview badges or [`mustache_text`](mustache.md#mustache_text) / [`mustache_code`](mustache.md#mustache_code) for Markdown serialization.

```python
op = {"syntax": "mustache", "action": "var", "name": "client", "form": "inline"}
assert mustache_text(op) == "{{client}}" and mustache_code(op) == "`{{client}}`"
```

## mustache\_pill

```python
def mustache_pill(
    node:dict, # Semantic operation dict (`syntax`, `action`, `name`, `form`, optional `columns`)
    html:str, # Default MDHTML for the node (unused; required by the `callbacks['operation']` signature)
)->str | None: # Styled HTML `<span>` (or `<tr>` for row operations), or `None` for non-Mustache operations
```

*Render a Mustache operation as a styled HTML pill in previews.*

## mustache\_text

```python
def mustache_text(
    node:dict, # Semantic operation dict (`action`, `name`)
)->str: # Canonical Mustache token text (e.g. `'{{name}}'` or `'{{#items}}'`)
```

*Render a semantic Mustache operation in canonical Mustache spelling.*

## mustache\_code

```python
def mustache_code(
    node:dict, # Semantic operation dict (`action`, `name`)
)->str: # Markdown inline code span wrapping `mustache_text(node)`
```

*Render a semantic Mustache operation as a literal Markdown code span.*
