install a custom.js file in myBinder?

2020-05-01 08:43发布

问题:

I have a public-facing page that I am directing students to on myBinder. To simplify things for the students, I'd like to automatically run all the cells and then hide the cells that they don't need to interact with. I was able to get this to work on my local machine by installing a custom.js file in the ~/.jupyter/custom/ directory. However, I can't seem to figure out how to get the custom.js file working with the public-facing docker image created by mybinder. Is it possible to set up mybinder so that I can run a custom.js file?

回答1:

In a postBuild file you'd place something like the following code:

#!/bin/bash

# Create a custom directory and move the custom.js there
mkdir -p ~/.jupyter/custom
mv custom.js ~/.jupyter/custom/.

See more about postBuild use here in the Binder project documentation.
In this example, I implemented this to hide the Edit app button for Appmode. My custom.js was a file in the main directory of the repository.

(Note: because that file has to be executable you cannot simply make/edit it via the GitHub browser-based interface. As far as I know, you need to work locally and push the executable file back to your repo. There is a sample repo useful as a source of an executable postBuild file.)



标签: python docker