Hi; a couple years back I wrote a IPython magic to allow me to embed pythontutor visualizations
I’m currently trying to do something similar with codepen; to no avail so far
outside of the notebook, the logic is rather simple: clicking on the ‘embed’ button in codepen allows to cut-and-paste a fragment of html, that does the trick
however that fragment contains this js-loading tag
<script async src="https://cpwebassets.codepen.io/assets/embed/ei.js"></script>
which, I suspect, gets sanitized when inserted literally in a markdown cell
what would be the simplest way for me to somehow add this particular js script to the notebook environment ?
I still need to try this out, my first idea would be to tweak
custom.js and use the trick from here https://stackoverflow.com/questions/14521108/dynamically-load-js-inside-js i.e. something along the following lines
let script = document.createElement('script') script.src = "https://cpwebassets.codepen.io/assets/embed/ei.js" document.head.appendChild(script)
but before I go any further, I was wondering whether some cleaner mechanism was already in place to manage similar dependencies
thanks for any clue !