0

I'm using markdown in jupyter-notebook (R mode). Is it possible to include a link to a local file? I'm only going to access the notebook locally, so I don't need (or want) to make the local files accessible over the web.

thanks

zed4
  • 173
  • 1
  • 11
  • Possible duplicate of https://stackoverflow.com/questions/18137913/how-to-insert-a-link-to-a-local-file-into-a-markdown-cell – ywbaek Mar 13 '20 at 19:22
  • The solution proposed in this answer is for ipython notebook. It does not work for me, probably because I'm using jupyter-notebook. – zed4 Mar 13 '20 at 20:20
  • Jupyter notebook is just the rebranded IPython notebook. So most things work the same way. – Wayne Mar 13 '20 at 23:19
  • The issue though is you need to import Python to get file links to work (see bottom answer in duplicate) and from what you describe you are using the irkernel? Mobile now so I cannot test if that import works in that kernel. – Wayne Mar 13 '20 at 23:23
  • From [here](https://stackoverflow.com/questions/35298513/using-ipython-magics-in-r-jupyter-notebook), it looks like the IPython approach won’t work in your kernel. I don’t know if Rmarkdown has another way to do that. – Wayne Mar 13 '20 at 23:29
  • Tried [this](https://stackoverflow.com/a/42911034/8508004)? – Wayne Mar 13 '20 at 23:33
  • Rmarkdown itself supports local pathnames. It allows local a pathname in place of a url, e.g. [some text](/a/path/to/somefile.html) works in rstudio Rmd files. This does not seem to work in R jupyter-notebook files. I tried relative paths (i.e. paths relative to base jupyter-notebook directory) as well as absolute paths. In both cases, I get a 'file not found' type error. Perhaps the problem is related to the fact that jupyter-notebook are accessed via a server. – zed4 Mar 14 '20 at 19:18
  • I did try what Wayne suggested, to no avail. FYI "some text" above was suppose to be "some text" in square brackets followed by "/a/path/to/somefile.html" in parentheses. – zed4 Mar 14 '20 at 21:01

0 Answers0