Skip to content

Suppress rendering of empty canvas created by graphics device side-effects #96

@yjunechoe

Description

@yjunechoe

This concerns the side-effect of functions like grid::convertUnit() which requests information from the graphics device. If a graphics device is not available, R will open one as a side-effect. The issue concerns whether this then gets rendered as an image.

litedown will render an empty canvas in these cases:

Image

In rmarkdown (and quarto), the rendering is suppressed:

Image

I'm not sure how it's implemented in rmarkdown/quarto, but if it's not too much hassle I think this behavior is desirable to implement for litedown. Please LMK what you think!


Reprex:

f <- tempfile(fileext = ".Rmd")
writeLines("
---
title: reprex
---

```{r}
library(grid)
g <- pointsGrob()
x <- convertUnit(g$x, 'mm')
x
```
", f)
rmarkdown_html <- rmarkdown::render(f)
browseURL(rmarkdown_html)
litedown_html <- litedown::fuse(f)
browseURL(litedown_html)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions