Skip to content

Linking to sections within the same Jupyter Notebook

Rini Banerjee edited this page Jul 28, 2020 · 4 revisions

Links to other parts of the same Jupyter notebook should already work. However, they will not have very meaningful names when displayed to the reader. For example, if we are in the wave1D_fd2.ipynb notebook, we might come across a link like the following:

Clicking this should take us to another section within this notebook, which is called "Implementation of Neumann conditions" in this example. If we double click on the notebook cell, we should see the following Markdown:

[wave:pde2:Neumann:impl](#wave:pde2:Neumann:impl)

The text in the square brackets is what the reader of the notebook sees, while the text in the normal brackets is the reference to this part of the notebook.

What to do

All we need to do here is change the text in the square brackets to the name of the section we are referring to, like so:

[Implementation of Neumann conditions](#wave:pde2:Neumann:impl)

Now, when we run our cell, we should see the following:

and clicking this should take us to the same part of the notebook as before.

Find and replace

Once you have verified that the above works, you can apply this to all links in this notebook by clicking Edit -> Find and Replace. Then click the up-and-down button (as shown below) to replace all occurrences.