Relative image paths in presentations? #6028
-
DescriptionHello, sorry if I missed this in the docs/issues/Q&A, this seems really simple but I can't seem to find the answer anywhere. I have a latex project, and now I want to create some slides to go along with it. My folder structure looks like:
Now in my presentation if I create a normal markdown file # Test
 It works as expected. If I then change the file type to .qmd and render in VSCode, it runs ❯ quarto preview test.qmd --no-browser --no-watch-inputs
pandoc
to: html
output-file: test.html
standalone: true
section-divs: true
html-math-method: mathjax
wrap: none
default-image-extension: png
metadata
document-css: false
link-citations: true
date-format: long
lang: en
Output created: test.html
Watching files for changes
Browse at http://localhost:6576/
/figures/test.png (404: Not Found) And the image doesn't show up, presumably because the path is messed up. But if I look at the HTML file directly, it correctly contains How do I get relative image paths to work correctly, without duplicating the entire figures folder, or creating a symlink (which seems like a hack to me)? Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I believe this is because So overall, this is behaving as a web server would behave. You need to serve the files and folders in a way all the resources are found. Did you try already to use a Quarto project (type You could also consider your project as a Quarto website, with only a HTML revealjs presentation as index page. However, being a website resources would be identified and copied for you to If you want some structure like this, I would consider Quarto projects. Otherwise, you could also use self contained document with resources embed (but this has limitation depending on the feature use and size limit you want). We recomma
Does not seem like a hack to me. It is quite common on some system to solve such path issues. Though, it would not solve the deployment because if you wanted to publish only Hope it helps understand how path and web servers work |
Beta Was this translation helpful? Give feedback.
I believe this is because
quarto preview test.qmd
will run the preview server from the document root itself.If you were to publish your document on the web, you would need to publish the
../figures
folder too and not only your document. This means the real root of your HTML presentation isprojects/
and notpresentation/
.So overall, this is behaving as a web server would behave. You need to serve the files and folders in a way all the resources are found.
Did you try already to use a Quarto project (type
default
) and preview the project itself ? Previewing from the root would probably solve your path issue.You could also consider your project as a Quarto website, with only a HTML revea…