Skip to content

fix(manuscript): keep knitr figures on Windows on first freeze render#14633

Merged
cderv merged 2 commits into
mainfrom
fix/issue-14613
Jun 29, 2026
Merged

fix(manuscript): keep knitr figures on Windows on first freeze render#14633
cderv merged 2 commits into
mainfrom
fix/issue-14613

Conversation

@cderv

@cderv cderv commented Jun 29, 2026

Copy link
Copy Markdown
Member

When rendering a manuscript project with freeze: auto and the knitr engine on Windows, dynamically generated figures are missing from the rendered manuscript on the first render (or after clearing freeze). Subsequent renders or --cache-refresh succeeds.

Root Cause

renderCleanup compares the engine-reported supporting directory to the computed filesDir to decide whether to narrow cleanup to the figure subdirectory or remove the full supporting dir. The knitr engine reports paths with forward slashes on Windows while filesDir is normalized to the platform separator (backslash), so the raw === comparison fails there. The parent index_files directory is removed wholesale instead of being narrowed to figure-<format>. Subsequent format completions find no index_files and copy nothing into _manuscript.

Only knitr is affected; the Jupyter engine already uses the platform separator.

Fix

Added a pathsEqual helper to src/core/path.ts that normalizes both sides before comparing. Used at the renderCleanup comparison and at two preview call sites that were hand-rolling the same normalize-both-sides pattern.

Fixes #14613

cderv added 2 commits June 29, 2026 11:23
On a manuscript first render with freeze, renderCleanup compared the
engine-reported supporting dir to the normalized filesDir with a raw
string equality. The knitr engine reports paths with forward slashes on
Windows while filesDir uses the platform separator, so the comparison
failed there and the parent index_files dir was removed wholesale instead
of being narrowed to the figure dir. Subsequent format completions then
found no index_files and copied nothing into _manuscript. Only knitr is
affected; the Jupyter engine builds the path with the platform separator,
which already matches.

Compare paths separator-agnostically via a new pathsEqual helper, and
adopt it at the two existing preview call sites that hand-rolled the same
normalize-both-sides comparison.
@posit-snyk-bot

posit-snyk-bot commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@cderv cderv merged commit 894f43f into main Jun 29, 2026
51 checks passed
@cderv cderv deleted the fix/issue-14613 branch June 29, 2026 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Quarto manuscript not rendering dynamic figures

2 participants