Europa
Europa

Reputation: 1274

Insert image in RMarkdown bash code using RStudio 1.4

I am trying to create a bash script that loops trough a folder and prints all images.

However the line that should print the image actually doesn't print the image it self, it just prints the text.

```{bash echo=FALSE, comment=""}
echo "![$name]($dir/$file)";
```

Example output:

[dog][images/dog.jpg]

What i want is the actual image of the dog:

enter image description here

Upvotes: 0

Views: 107

Answers (1)

r2evans
r2evans

Reputation: 160407

Add results="asis" to your document.

```{bash echo=FALSE, comment="", results="asis"}
echo "![$name]($dir/$file)";
```

See more at https://bookdown.org/yihui/rmarkdown-cookbook/results-asis.html

(BTW, on my rendering, without results="asis", I see

![](./1RfMf.jpg)

In your output the bang ! is missing.)

Upvotes: 2

Related Questions