diff --git a/docs_src/components/example.html.js b/docs_src/components/example.html.js index f8b06da..8a10c67 100644 --- a/docs_src/components/example.html.js +++ b/docs_src/components/example.html.js @@ -24,17 +24,16 @@ export function example({ src, language= "javascript" }){ }) ) ), - el("script", ` - Flems(document.getElementById("${id}"), { - files: [{ - name: ".js", - content: ${JSON.stringify(code)} - }], - toolbar: false, - }) - `) + elCode({ id, content: code }) ); } +function elCode({ id, content }){ + const options= JSON.stringify({ + files: [{ name: ".js", content }], + toolbar: false + }); + return el("script", `Flems(document.getElementById("${id}"), JSON.parse(${options}));`); +} function register(){ if(loaded) return; document.head.append(