Hyperlink to Pluto notebook

Hi all,

In Jupyter, it is possible to link one notebook to another using relative paths. However, this does not appear to work with Pluto. Here is what I tried:

md"""
# [my link]("my_notebook.jl")
"""

The linked page said “not found”.

How can I link to another notebook?

you can do

md"""
[my_link](./open?path=my_notebook.jl)
"""

@lungben, thank you. This is really close to what I need. I need to specify a path relative to the current working directory. Unfortunately, my attempts to modify your code did not work. Here is what I did:

path = pwd()
md"""
[my_link](./open?path=$(path)/my_notebook.jl)
"""

Error:
Please check whether /home/dfish/.julia/pluto_notebooks/$(path)/my_notebook.jl exists.

Is there a way to interpolate the path variable? I thought that $() would work.

String interpolation seems not to work inside a hyperlink with the md macro.
But you can do

notebook_path= joinpath(pwd(), "my_notebook.jl")

Markdown.parse("[my_link](./open?path=$notebook_path)")
1 Like

Thanks @lungben. Do you know of a way to suppress Markdown.parse from printing in the markdown?

Here is what I did:

	md"""
	Click on this link
	Markdown.parse("[my_link](./open?path=$notebook_path)").  More info
	"""

And it outputs the following:

Click on this link Markdown.parse("my_link"). More info

Also the link does not work. The link does work if I use Markdown.parse by itself in a separate cell.

Write Markdown.parse() as Julia code, not in a md"" string block.

I was hoping to integrate the link into some text. Is that not possible?

You can put your whole text inside of Markdown.parse(). It essentially does the same as the md string macro (in fact, md internally calls Markdown.parse()), except that it takes a “normal” string as input, where interpolation works slightly different than in the md string macro.

Ah. I understand now. Thank you for your help!

1 Like