Skip to content

attempting to embed a logo with an img tag (encoded base64) results in a video container for youtube added instead? #822

@kaiserso

Description

@kaiserso

Hi,

I am just starting out with learnr, and was trying to add a logo image to my markdown. However, when I do so, it seems to also add a video tutorial frame to a nonexistent video on youtube?

This is the approach I'm taking:


htmltools::img(src = knitr::image_uri(file.path("logo-small

<img width="204" height="204" alt="Image" src="https://github.com/user-attachments/assets/8eb492ff-d550-4f1f-9633-045fabeaade3" />

.png")), 
               alt = 'course logo',
               style = 'position:absolute; top:0; right:0; width = "100px"; height = "100px"; padding:10px;')

System details

Output of sessioninfo::session_info()():

> sessioninfo::session_info()
─ Session info ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.4.0 (2024-04-24 ucrt)
 os       Windows 11 x64 (build 26100)
 system   x86_64, mingw32
 ui       RStudio
 language (EN)
 collate  English_United States.utf8
 ctype    English_United States.utf8
 tz       Africa/Johannesburg
 date     2025-07-05
 rstudio  2024.04.1+748 Chocolate Cosmos (desktop)
 pandoc   3.1.11 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown)
 quarto   ERROR: Unknown command "TMPDIR=C:/Users/fqm1/AppData/Local/Temp/1/RtmpmMR4SW/file3a6c68dbf9". Did you mean command "install"? @ C:\\PROGRA~1\\RStudio\\RESOUR~1\\app\\bin\\quarto\\bin\\quarto.exe

─ Packages ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 package     * version     date (UTC) lib source
 cli           3.6.5       2025-04-23 [2] CRAN (R 4.4.3)
 digest        0.6.37      2024-08-19 [2] CRAN (R 4.4.3)
 evaluate      1.0.4       2025-06-18 [1] CRAN (R 4.4.3)
 fastmap       1.2.0       2024-05-15 [2] CRAN (R 4.4.0)
 htmltools     0.5.8.1     2024-04-04 [2] CRAN (R 4.4.0)
 htmlwidgets   1.6.4       2023-12-06 [2] CRAN (R 4.4.0)
 httpuv        1.6.16      2025-04-16 [2] CRAN (R 4.4.3)
 jsonlite      2.0.0       2025-03-27 [2] CRAN (R 4.4.3)
 knitr         1.50        2025-03-16 [2] CRAN (R 4.4.3)
 later         1.4.2       2025-04-08 [2] CRAN (R 4.4.3)
 learnr        0.11.5.9000 2025-07-05 [1] Github (rstudio/learnr@a644d2d)
 lifecycle     1.0.4       2023-11-07 [2] CRAN (R 4.4.0)
 magrittr      2.0.3       2022-03-30 [2] CRAN (R 4.4.0)
 mime          0.13        2025-03-17 [2] CRAN (R 4.4.3)
 promises      1.3.3       2025-05-29 [1] CRAN (R 4.4.3)
 R6            2.6.1       2025-02-15 [2] CRAN (R 4.4.3)
 Rcpp          1.1.0       2025-07-02 [1] CRAN (R 4.4.3)
 rlang         1.1.6       2025-04-11 [2] CRAN (R 4.4.3)
 rmarkdown     2.29        2024-11-04 [2] CRAN (R 4.4.3)
 rprojroot     2.0.4       2023-11-05 [2] CRAN (R 4.4.0)
 rsconnect     1.5.0       2025-06-26 [1] CRAN (R 4.4.0)
 rstudioapi    0.17.1      2024-10-22 [2] CRAN (R 4.4.3)
 sessioninfo   1.2.3       2025-02-05 [2] CRAN (R 4.4.3)
 shiny         1.11.1      2025-07-03 [1] CRAN (R 4.4.3)
 withr         3.0.2       2024-10-28 [2] CRAN (R 4.4.3)
 xfun          0.52        2025-04-02 [2] CRAN (R 4.4.3)
 xtable        1.8-4       2019-04-21 [2] CRAN (R 4.4.0)
 yaml          2.3.10      2024-07-26 [2] CRAN (R 4.4.3)

 [1] C:/Users/fqm1/AppData/Local/R/win-library/4.4
 [2] C:/Users/fqm1/AppData/Local/Programs/R/R-4.4.0/library

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Warning message:
In system2("quarto", "-V", stdout = TRUE, env = paste0("TMPDIR=",  :
  running command '"quarto" TMPDIR=C:/Users/fqm1/AppData/Local/Temp/1/RtmpmMR4SW/file3a6c68dbf9 -V' had status 1

Here is an example app that reproduces the problem on my system:


title: "Tutorial: base R"
output: learnr::tutorial
runtime: shiny_prerendered

library(learnr)

knitr::opts_chunk$set(echo = FALSE)

htmltools::img(src = knitr::image_uri(file.path("logo-small.png")), 
               alt = 'course logo',
               style = 'position:absolute; top:0; right:0; width = "100px"; height = "100px"; padding:10px;')

The logo flashes on the screen and then is replaced by the youtube frame. The HTML still contains the reference to the logo, but it doesn't show. I find the behavior happens if I deploy locally or to shinapp.io. The error persists with different browsers (chrome and edge). Replacing the call to htmltools::img or to knitr::image_uri with the output of these commands also does not fix it.

I imagine there is something obvious I am doing wrong? Any help appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions