Repository navigation
Fix notebook preview files missing from _site when rendering outside the project - #15009
Merged
Merged
Conversation
…the project directory The notebook previewer forwarded project-relative supporting and resource paths, but the render pipeline expects absolute paths and resolves relative ones against the working directory. They were dropped unless the working directory was the project directory, so the preview page and the downloadable notebook source never reached the output directory.
… the project The preview page and notebook download reach _site through the rendered notebook's href path, so the existing assertions passed even when supporting files were dropped. The figure directory only arrives through the supporting files, so asserting on it covers that half of the fix.
Relative resource entries are already project-relative, so joining them onto the project directory only to relativize them again was a round trip. Converting only absolute entries says what the code needs.
testSite removed only _site, so the project scratch directory survived between runs and a cached state from one render could change what a later render emitted. Removing it in teardown, after all verifications have run, matches what smoke-all does for project directories.
Collaborator
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
The teardown hand-rolled existsSync plus Deno.remove for two directories; removeIfExists in src/core/path.ts already does that and is what other smoke tests use.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a website with embedded notebooks is rendered from a directory other than the project directory (
quarto render proj/index.qmdorquarto render projfrom the parent),_site/index.htmllinks to a notebook preview page that is not in_site. The same goes for the downloadable notebook source and the figures of the preview. Rendering from inside the project works. This is not a regression: it behaves the same in 1.4, 1.10 and 1.11.Root cause
The notebook previewer returns its
supportingfiles as project-relative paths, but the HTML post-process contract expects absolute ones (HtmlPostProcessResultinsrc/format/types.ts). The render pipeline resolves relative entries against the working directory, so they are dropped unless the working directory happens to be the project directory. Files that are not moved to the output directory are then deleted by the notebook context cleanup. The project-relative handling comes from an earlier path fix that had no test coverage.Fix
The previewer now passes absolute supporting paths, and
emplaceNotebookPreviewsonly relativizes resource entries that are absolute, since relative ones are already project-relative.New smoke tests render the site from outside the project for both an
.ipynband a.qmdembed source, and check that the preview page, notebook source and figures reach_site.testSitenow also removes the project.quartodirectory so a cached state from one render cannot change a later one.Fixes #15004
Checklist
I have (if applicable):
AI-assisted PR
Note: autonomous AI agents submitting PRs without human oversight are not permitted — see the Code of Conduct.