fsprojects / IfSharp

F# for Jupyter Notebooks
Other
440 stars 71 forks source link

LoadGlobalJavaScript embeds javascript code which crops notebook #226

Closed aprooks closed 4 years ago

aprooks commented 5 years ago

If external js is loaded via LoadGlobalJavaScript whole Javascript get's embedded into a notebook, and then it won't be viewable via GitHub or nbviewer.

See repro in #224

cgravill commented 5 years ago

It's a choice, you can use that approach which is convenient for self-contained notebooks but you can also insert loads from a CDN.

aprooks commented 5 years ago

I could not make it work as self-contained anyway. Cells had to be re-run again in order for content to be rendered.

aprooks commented 5 years ago

Also for customizations and self-containerization suggested the approach is to save .js files on disk and load from notebook instead of embedding js into the notebook itself. 9k extra Loc only for loading a dependency as in provided repro is not fun to read and diff.

cgravill commented 5 years ago

By self-contained I mean a single file so that it can be sent to others without path issues. It's not a context I would diff - personally I prefer wiping output before committing due to the Jupyter security model which is what usually causes me to have to re-run.

LoadGlobalJavaScript is a bit of hack I wrote, but it's doing what I intended it to do. Are you proposing it do something else?

aprooks commented 5 years ago

I'm only suggesting to try to find a workaround for LoadGlobalJavaScript which will not embed the imported library in an output cell. I'm new to Jupiter programming model and could not find a solution by myself.