yosssi/ace

How to add javascript of type module?

Closed this issue · 1 comments

I need to add the following to my ace template:

<script type="module">
    import mermaid from "/assets/js/mermaid.esm.min.mjs"
    mermaid.initialize({ startOnLoad: true });
</script>

When I use script:

script type="module"
  import mermaid from "/assets/js/mermaid.esm.min.mjs"
  mermaid.initialize({ startOnLoad: true });

it renders:

<script type="module">.<import>mermaid from "/assets/js/mermaid.esm.min.mjs"</import><mermaid class="initialize({">startOnLoad: true });</mermaid></script>

It treats import and mermaid as a tag.

I figured it out - I need to add . after script to declare the following indented lines as a block of text. This works:

script. type="module"
  import mermaid from "/assets/js/mermaid.esm.min.mjs"
  mermaid.initialize({ startOnLoad: true });