petfold
**Version:** `@myriaddreamin/typst.ts` 0.7.0 with `typst-ts-renderer` 0.7.0 (browser). `renderSvg({ artifactContent, format: 'vector' })` returns an SVG whose inline `<script type="text/javascript">` contains bare ampersands (`&&`, `n>u&&(t[r]=e,i())`, …). `<` and `>` inside the script are escaped as `<`/`>`, but `&` is not, so the document is not well-formed XML. Inserted with `innerHTML` (the HTML parser) it works, which is how the examples use it. Saved as a `.svg` file and opened directly, or loaded through `<object>`/`<img>`, Chromium and Electron/Chromium stop at the first bare `&` and render only up to it: ``` error on line 81 at column 156287: xmlParseEntityRef: no name Below is a rendering of the page up to the first error. ``` Reproduce: render any document with `renderSvg`, write the string to `out.svg`, open it in a browser tab (or `xmllint --noout out.svg`). Stripping the `<script>…</script>` block yields a file that parses. Suggested fix: wrap the script body in `<![CDATA[ … ]]>` (or escape `&`), and/or add an option to omit the script for static export, since it only serves text selection in the live preview. Context: swarmtyp (https://github.com/petfold/swarmtyp) publishes documents as static Swarm websites; found in `docs/spikes.md` S11.