Linking to sections

You can use # in a URL to link to a specific section of a Pluto notebook. You can link to:

  • global variables with #variable_name
  • function definitions with #function_name
  • Markdown headers with #header-text (see below for instructions)

Within a notebook

You can use Markdown hyperlinks to link to a different section of the same notebook. For example, if you define a variable fruits = ["apple", "pear"] at the top of your notebook, then you can link to it with:

md"""
Take a look at [the fruits variable](#fruits).
"""

Clicking on the link will jump straight to the definition of fruits.

A section in a notebook online

You can also link to a specific section of a notebook online. For example, if your notebook is hosted at:

https://pluto.land/n/lp7p4qk7

Then I can link to sections by adding the # hash to the URL. For example, to link to the example_step variable:

https://pluto.land/n/lp7p4qk7#example_step

Or I can link to the header โ€œAdding colorโ€:

https://pluto.land/n/lp7p4qk7#Adding-color

Linking to variables and functions

All global variables (and functions, types, etc.) are automatically linkable in Pluto notebooks. The variable name is the link text.

Tip

You can use this to make items linkable! For example, if you want to link to a plot (which usually has no id), you can add a โ€œdummy variableโ€ my_plot = 123 inside the cell that creates the plot, and then link to it with #my_plot.

Linking to Markdown headers

When you hover over a Markdown header, you can click the ๐Ÿ”— button to copy the header id to your clipboard. This will copy a string like #Adding-color to your clipboard, which you can then paste somewhere to use as URL.

screenshot of a Pluto notebook, showing a Markdown header and the button to copy the header id

When you are reading a notebook online (instead of editing on localhost), the button will copy not just the header id, but the full URL to the header, like https://pluto.land/n/lp7p4qk7#Adding-color.

Info

This feature is only available in Pluto 0.20.13 and later.