6

is there a way in ipython notebook to navigate between cells which are far apart? For example if I have a large notebook and I want to move from a cell near the top of the notebook and then back to one at the bottom. Can I do this? I was thinking there might be a "goto cell 23" command or if not something similar to the mark command in vim. thanks

user2560444
  • 131
  • 1
  • 2
  • 5
  • I don't think it's safe to do goto. You can do In [N] and Out [N] for getting the input and output of cells, where N will be the number of the executed cell, but this number will change when you rerun the cell. – Sleepyhead Apr 16 '15 at 11:02

2 Answers2

7

You can create internal hyperlinks to navigate between cells. Here's how you can do that:

First, define the destination in the cell you want to link with a html anchor tag and give it an Id. For example:

<a id='another_cell'></a>

Note - When you run the above cell in markdown, it will become invisible. You can add some text above the anchor to identify the cell.

Second, create the internal hyperlink to the destination created above using Markdown syntax in another cell and run it:

[Another Cell](#another_cell)

Now, clicking on link should take you to the destination.

Amit Verma
  • 16,117
  • 5
  • 40
  • 48
  • Great solution, this works beautifully without the need for an extension. Important to note that in Jupyter parlance, these are both 'Markdown' cells, not 'Code'. – user7587050 Feb 26 '21 at 00:17
3

There is a table-of-content extension which uses the heading cells to generate a floating toc with hyperlinks. This is quite similar to marks in vim. You can find it here. This extension is also discussed in this question and looks e.g like

enter image description here

Community
  • 1
  • 1
Jakob
  • 16,619
  • 4
  • 64
  • 86