Wrapping text around a right-floated image in RMarkdown document.

I believe this is a specificity of the distill framework. You need to customize further the CSS.
If you look at the source of the HTML page, you'll see that the image and the following paragraph are not in the same div. Which impact the way the float works. If you use html_document your CSS should work for example. This is because of the special features for figures:

It seems that adding a div for your text and your figure will get you the expected result. You can add a div using Pandoc fenced div feature for custom block, useful for customizing a document

---
title: test
output: 
  distill::distill_article: default
--- 

Vivamus venenatis egestas eros ut tempus. Vivamus id est nisi. Aliquam molestie erat et sollicitudin venenatis. In ac lacus at velit scelerisque mattis.

Vivamus venenatis egestas eros ut tempus. Vivamus id est nisi. Aliquam molestie erat et sollicitudin venenatis. In ac lacus at velit scelerisque mattis.

::: {.floatting}

```{r out.width='30%', out.extra='style="float:right; padding:10px"'}
knitr::include_graphics("Rlogo.svg")
```

Vivamus venenatis egestas eros ut tempus. Vivamus id est nisi. Aliquam molestie erat et sollicitudin venenatis. In ac lacus at velit scelerisque mattis.
:::

You can further customize looking at more precise CSS for this kind of task.

Hope it helps

2 Likes