diff --git a/README.md b/README.md index 01e12e5..c627d2a 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ JupyterLite deployed as a static site to GitHub Pages, for demo purposes. ## Try it in your browser -➡️ https://quansight.github.io/jupyterlite-demo/ -➡️ https://quansight.github.io/jupyterlite-demo/files/demo.html +- https://quansight.github.io/jupyterlite-demo/ +- https://quansight.github.io/jupyterlite-demo/files/demo.html ## Requirements diff --git a/content/demo.html b/content/demo.html index d7584b7..b69dd89 100644 --- a/content/demo.html +++ b/content/demo.html @@ -30,6 +30,9 @@ .content { padding: 4px } + code[data-run] { + white-space: pre-wrap; + } @@ -98,11 +101,14 @@ } cleanCode += line.substring(indent) + '\n'; } + codeEl.textContent = cleanCode; iframe.src = `https://quansight.github.io/jupyterlite-demo/repl/index.html?kernel=python&toolbar=1&code=${cleanCode}`; - iframe.document.head.appendChild(styleSheet); iframe.style.width = '100%'; iframe.style.height = '300px'; - codeEl.replaceWith(iframe); + iframe.onload = () => { + iframe.contentDocument.head.appendChild(styleSheet); + codeEl.replaceWith(iframe); + } }