jupyter-js-notebook
jupyter-js-notebook copied to clipboard
Links and notebooks/files
One of the core features of the notebook is that notebooks can link through relative links to other notebooks. This allows notebooks to function as proper webpages that can be linked to by other notebooks as well as other web pages. We use this capability ourself in our own docs here:
http://nbviewer.jupyter.org/github/ipython/ipython/blob/4.0.x/examples/IPython%20Kernel/Index.ipynb
Notice that first page has links that are all links to other notebooks in that directory. These links work across the live notebook server, GitHub's rendering and nbviewer. Given this, JupyterLab can't break this critical feature.
Here are some initial thoughts on how we can offer this:
- Visiting a new lab page that has a path to a notebook (
./lab/the/path/notebook.ipynb) should simply open the default JupyterLab view, open the file browser to that path, and then open that notebook in the dock panel. This may require a slight bit of server logic to handle those paths. - Clicking on a link in a notebook or other content in JupyterLab that has a relative path to another notebook, should simply open that notebook in the current JupyterLab by default. This can be accomplished by intercepting the click on the
atag and preventing default and triggering the document open action with that path. Again, the file browser should go to that directory. - If a user holds down command and clicks on such a link, the notebook should open in a new JupyterLab browser tab that follows the idea of point 1.
- Links to relative paths that are not notebooks should follow similar logic. Thus, a notebook should be able to link to a text file and clicking on that text file should open that document in the current JupyterLab tab.
In (1), do you envision the url remaining the path to the file? If so, it gets confusing if the person opens another file in the same dock panel.
I'm fine having a GET request tell JupyterLab what file to open by default. I think it's confusing to have the filename in the URL after JupyterLab has opened, if the person can then open more files, arrange workspace, etc.
On Fri, Apr 8, 2016 at 12:57 AM Brian E. Granger [email protected] wrote:
One of the core features of the notebook is that notebooks can link through relative links to other notebooks. This allows notebooks to function as proper webpages that can be linked to by other notebooks as well as other web pages. We use this capability ourself in our own docs here:
http://nbviewer.jupyter.org/github/ipython/ipython/blob/4.0.x/examples/IPython%20Kernel/Index.ipynb
Notice that first page has links that are all links to other notebooks in that directory. These links work across the live notebook server, GitHub's rendering and nbviewer. Given this, JupyterLab can't break this critical feature.
Here are some initial thoughts on how we can offer this:
- Visiting a new lab page that has a path to a notebook ( ./lab/the/path/notebook.ipynb) should simply open the default JupyterLab view, open the file browser to that path, and then open that notebook in the dock panel. This may require a slight bit of server logic to handle those paths.
- Clicking on a link in a notebook or other content in JupyterLab that has a relative path to another notebook, should simply open that notebook in the current JupyterLab by default. This can be accomplished by intercepting the click on the a tag and preventing default and triggering the document open action with that path. Again, the file browser should go to that directory.
- If a user holds down command and clicks on such a link, the notebook should open in a new JupyterLab browser tab that follows the idea of point 1.
- Links to relative paths that are not notebooks should follow similar logic. Thus, a notebook should be able to link to a text file and clicking on that text file should open that document in the current JupyterLab tab.
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/jupyter/jupyter-js-notebook/issues/158
On Thu, Apr 7, 2016 at 11:07 PM, Jason Grout [email protected] wrote:
In (1), do you envision the url remaining the path to the file? If so, it gets confusing if the person opens another file in the same dock panel.
I'm fine having a GET request tell JupyterLab what file to open by default. I think it's confusing to have the filename in the URL after JupyterLab has opened, if the person can then open more files, arrange workspace, etc. follows the idea
A couple of way so handling this:
- Each time a user changes the active file in the dock panel, we simple update the URL to reflect that. IF we store additional session state (set of open files and where), this gives us sane page reloading.
- After a user clicks away from that initial file, make the URL just the top level lab one.
Once we get the basic stuff, working with file linking, we should just play with it and see what makes more sense (or user test!)
Brian E. Granger Associate Professor of Physics and Data Science Cal Poly State University, San Luis Obispo @ellisonbg on Twitter and GitHub [email protected] and [email protected]
To keep the discussion organized, I'll copy here what I'd posted in #159...
Reasons to want a stable URL for a notebook: this makes it easy to have something to bookmark for often-used notebooks, to reload one open notebook in a different browser (crash, suspected browser bug, etc), or to reload across server sessions (common while developing).
I agree that in a full multi-tab Lab page with potentially many notebooks open, having a URL for the whole page shouldn't reflect one of the notebooks. But I think that in a possibly maximized mode, or other single-notebook mode, the URL should be stable and reflect that open notebook. I suspect one that this is a use case that, if we break it, we'll anger quite a few folks...
Hi,
any update regarding this request? it is actually a nice feature to have to ease the navigation through different notebooks.
Hi @razaina, this work has moved to JupyterLab. Links between local documents are supported in JupyterLab 0.15, opening a document by url is tracked here: https://github.com/jupyterlab/jupyterlab/issues/1075.