r-lib / marquee

Markdown Parser and Renderer for R Graphics
https://marquee.r-lib.org
Other
85 stars 1 forks source link

Error when `text` is just an image #13

Closed teunbrand closed 7 months ago

teunbrand commented 7 months ago

Hi Thomas,

I think the following might be a bug. If trying to render "![](<image>)", a gnarly error message is thrown.

library(marquee)
library(grid)

svgfile <- "https://www.r-project.org/logo/Rlogo.svg"

mq <- marquee_grob(
  paste0("![](", svgfile, ")"),
  classic_style()
)

grid.newpage()
grid.draw(mq)
#> Error in if (any(nchar(PSname, "bytes") > 200)) warning("PostScript font name longer than 200 will be truncated"): missing value where TRUE/FALSE needed

It works fine if there is some text in front of the image.

mq <- marquee_grob(
  paste0("foo![](", svgfile, ")"),
  classic_style()
)

grid.newpage()
grid.draw(mq)

Created on 2024-05-01 with reprex v2.1.0

teunbrand commented 7 months ago

Thanks for the fix 👍