quarto presentation using relative links outside of presentation folder


I often use the same images/vidoes across lectures. To avoid file duplication, I have a shared_media folder. So my file structure might be something like


Using xaringan I can display media stored either the directory containing the presentation, but also use relative links to grab images/videos from a parent folder. Using quarto, images in parent folders referenced with relative links don't display locally when rendering (maybe they would on my server but when writing the presnetation I need to see the images.

Reproducible example

This zip file contains a reprex.

File structure of reprex:

|-- talks.RProj
|-- repo_eg
     |-- image_weirdness.qmd
     |-- media
           |-- ais_02_cover.png
|-- shared_media
     |-- ais_02_cover.png

Images can be stored either in the media directory of the repo_eg direction (in which the presentation is stored), or in the shared_media folder in the parent directory (talks).

When rendering locally I can display an image from within my project folder using

![](media/ais_02_cover.png){.absolute .fragment bottom="50" right="130" width="300"}

but using

![](../shared_media/ais_02_cover.png){.absolute .fragment bottom="50" right="130" width="300"}

fails even though the image is displayed in the quatro visual editor (i.e. the file path is correct).

My need

Can someone explain why images outside of the presentation folder don't render in quarto but will with xarangin? Is this a local rendering issue and all will be fine once pushed to my github.io? If it is a local problem then is there a workaround? There's so much trial and error with scaling/displaying images that you need to be able to render locally (IMO) while creating the presentation.

1 Like