Skip to content

fix(render): filter bundled engines in installed Quarto (#14529)#14531

Open
cderv wants to merge 3 commits into
mainfrom
fix/issue-14529
Open

fix(render): filter bundled engines in installed Quarto (#14529)#14531
cderv wants to merge 3 commits into
mainfrom
fix/issue-14529

Conversation

@cderv
Copy link
Copy Markdown
Member

@cderv cderv commented May 20, 2026

When rendering a document with an installed Quarto (e.g. scoop, package managers), the absolute path of the bundled julia-engine leaks into the rendered output's YAML metadata and into the pandoc log printout, instead of being stripped like in dev builds.

Root Cause

The bundled-engine filter in src/command/render/pandoc.ts compared engine paths against the hardcoded substring resources/extension-subtrees/. That substring only appears when QUARTO_SHARE_PATH resolves to the source-tree layout (src/resources/). Installed Quarto uses share/extension-subtrees/, so the filter silently became a no-op and the bundled engine's absolute path went through to both the printed metadata block and the YAML metadata file handed to Pandoc.

The feature (bundled subtree extensions + filter) was introduced in v1.9.13; the bug has been present in installed Quarto since.

Fix

Extract the predicate to isBundledSubtreeEnginePath() and the filter to filterBundledSubtreeEngines() in src/extension/extension.ts. Both compare engine paths against the resolved path returned by builtinSubtreeExtensions(), which matches dev and installed layouts. Both filter call sites in pandoc.ts (cleanMetadataForPrinting and pandocPassedMetadata) now go through the helper.

Test Plan

  • tests/unit/extension/filter-bundled-engines.test.ts covers source-tree, POSIX-installed, Windows-installed, and user-supplied paths via the predicate, plus the no-arg filter under the current env.
  • Existing smoke-all test tests/docs/smoke-all/2025/12/22/markdown-engine-no-extension-subtrees.qmd still passes.
  • Manual: build an installed-layout package from this branch, render a minimal .qmdengines: block must be absent from both pandoc log and rendered markdown.

Fixes #14529

The metadata `engines` filter in pandoc.ts compared engine paths
against the hardcoded substring `resources/extension-subtrees/`.
That substring only appears when `QUARTO_SHARE_PATH` resolves to the
source-tree `src/resources` layout used in dev mode. In installed
Quarto the path is `<share>/extension-subtrees/` and the filter
silently became a no-op — the absolute path to the bundled
`julia-engine.js` leaked into both the pandoc log printout and the
YAML metadata block of rendered output.

Extract the predicate to `isBundledSubtreeEnginePath()` and the
filter to `filterBundledSubtreeEngines()` in `src/extension/extension.ts`.
Both compare against the resolved path returned by
`builtinSubtreeExtensions()`, which matches in dev and installed
layouts. Both filter call sites in `pandoc.ts`
(`cleanMetadataForPrinting` and `pandocPassedMetadata`) now go
through the helper.
@posit-snyk-bot
Copy link
Copy Markdown
Collaborator

posit-snyk-bot commented May 20, 2026

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 added 2 commits May 20, 2026 18:25
The previous startsWith() check would also have matched sibling
directories whose names share the `extension-subtrees` prefix
(e.g. `extension-subtrees-custom/`), silently dropping user-supplied
engines from Pandoc metadata. Require exact match or a path-separator
boundary so only entries actually under `extension-subtrees/` are
filtered.
The previous regex `resources[/\]extension-subtrees[/\]` only matched
the dev-tree share path. The unique marker of a bundled-extension leak
is the `extension-subtrees/` directory itself, regardless of whether the
share root resolves to `src/resources/` (dev) or `<install>/share/`
(installed). Drop the `resources` prefix so the assertion survives any
future relayout of the dev-tree share path.

Does not catch the installed-mode regression #14529 directly — that
requires the unit test added in d591c77, since smoke-all in CI runs
from the source tree.
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.

Bundled engines leak into output metadata in installed Quarto (filter substring matches source tree only)

2 participants