Vdom: inject this string as HTML blob

Related to Ocaml/bonsai: simple JS repl : is there a way in virtual-dom to say: take this string, interpret it as a HTML fragment, inject it into the vdom tree ?

The XY problem is: in the repl output, instead of only allowing text output, I want to allow arbitrary HTML-fragment output. [don’t worry about security; this is situation where injection attacks just results in user messing up their own system]

Yup! There is Virtual_dom.Node.inner_html ~tag:"div" ~attrs:[] ~this_html_is_sanitized_and_is_totally_safe_trust_me:{|... your fragment ...|} >.>

2 Likes