how to hyperlink an image in R Markdown

让人想犯罪 __ 提交于 2020-03-03 04:34:46

问题


Based upon my understanding of markdown syntax, this is how you add a hyperlink to an embedded image, yet this does not seem to work using R Markdown. What am I doing wrong?

[![alt text][local path to saved image]][web link]


回答1:


Use this way: ![Alt text](Web link or path)
Examples: ![Image name](img/image.png) or
![Image name](http://www.host.com/image.png)

Combining with the normal syntax for a hyperlink [text](URL), we have:

[![Alt text](Web link or path)](web link to website)

Example:

[![Image name](image.png)](http://www.host.com/link.html)



回答2:


The following worked for me knitted to HTML. The code references an image from a local data store "./data/appStore.png" The image links to the app store url "https://itunes.apple.com/us/app/my-toy-box/id1217665205?mt=8". When hovering over the image the user sees, "My Toy Box on App Store". The alt text "MyToyBox" doesn't appear.

[![MyToyBox](./data/appStore.png "My Toy Box on App Store")](https://itunes.apple.com/us/app/my-toy-box/id1217665205?mt=8)



来源:https://stackoverflow.com/questions/42235301/how-to-hyperlink-an-image-in-r-markdown

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!