Fix double-escaping when render forms (<>, HTML tags) appear in eval position
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 4m30s

Return _RawHTML wrapper so pre-rendered HTML in let bindings isn't
escaped when used in render context.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-03 00:31:31 +00:00
parent ab75e505a8
commit 9754b892d6

View File

@@ -102,9 +102,11 @@ async def async_eval(expr: Any, env: dict[str, Any], ctx: RequestContext) -> Any
return await async_eval(expanded, env, ctx)
# Render forms in eval position — delegate to renderer and return
# the HTML string. Allows (let ((x (<> ...))) ...) etc.
# as _RawHTML so it won't be double-escaped when used in render
# context later. Allows (let ((x (<> ...))) ...) etc.
if name in ("<>", "raw!") or name in HTML_TAGS:
return await _arender(expr, env, ctx)
html = await _arender(expr, env, ctx)
return _RawHTML(html)
# --- function / lambda call ---
fn = await async_eval(head, env, ctx)