Fix Quarto website rendering and deployment for mixed-format projects#4048
Conversation
…ats (#4021) Remove the --to html flag from quarto render commands so that Quarto respects each file's declared format (e.g. revealjs) instead of forcing everything to plain HTML. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
…4021) Add smoke tests that render real Quarto content with revealjs format to validate the fix. Tests verify standalone revealjs documents produce slides and mixed-format projects preserve each file's declared format. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Follow-up issue here: #4049 |
| // index.html should NOT contain revealjs | ||
| const indexHtml = fs.readFileSync(indexPath, "utf-8"); | ||
| expect(indexHtml).not.toContain("reveal"); | ||
| }, 60_000); |
There was a problem hiding this comment.
Thanks for these tests! I presume they both fail without the change to quartoProjectHelper.ts?
There was a problem hiding this comment.
I didn't run these specific tests without the change - the reprex the customer gave executing with / without the change seemed like a better validation that we're actually fixing the thing - but this test does prove that the new behavior is correct!
| await helper.render(); | ||
|
|
||
| expect(capturedCommand).toBe(`quarto render "${tmpDir}" --to html`); | ||
| expect(capturedCommand).toBe(`quarto render "${tmpDir}"`); |
There was a problem hiding this comment.
Not related to this PR, but I wonder if we need both the command capture here as well as the similar unit tests in quartoProejctHelper.test.ts? If we do clean it up, IMO it should be in another PR not this one.
There was a problem hiding this comment.
do you mean if the assertions are necessary in all of these tests? I do think the capture here is a little too brittle - but I think we care that QuartoProjectHelper does successfully invoke the mocked terminal with some type of render on these inputs.
@claude can you create an issue to improve how these tests are handling the quarto invocation?
There was a problem hiding this comment.
Claude finished @zackverham's task in 53s —— View job
- Read the smoke test and unit test files to understand the current approach
- Draft and create a GitHub issue for improving quarto invocation handling in tests
Created #4058 to track this. The issue covers the overlap between the command construction smoke tests and the unit tests, and suggests relaxing the exact command-string assertions in the smoke tests to focus on what they uniquely validate (filesystem-to-render-mode integration) while leaving precise command construction assertions to the unit tests.
…4021) When deploying a pre-rendered Quarto website as HTML, the manifest was missing content_category="site", causing Connect to serve only the entrypoint and return 404 for other pages (e.g. revealjs slides). Detect multi-page sites in manifestFromConfig by checking whether the HTML entrypoint lives inside a subdirectory (e.g. _site/index.html). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ne file (#4021) renderContent() passed the relative projectDir (e.g. ".") from the config directly to QuartoProjectHelper. The helper's _quarto.yml disk check resolved relative to the extension host's cwd instead of the actual project directory, causing it to fall through to single- document render. Only the source entrypoint was rendered, skipping other project files like revealjs slides. Resolve projectDir to an absolute path before passing it to the render flow, matching the pattern already used in the publish path. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…4021) Verifies that QuartoProjectHelper detects _quarto.yml correctly with an absolute projectDir but fails with a relative one (e.g. ".") when cwd differs from the project directory. Also confirms that an absolute path triggers a full project render, not a single-document render. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The previous heuristic set content_category="site" for any HTML deployment with a subdirectory entrypoint, which could false-positive on standalone HTML files nested in arbitrary subdirectories. Narrow the check to only known Quarto output directories (_site/, _book/) and remove the unused path import since TOML paths always use forward slashes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…add cwd precondition guard (#4021) - Remove duplicate section divider comment block between test sections - Add explicit precondition check that process.cwd() does not contain _quarto.yml, so a failure in unusual environments is immediately clear - Remove now-redundant inline comment about the guard condition Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Resolve conflict in manifestFromConfig.ts: keep contentCategoryField spread and adopt main's updated comment wording. Fix TS strict error for array index access in contentCategoryField. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Claude finished @zackverham's task in 1m 33s —— View job Code Review Complete
SummaryThis PR fixes three interconnected bugs that prevented deploying pre-rendered Quarto websites with mixed formats. The core implementation changes are well-designed and properly tested. However, there are accidentally committed files that must be removed before merging. Accidentally Committed Files (Blocking)The following files appear to have been accidentally staged and committed. These need to be removed:
Implementation Review1.
|
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
🙄 |
dotNomad
left a comment
There was a problem hiding this comment.
Changes look great. Thank you for the additional test coverage.
| test("relative projectDir '.' only finds _quarto.yml if cwd matches", async () => { | ||
| // Guard: this test assumes cwd does NOT contain _quarto.yml. | ||
| // If it does, the assertion below would pass trivially or fail confusingly. | ||
| expect(fs.existsSync(path.join(process.cwd(), "_quarto.yml"))).toBe(false); |
There was a problem hiding this comment.
I wonder if we can make QuartoProjectHelper handle this in the future so it doesn't need to be passed the absolute dir, but can create it itself.
There was a problem hiding this comment.
@claude can you create a follow-up PR for this?
There was a problem hiding this comment.
Claude finished @zackverham's task in 5m 18s —— View job
- Read current implementation of
QuartoProjectHelperandhomeView.ts - Create a new branch from
main - Move path resolution logic into
QuartoProjectHelper - Update
homeView.tsto passrootDirinstead of resolving path manually - Update tests (unit + smoke)
- Run lint and tests (all pass)
- Push and create PR
Summary
Created follow-up PR #4070 which adds an optional rootDir parameter to QuartoProjectHelper's constructor. When provided, it resolves projectDir against rootDir internally using path.resolve(), so callers like homeView.ts no longer need to resolve paths themselves.
Changes:
quartoProjectHelper.ts— newrootDirconstructor param, resolvesprojectDirinternallyrenders.ts— forwardsrootDirto the helperhomeView.ts— passesthis.root?.uri.fsPathasrootDir- Unit and smoke tests covering relative, nested relative, absolute, and omitted
rootDirscenarios
|
Summary
Fixes #4021 — Three bugs prevented deploying pre-rendered Quarto websites with mixed formats (e.g. HTML + revealjs slides) to Connect.
1.
quarto renderforced--to htmlQuartoProjectHelperpassed--to htmlto everyquarto rendercommand, overriding per-file format declarations likeformat: revealjs. Removed the flag so Quarto respects each file's declared format.2. Relative
projectDirbroke project-level renderingrenderContent()passed the relativeprojectDir(e.g.".") from the config directly toQuartoProjectHelper. The helper's_quarto.ymldisk check resolved relative to the extension host's cwd, not the project directory, so it fell through to single-document render. Only the source entrypoint was rendered, skipping other files like slides. Fixed by resolving to an absolute path before passing to the render flow.3. Missing
content_category: "site"in manifestWhen deploying a pre-rendered Quarto website as HTML, the generated
manifest.jsonwas missingcontent_category: "site". Without this, Connect only serves the entrypoint and returns 404 for other pages. Fixed by detecting multi-page sites inmanifestFromConfigwhen the HTML entrypoint lives inside a known Quarto output directory (_site/or_book/).Test plan
--to htmlremoval (quartoProjectHelper.test.ts)quartoProjectHelper.smoke.test.ts)projectDir(quartoProjectHelper.smoke.test.ts)content_categorydetection (manifestFromConfig.test.ts)bundler.test.ts)🤖 Generated with Claude Code