How can I add type of "importmap" scripts when converting a .typ file to html?

how can I add “importmap” type of script to head element of html?

// a template file used to add script elements to the head element of html
#let itemplate(
  title: "Document",
  lang: "en",
  body,
) = {
  html.elem("html", attrs: (lang: lang))[
    #html.elem("head")[
      #html.elem("meta", attrs: (charset: "utf-8"))[]
      #html.elem("meta", attrs: (name: "viewport", content: "width=device-width, initial-scale=1.0"))[]
      #html.elem("title")[#title]
// when add type of importmap script elements, tinymist always emits a error:
// error message: "HTML raw text element cannot have non-text children",
      #html.elem("script", attrs: (type: "importmap"))[
        {
        "imports": {
        "three": "https://cdn.jsdelivr.net/npm/three@0.185.1/build/three.module.js",
        "three/addons/": "https://cdn.jsdelivr.net/npm/three@0.185.1/examples/jsm/"
        }
        }
      ]
      #html.elem("script", attrs: (src: "../../dist/scripts/script.js", defer: ""))[]
    ]
    #html.elem("body")[
      #body
    ]
  ]
}

please provide some suggestions

use text method to convert raw block to string

#let itemplate(
  title: "Document",
  lang: "en",
  body,
) = {
  html.elem("html", attrs: (lang: lang))[
    #html.elem("head")[
      #html.elem("meta", attrs: (charset: "utf-8"))[]
      #html.elem("meta", attrs: (name: "viewport", content: "width=device-width, initial-scale=1.0"))[]
      #html.elem("title")[#title]
      // #html.elem("script", attrs: (type: "importmap"))[]
      #html.script(
        type: "importmap",
        ```
        {
          "imports": {
            "three": "https://cdn.jsdelivr.net/npm/three@0.185.1/build/three.module.js",
            "three/addons/": "https://cdn.jsdelivr.net/npm/three@0.185.1/examples/jsm/"
          }
        }
        ```.text,
      )
      #html.elem("script", attrs: (src: "../../dist/scripts/script.js", defer: ""))[]
      #html.elem("style")[
        html {display: none;}
        html.loaded { display: block; }
      ]
    ]
    #html.elem("body")[
      #body
    ]
  ]
}

You should probably do the same for the body of <style>.

This is already not a problem for me.

Check another post from me and see if you can provide some suggestions: