OCaml raw! in HTML renderer + SX_USE_OCAML env promotion + golden tests

- sx_render.ml: add raw! handler to HTML renderer (inject pre-rendered
  content without HTML escaping)
- docker-compose.yml: move SX_USE_OCAML/SX_OCAML_BIN to shared env
  (available to all services, not just sx_docs)
- hosts/ocaml/Dockerfile: OCaml kernel build stage
- shared/sx/tests/: golden test data + generator for OCaml render tests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-22 22:21:04 +00:00
parent df461beec2
commit bb34b4948b
6 changed files with 786 additions and 2 deletions

View File

@@ -205,6 +205,12 @@ and render_list_to_html head args env =
match head with
| Symbol "<>" ->
render_children args env
| Symbol "raw!" ->
(* Inject pre-rendered HTML without escaping *)
let v = Sx_ref.eval_expr (List.hd args) (Env env) in
(match v with
| String s | RawHTML s -> s
| _ -> value_to_string v)
| Symbol tag when is_html_tag tag ->
render_html_element tag args env
| Symbol "if" ->