ui.code
Code
Syntax highlighting done in Python with Pygments — hundreds of languages, zero JavaScript, repainted by the theme.A Python snippet
lang= names a Pygments lexer; the colours come from the theme.from bretzel import refreshable, ui
from bretzel.state import PageState, field
class Cart(PageState):
items: int = field(default=0)
def add_to_cart() -> None:
Cart().items += 1
@refreshable(deps=[Cart])
def cart_button() -> None:
ui.button(f"Cart · {Cart().items}", on_click=add_to_cart)
One request, three languages
Tabs and code blocks: the classic API reference layout.curl https://api.northwind.dev/v1/invoices \
-H "Authorization: Bearer $NORTHWIND_KEY" \
-d customer=cus_8f2a -d amount=428000
A response and a query
200 OK · application/json
{
"id": "inv_2041",
"status": "paid",
"amount": 428000,
"currency": "eur"
}
migrations/0042_overdue.sql
SELECT customer, SUM(amount) AS due
FROM invoices
WHERE status = 'overdue'
GROUP BY customer
ORDER BY due DESC;
A config file
pyproject.toml
[project]
name = "northwind-billing"
requires-python = ">=3.12"
dependencies = ["bretzel>=2.0", "httpx"]
[tool.ruff]
line-length = 100
Plain text
lang defaults to Python; lang="text" shows the text as is, in the monospace font.2026-09-29 09:41:02 INFO worker-3 invoice INV-2041 sent
2026-09-29 09:41:05 WARN worker-1 retrying webhook (2/5)
2026-09-29 09:41:09 INFO worker-1 webhook delivered in 212 ms