Skip to content

Warn and ignore a brand file that holds only comments - #15101

Open
Masad791 wants to merge 1 commit into
quarto-dev:mainfrom
Masad791:bugfix/comment-only-brand
Open

Masad791 wants to merge 1 commit into
quarto-dev:mainfrom
Masad791:bugfix/comment-only-brand

Conversation

@Masad791

Copy link
Copy Markdown
Contributor

Description

Fixes #14891.

A _brand.yml that is all comments parses to no YAML value, so the brand schema rejects it with YAML value is missing and the render stops. Both loaders in projectResolveBrand now check for an empty value first, print a warning (once per file) and carry on as if the file wasn't there. Invalid YAML still goes through validation, so its error is reported the same as before.

What I checked on Windows 11:

  • comment-only _brand.yml next to a document: warning, document renders
  • brand: my-brand.yml in front matter pointing at a comment-only file: warning, renders
  • brand: {light, dark} with a comment-only dark file: warning, the light brand is still applied
  • a normal brand file still applies (colour shows up in the compiled CSS)

The new smoke-all test (2026/10/13/issue-14891) fails without the change and passes with it, and the existing brand tests (126 documents, 197 checks) pass.

One thing I noticed along the way but left out of this PR: a brand file with broken YAML, e.g. an unclosed [, fails with TypeError: Cannot read properties of undefined (reading 'value') rather than a validation message. That happens on main too. Happy to open a separate issue for it.

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
AI-assisted PR
  • AI tool used: Claude Code
  • Codebase grounding: local clone
  • Human review: I have reviewed, tested, and verified the AI-generated content before submitting.

A commented-out `_brand.yml` is useful as a template, but it parses to no
YAML value, so brand validation failed with `YAML value is missing` and the
render stopped. Both brand loaders now check for an empty YAML value first,
warn once, and treat the file as absent. Invalid YAML still goes through
validation so its error is reported as before.

Fixes quarto-dev#14891
@posit-snyk-bot

posit-snyk-bot commented Oct 19, 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.

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.

A comment-only _brand.yml should trigger a warning but not an error

2 participants