Avoid linebreak in empty html tags

Viewed 41

Is it possible to avoid rendering a linebreak when html tags are empty ?

For example

---
output: html_document
---

::: {}
:::

<p></p>

<p>a</p>

The html rendered looks like this :

enter image description here

Instead of getting an empty tag such as <div></div> a linebreak is inserted, how to avoid it ?

It would be useful to detect if a div is empty or not for example. I'm creating dynamic documents and I would like to apply styles to empty div, using the :empty css pseudo element, and it's not considered as empty with the linebreak.

0 Answers
Related