Dynamically change relative link extension from IPYNB to HTML when downloading as notebook as HTML?

29 views
Skip to first unread message

4D

unread,
Apr 16, 2018, 10:29:54 PM4/16/18
to Project Jupyter

I currently have a line inside a notebook (File1.ipynb):


[File 2](File2.ipynb)


When downloading both the files as HTML, this link is hard-coded, and hence when I click on the link in the generated File1.html, it can't find the file, because it refers to ipynb and not to html.

I could try:

  • using sed to replace all occurrences of ipynb with html
  • hard-coding html inside the notebook, which will prevent me from using the links when I'm editing the notebook.

But, is there an alternative?


Is there, perhaps, a way to specify two links inside the notebook such that if the browser fails to find the first one, it'll try the second? I tried searching for such a method. I couldn't find it.

Roland Weber

unread,
Apr 18, 2018, 1:46:04 AM4/18/18
to Project Jupyter
How about giving the user a choice?

File 2: [html](File2.html) [ipynb](File2.ipynb)

4D

unread,
Apr 19, 2018, 7:54:28 AM4/19/18
to Project Jupyter
Good idea. Didn't think of that.
Reply all
Reply to author
Forward
0 new messages