diff --git a/src/project/project-shared.ts b/src/project/project-shared.ts
index 689fc8b4bb0..13b28744a93 100644
--- a/src/project/project-shared.ts
+++ b/src/project/project-shared.ts
@@ -50,6 +50,7 @@ import { refSchema } from "../core/lib/yaml-schema/common.ts";
import { Brand as BrandJson } from "../resources/types/schema-types.ts";
import { Brand } from "../core/brand/brand.ts";
import { warnOnce } from "../core/log.ts";
+import { assert } from "testing/asserts";
export function projectExcludeDirs(context: ProjectContext): string[] {
const outputDir = projectOutputDir(context);
@@ -556,25 +557,28 @@ export async function projectResolveBrand(
if (fileInformation.brand) {
return fileInformation.brand;
}
- if (typeof metadata.brand !== "string") {
- warnOnce(
- `Brand metadata must be a filename, but is of type ${typeof metadata
- .brand} in file ${fileName}. Will ignore brand information`,
- );
- return project.resolveBrand();
- }
- let brandPath: string = "";
- if (brandPath.startsWith("/")) {
- brandPath = join(project.dir, metadata.brand);
+ if (typeof metadata.brand === "string") {
+ let brandPath: string = "";
+ if (brandPath.startsWith("/")) {
+ brandPath = join(project.dir, metadata.brand);
+ } else {
+ brandPath = join(dirname(fileName), metadata.brand);
+ }
+ const brand = await readAndValidateYamlFromFile(
+ brandPath,
+ refSchema("brand", "Format-independent brand configuration."),
+ "Brand validation failed for " + brandPath + ".",
+ ) as BrandJson;
+ fileInformation.brand = new Brand(brand, dirname(brandPath), project.dir);
+ return fileInformation.brand;
} else {
- brandPath = join(dirname(fileName), metadata.brand);
+ assert(typeof metadata.brand === "object");
+ fileInformation.brand = new Brand(
+ metadata.brand as BrandJson,
+ dirname(fileName),
+ project.dir,
+ );
+ return fileInformation.brand;
}
- const brand = await readAndValidateYamlFromFile(
- brandPath,
- refSchema("brand", "Format-independent brand configuration."),
- "Brand validation failed for " + brandPath + ".",
- ) as BrandJson;
- fileInformation.brand = new Brand(brand, dirname(brandPath), project.dir);
- return fileInformation.brand;
}
}
diff --git a/src/resources/editor/tools/vs-code.mjs b/src/resources/editor/tools/vs-code.mjs
index 5fc88873254..0dabfc757d9 100644
--- a/src/resources/editor/tools/vs-code.mjs
+++ b/src/resources/editor/tools/vs-code.mjs
@@ -16628,6 +16628,19 @@ var require_yaml_intelligence_resources = __commonJS({
schema: "path",
description: "Use the specified file as a style reference in producing a docx, \npptx, or odt file.\n"
},
+ {
+ name: "brand",
+ schema: {
+ anyOf: [
+ "string",
+ "boolean",
+ {
+ ref: "brand"
+ }
+ ]
+ },
+ description: "Branding information to use for this document. If a string, the path to a brand file.\nIf false, don't use branding on this document. If an object, an inline brand\ndefinition.\n"
+ },
{
name: "theme",
tags: {
@@ -22618,7 +22631,7 @@ var require_yaml_intelligence_resources = __commonJS({
"The page layout to use for this document (article
,\nfull
, or custom
)",
{
short: "Target page width for output (used to compute columns widths for\nlayout
divs)",
- long: "Target page width for output (used to compute columns widths for\nlayout
divs). Defaults to 6.5 inches, which corresponds to\ndefault letter page settings in docx and odt."
+ long: "Target body page width for output (used to compute columns widths for\nlayout
divs). Defaults to 6.5 inches, which corresponds to\ndefault letter page settings in docx and odt (8.5 inches with 1 inch for\neach margins)."
},
{
short: "Properties of the grid system used to layout Quarto HTML pages.",
@@ -24118,12 +24131,12 @@ var require_yaml_intelligence_resources = __commonJS({
mermaid: "%%"
},
"handlers/mermaid/schema.yml": {
- _internalId: 192600,
+ _internalId: 193258,
type: "object",
description: "be an object",
properties: {
"mermaid-format": {
- _internalId: 192592,
+ _internalId: 193250,
type: "enum",
enum: [
"png",
@@ -24139,7 +24152,7 @@ var require_yaml_intelligence_resources = __commonJS({
exhaustiveCompletions: true
},
theme: {
- _internalId: 192599,
+ _internalId: 193257,
type: "anyOf",
anyOf: [
{
diff --git a/src/resources/editor/tools/yaml/web-worker.js b/src/resources/editor/tools/yaml/web-worker.js
index cf737422f7a..f962e83385a 100644
--- a/src/resources/editor/tools/yaml/web-worker.js
+++ b/src/resources/editor/tools/yaml/web-worker.js
@@ -16629,6 +16629,19 @@ try {
schema: "path",
description: "Use the specified file as a style reference in producing a docx, \npptx, or odt file.\n"
},
+ {
+ name: "brand",
+ schema: {
+ anyOf: [
+ "string",
+ "boolean",
+ {
+ ref: "brand"
+ }
+ ]
+ },
+ description: "Branding information to use for this document. If a string, the path to a brand file.\nIf false, don't use branding on this document. If an object, an inline brand\ndefinition.\n"
+ },
{
name: "theme",
tags: {
@@ -22619,7 +22632,7 @@ try {
"The page layout to use for this document (article
,\nfull
, or custom
)",
{
short: "Target page width for output (used to compute columns widths for\nlayout
divs)",
- long: "Target page width for output (used to compute columns widths for\nlayout
divs). Defaults to 6.5 inches, which corresponds to\ndefault letter page settings in docx and odt."
+ long: "Target body page width for output (used to compute columns widths for\nlayout
divs). Defaults to 6.5 inches, which corresponds to\ndefault letter page settings in docx and odt (8.5 inches with 1 inch for\neach margins)."
},
{
short: "Properties of the grid system used to layout Quarto HTML pages.",
@@ -24119,12 +24132,12 @@ try {
mermaid: "%%"
},
"handlers/mermaid/schema.yml": {
- _internalId: 192600,
+ _internalId: 193258,
type: "object",
description: "be an object",
properties: {
"mermaid-format": {
- _internalId: 192592,
+ _internalId: 193250,
type: "enum",
enum: [
"png",
@@ -24140,7 +24153,7 @@ try {
exhaustiveCompletions: true
},
theme: {
- _internalId: 192599,
+ _internalId: 193257,
type: "anyOf",
anyOf: [
{
diff --git a/src/resources/editor/tools/yaml/yaml-intelligence-resources.json b/src/resources/editor/tools/yaml/yaml-intelligence-resources.json
index 876a616bd1a..d523a06de87 100644
--- a/src/resources/editor/tools/yaml/yaml-intelligence-resources.json
+++ b/src/resources/editor/tools/yaml/yaml-intelligence-resources.json
@@ -9600,6 +9600,19 @@
"schema": "path",
"description": "Use the specified file as a style reference in producing a docx, \npptx, or odt file.\n"
},
+ {
+ "name": "brand",
+ "schema": {
+ "anyOf": [
+ "string",
+ "boolean",
+ {
+ "ref": "brand"
+ }
+ ]
+ },
+ "description": "Branding information to use for this document. If a string, the path to a brand file.\nIf false, don't use branding on this document. If an object, an inline brand\ndefinition.\n"
+ },
{
"name": "theme",
"tags": {
@@ -15590,7 +15603,7 @@
"The page layout to use for this document (article
,\nfull
, or custom
)",
{
"short": "Target page width for output (used to compute columns widths for\nlayout
divs)",
- "long": "Target page width for output (used to compute columns widths for\nlayout
divs). Defaults to 6.5 inches, which corresponds to\ndefault letter page settings in docx and odt."
+ "long": "Target body page width for output (used to compute columns widths for\nlayout
divs). Defaults to 6.5 inches, which corresponds to\ndefault letter page settings in docx and odt (8.5 inches with 1 inch for\neach margins)."
},
{
"short": "Properties of the grid system used to layout Quarto HTML pages.",
@@ -17090,12 +17103,12 @@
"mermaid": "%%"
},
"handlers/mermaid/schema.yml": {
- "_internalId": 192600,
+ "_internalId": 193258,
"type": "object",
"description": "be an object",
"properties": {
"mermaid-format": {
- "_internalId": 192592,
+ "_internalId": 193250,
"type": "enum",
"enum": [
"png",
@@ -17111,7 +17124,7 @@
"exhaustiveCompletions": true
},
"theme": {
- "_internalId": 192599,
+ "_internalId": 193257,
"type": "anyOf",
"anyOf": [
{
diff --git a/src/resources/schema/document-options.yml b/src/resources/schema/document-options.yml
index 4fc27aa01b9..1407ceb29e9 100644
--- a/src/resources/schema/document-options.yml
+++ b/src/resources/schema/document-options.yml
@@ -6,6 +6,17 @@
Use the specified file as a style reference in producing a docx,
pptx, or odt file.
+- name: brand
+ schema:
+ anyOf:
+ - string # a file path
+ - boolean # if false, don't use branding on this document
+ - ref: brand # an inline brand object definition
+ description: |
+ Branding information to use for this document. If a string, the path to a brand file.
+ If false, don't use branding on this document. If an object, an inline brand
+ definition.
+
- name: theme
tags:
formats: [$html-doc, revealjs, beamer, dashboard]
diff --git a/tests/docs/smoke-all/2024/10/29/feature-11192/.gitignore b/tests/docs/smoke-all/2024/10/29/feature-11192/.gitignore
new file mode 100644
index 00000000000..075b2542afb
--- /dev/null
+++ b/tests/docs/smoke-all/2024/10/29/feature-11192/.gitignore
@@ -0,0 +1 @@
+/.quarto/
diff --git a/tests/docs/smoke-all/2024/10/29/feature-11192/_quarto.yml b/tests/docs/smoke-all/2024/10/29/feature-11192/_quarto.yml
new file mode 100644
index 00000000000..8127758f1e5
--- /dev/null
+++ b/tests/docs/smoke-all/2024/10/29/feature-11192/_quarto.yml
@@ -0,0 +1,17 @@
+project:
+ type: website
+
+website:
+ title: "feature-11192"
+ navbar:
+ left:
+ - href: index.qmd
+ text: Home
+
+format:
+ html:
+ css: styles.css
+ toc: true
+
+
+
diff --git a/tests/docs/smoke-all/2024/10/29/feature-11192/index.qmd b/tests/docs/smoke-all/2024/10/29/feature-11192/index.qmd
new file mode 100644
index 00000000000..79f9e9c0f5c
--- /dev/null
+++ b/tests/docs/smoke-all/2024/10/29/feature-11192/index.qmd
@@ -0,0 +1,24 @@
+---
+title: "feature-11192"
+brand:
+ color:
+ palette:
+ white: '#eeddcc'
+ black: '#112233'
+ primary: red
+ background: black
+ foreground: white
+format: html
+_quarto:
+ tests:
+ html:
+ ensureFileRegexMatches:
+ - ['
#eeddcc
'] + - [] +--- + +{{< brand color white >}} + +This is a Quarto website. + +To learn more about Quarto websites visit