while WIDGET_MODE=json, return a full HTML
document suitable for inject_design_system + iframe. Otherwise None.
"""
s = strip_widget_markdown_fences((raw or "").strip())
if not s or "<" not in s or ">" not in s:
return None
st = s.lstrip()
if st.startswith("{") and "]*>", "", s, flags=re.IGNORECASE).strip()
if any(
tag in low
for tag in (
"