问题
Dear ipython notebook users,
I want to insert a link to a local file located in the notebook directory, and no, it is not an image (the only example I've found). I want to insert this link within a markdown cell.
When clicked on the link, the file is to be opened with a local application (in this case, a molecule viewer)
I've tried to come up with the correct syntax, but no luck. Please, any help is greatly appreciated.
回答1:
I want to insert a link to a local file located in the notebook directory
I want to insert this link within a markdown cell.
The path need to be relative to where the server has been started, and prefixed with files/
.
e.g: [my molecule](files/molecules/ethanol.mol)
the file is to be opened with a local application (in this case, a molecule viewer)
Not possible unless your application support custom links protocol like the itunes://
or apt-get://
one. the best that can append is that on link click you will be prompted to download the file. (keep in mind that the server can be on a different machine thant your browser)
回答2:
completenting the answer of Matt, it will work only in you import FileLink
from IPython.display import FileLink, FileLinks
FileLink('path_to_file/filename.extension')
Then in a markdown cell insert your links waterBox30.pdb
来源:https://stackoverflow.com/questions/18137913/how-to-insert-a-link-to-a-local-file-into-a-markdown-cell