The way to insert an image to markdown file is (and it is outside "{r}
")
<center><src="http://ia.media-imdb.com/images/M/MV5BMTg4NzEyNzQ5OF5BMl5BanBnXkFtZTYwNTY3NDg4._V1._CR24,0,293,443_SX214_AL_.jpg"></center>
But I want to make url as a variable. So I tried something like this:
```{r, result='asis'}
url <- "http://www.online-image-editor.com//styles/2014/images/example_image.png"
print(paste("<center><src=\"", url, "\"></center>", collapse=""))
```
But it doesn't work. The result I get
## [1] "<center><src=\" http://ia.media-imdb.com/images/M/MV5BMTg4NzEyNzQ5OF5BMl5BanBnXkFtZTYwNTY3NDg4._V1._CR24,0,293,443_SX214_AL_.jpg \"></center>"
Is there any chance to make the string of characters like on the top of my question so get rid of ## [1]
and quotes?
Markdown syntax for a hyperlink is square brackets followed by parentheses. The square brackets hold the text, the parentheses hold the link.
You can display an image by adding ! and wrapping the alt text in [ ] . Then wrap the link for the image in parentheses () . GitHub supports embedding images into your issues, pull requests, discussions, comments and . md files.
We can do it using inline R code. For example:
```{r, echo=FALSE}
# Define variable containing url
url <- "http://www.online-image-editor.com//styles/2014/images/example_image.png"
```
## Some cat!
<center><img src="`r url`"></center>
## Alternatively...
![](`r url`)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With