Skip to content

fix: resolve extension language and metadata files from the document - #15274

Merged
cderv merged 6 commits into
quarto-dev:mainfrom
mcanouil:fix/extension-language-file-path-15063
Nov 4, 2026
Merged

cderv merged 6 commits into
quarto-dev:mainfrom
mcanouil:fix/extension-language-file-path-15063

Conversation

@mcanouil

@mcanouil mcanouil commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

A format extension that sets language: _language.yml now finds the file inside its own directory, so the render no longer stops with "Specified 'language' file does not exist".
The same fix makes metadata-files in an extension format work; until now they were skipped without any message.

resolveExtensionPaths already rewrites the paths of _extension.yml relative to the document's directory.
readExtensionFormat then passed extension.path to resolveFormatsFromMetadata, which takes the dirname of its input as the base, so the paths were joined to the parent of the extension directory and gave _extensions/_extensions/<name>/_language.yml.
It now passes the document, the same path that resolveExtensionPaths used.

The smoke-all tests cover per-language files, organisation directories, subfolders, document overrides, metadata-files, and a project.
The project's subdirectory document passed before the fix by chance, as the two wrong bases cancel out one level down; it stays as a guard.

When the named language file does not exist, the error still shows a path in the document's directory rather than the extension's, because toInputRelativePaths only rewrites paths that exist.
That is shared with every other path in _extension.yml, so it is left out of this change.

Closes #15063.

Checklist

I have (if applicable):

  • referenced the GitHub issue this PR closes
  • updated the appropriate changelog in the PR
  • ensured the present test suite passes
  • added new tests
  • created a separate documentation PR in Quarto's website repo and linked it to this PR

A format extension that points `language` at its own file stops the render, and its `metadata-files` are ignored. These documents check both, with per-language files, an organisation folder, a subfolder, and a project with nested documents.
The paths in `_extension.yml` are already rewritten relative to the document folder, but the format was resolved against the parent of the extension folder. Pass the document instead, so `language` and `metadata-files` point at the files inside the extension.

Fixes quarto-dev#15063.
@mcanouil mcanouil added the bug Something isn't working label Nov 3, 2026
@mcanouil mcanouil self-assigned this Nov 3, 2026
@posit-snyk-bot

posit-snyk-bot commented Nov 3, 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.

@mcanouil
mcanouil marked this pull request as ready for review November 3, 2026 23:25

@cderv cderv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM.

Paths inside the files listed in an extension's metadata-files still resolve against the document (e.g. language: _language.yml in that file), like a document's own metadata-files do. This is a broader behavior of metadata-files, so I'll look at it in a follow-up.

@cderv
cderv merged commit 664486a into quarto-dev:main Nov 4, 2026
52 checks passed
@mcanouil
mcanouil deleted the fix/extension-language-file-path-15063 branch November 4, 2026 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A language file set in a format extension is resolved against the wrong directory

3 participants