I want to insert an image in a rmd file in a book project with bookdown. I also want to click it and a webpage will be popped up in a new tab on a browser.
I figured out a solution, which is:
- to add an image to _book\images
- to run the following html
<a href = "webpage" target ="_blank" rel = "noopener noreferrer">
<img src ="./images/image.png">
</a>
However I feel it may not be a better way. I intend to run a code chunk at first as follows, then run above html.
{r fig0014, echo = F, message = F, warning = F}
knitr::include_graphics("./images/image.png")
When going this route, I did:
- to create a folder called images under the project folder.
- to add an image to this folder.
- to run above code chunk.
The outcome of running the code chunk followed by html is two images are appeared. I have no idea of hiding the image generated from the code chunk.