When using Jupyter Notebook or Lab with nbdev, a regular python cell can be hidden by putting #hide
at the top of the cell.
I would like to leverage literate programming and use also javascript with magic command, for example like this:
# hide
%%javascript
var kernel = IPython.notebook.kernel;
var body = document.body,
attribs = body.attributes;
var command = "theNotebook = " + "'"+attribs['data-notebook-name'].value+"'";
kernel.execute(command);
But I got the follwing error:
File "/tmp/ipykernel_70002/2768044881.py", line 3
var kernel = IPython.notebook.kernel;
^
SyntaxError: invalid syntax
How to get ride of this error with keeping this cell hidden in the documentation ?