Repository navigation
Description
Bug description
Hello all, I'm a new Quarto user and have been having a great time. Thank you ❤️
I'm using Quarto 1.2.335 via conda-forge on Ubuntu 20 LTS. I'm not using the RStudio IDE, just editing with vi.
I've been building a presentation which consists of several revealjs slide decks, and I want those to render to GH Pages, and that's working great. However, since I have multiple slide decks, I also want to render an HTML index page which includes links to all the slide decks. This seems to render correctly, but does not preview as expected; on the first run the slides appear as an HTML page using the "cosmo" theme instead of a revealJS presentation. Only after a hot-reload or re-run of the preview command do the slides appear as slides.
I was not able to make a reproducible example in a single QMD file, but my process to reproduce this issue was:
- Create project template
quarto create-project sscce-quarto-slides-in-website --type website - Create
slides/index.qmdwithformat: 'revealjs'in front-matter - Add link from
index.qmdtoslides/index.qmd quarto preview index.qmd- Click the link to view the slides, and it will display as an HTML page, not a RevealJS presentation
- CTRL+C on the
previewprocess, and run it again. - Click the link to view the slides, and it will display as a RevealJS presentation
- Delete the
.quartoand_sitedirectories, do a preview, and the slides will again display as a HTML page, not a RevealJS presentation
I've created a repository with the project state that reproduces the issue, and the details of the issue in README.md: https://github.com/MattF-NSIDC/sscce-quarto-slides-in-website
Checklist
- Please include a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
- Please format your issue so it is easier for us to read the bug report.
- Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
- Please document the operating system you're running. If on Linux, please provide the specific distribution.
Activity
cscheid commentedon Feb 22, 2023
Thanks for the report! Any chance you can try this with our 1.3 prerelease versions as well?
MattF-NSIDC commentedon Feb 23, 2023
I will try this. I have only installed Quarto using
condabefore now, so it may take me a minute :)MattF-NSIDC commentedon Feb 23, 2023
That was quick and easy, thank you :) I installed the Ubuntu distribution
quarto-1.3.217-linux-amd64.deband the behavior is the same as in the original report: I get different results after running preview twice. On 1st preview I get an HTML page for my slide deck (unexpected), and on 2nd preview (IFF I leave the_siteand.quartodirs in-place) I get a RevealJS presentation that works exactly the way I expect.cscheid commentedon Feb 23, 2023
This is ultimately the same problem as we discussed on the other issue, right?
MattF-NSIDC commentedon Feb 23, 2023
It looks to me like this is a similar issue to #4470 , but I think not the same user error and not the same solution: I'm still seeing this problem after applying the solution we discussed to #4470 .
I think the issue is: when running
preview,slides/index.htmlis rendered both withrevealjsformat (because it's specified in front-matter or_metadata.yml) andhtmlformat (because it's specified in_quarto.yml). The output filename is the same for both, so only one can exist after the render. I don't understand why the file that "wins" is different on first or second preview. Race condition?Is there a way I can tell Quarto not to render the content in
slides/ashtmland only render asrevealjsformat so the "clobbering" can't happen?MattF-NSIDC commentedon Feb 23, 2023
I tried to hack my way to my desired outcome by editing
slides/_metadata.ymlto make the undesired output have a non-conflicting filename, but that had similar issues with link-generation (my link toslides/index.qmdnow points to the plain HTML output, not the slide, and with the wrong filenameslides/index.plain.html.plain.html):cscheid commentedon Feb 23, 2023
I expected that metadata merging of the
formatto be smart in that it should be setting the format rather than adding a new one (this is special behavior forformat). You can see this behavior in action by settingon
test.qmdin a new website, and note how we don't buildtest.htmlandtest.pdffiles. I wonder if this is a bug with_metadata.ymlspecifically.cscheid commentedon Feb 23, 2023
I'm now having a hard time reproducing your issue.
I've created a barebones quarto website project, then created a subdirectory called "slides" with two files:
slides/_metadata.ymlslides/file.qmd## Hello How will this render?All of these show a revealjs file:
quarto preview slides/file.qmd,quarto preview(and then navigating to slides/file.html)quarto render slides/file.qmd(and then inspecting the result)MattF-NSIDC commentedon Feb 23, 2023
I followed those steps and
quarto previewbehaves exactly as expected (thank you!), butquarto preview index.qmdreproduces this issue.Does the issue reproduce for you if you do
quarto preview index.qmd?I got into the habit of explicitly specifying a file to preview when I was working on my slides project (also my first Quarto project), because I didn't have an index file initially. Is the behavior of
previewsupposed to be different between these two invocation styles?MattF-NSIDC commentedon Feb 23, 2023
Forgot to specify: before running
quarto preview index.qmd, please delete_site,.quarto, andsite_libs(if present), and I think the issue should reproduce on first run, but not reproduce on second run.cscheid commentedon Feb 23, 2023
I can totally repro that, and it's a bug! Thanks.
MattF-NSIDC commentedon Feb 23, 2023
@cscheid Thank you! I think I'm noticing another aspect to this issue.
quarto preview(no[file]argument), and load up the slide fileindex.htmland savecscheid commentedon Feb 23, 2023
@jjallaire @dragonstyle
This is an interesting one. Here's the full story:
Now click on the "slides" link, and this will show an html render, not a revealjs render.
however, if you repeat the whole thing, and type
quarto previewinstead ofquarto preview index.qmd,slides/file.htmlrenders correctly as revealjs (!?)MattF-NSIDC commentedon Feb 23, 2023
I noticed another weird thing!!!
Once you have
file.htmlrendering correctly as revealjs usingquarto preview, trigger a hot reload by editingindex.qmdand it will no longer render correctly. Trigger another hot reload by editingslides/file.qmdand it will be back to rendering correctly as revealjs. It seems to matter which file triggers the hot reload.Thank you so much for your help today. It's been extremely valuable. ❤️ Quarto & team! :)
cscheid commentedon Feb 24, 2023
(Note to yourselves, serveProject is getting
to: htmlsomehow and that overrides things)jjallaire commentedon Feb 26, 2023
This occurs b/c we pin the preview format here:
https://github.com/quarto-dev/quarto-cli/blob/main/src/command/preview/cmd.ts#L267
I don't however think we should fix this right now because I don't fully recall what the purpose of that line of code is (it could easily be e.g. to facilitate proper switching between HTML and PDF formats for books). Further, I think part of the reason we put this in is that the preview server actually runs in different modes (presentation vs. non-presentation) and we actually want it to restart itself when a presentation is previewed. Again, it might be fine to remove that line of code or it might not be fine (requires more experimentation).
One note is that if you just render the slides once then they will indeed show up correctly as slides. This problem is restricted to a fresh preview of a site that hasn't been previously rendered.
Going to move this to v1.4 so we can take a closer look when we are less pressed for time.
mfisher87 commentedon Feb 27, 2023
Interesting! what's the difference between presentation mode and non?
FWIW, it also re-occurs if you trigger a hot reload by editing a non-slide file.