Skip to content

Commit 3184c7a

Browse files
brand processData: pass logo urls unchanged
fixes #12643
1 parent 02c5358 commit 3184c7a

File tree

4 files changed

+56
-3
lines changed

4 files changed

+56
-3
lines changed

news/changelog-1.8.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ All changes included in 1.8:
2323
- ([#10983](https://github.com/quarto-dev/quarto-cli/issues/10983)): Fix spacing inconsistency between paras and first section headings.
2424
- ([#12259](https://github.com/quarto-dev/quarto-cli/issues/12259)): Fix conflict between `html-math-method: katex` and crossref popups (author: @benkeks).
2525
- ([#12341](https://github.com/quarto-dev/quarto-cli/issues/12341)): Enable light and dark logos for html formats (sidebar, navbar, dashboard).
26+
- ([#12643](https://github.com/quarto-dev/quarto-cli/issues/12643)): Ensure brand.yml logos using urls are rendered correctly by passing them through when resolving brand `processedData`, and not processing them as paths.
2627
- ([#12734](https://github.com/quarto-dev/quarto-cli/issues/12734)): `highlight-style` now correctly supports setting a different `light` and `dark`.
2728
- ([#12747](https://github.com/quarto-dev/quarto-cli/issues/12747)): Ensure `th` elements are properly restored when Quarto's HTML table processing is happening.
2829
- ([#12766](https://github.com/quarto-dev/quarto-cli/issues/12766)): Use consistent equation numbering display for `html-math-method` and `html-math-method.method` for MathJax and KaTeX (author: @mcanouil)

src/core/brand/brand.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import {
3939
LogoSpecifier,
4040
LogoSpecifierPathOptional,
4141
} from "../../resources/types/schema-types.ts";
42+
import { isExternalPath } from "../../project/types/website/website-navigation.ts";
4243

4344
type ProcessedBrandData = {
4445
color: Record<string, string>;
@@ -246,11 +247,13 @@ export class Brand {
246247
resolvePath(entry: BrandLogoResource) {
247248
const pathPrefix = relative(this.projectDir, this.brandDir);
248249
if (typeof entry === "string") {
249-
return { path: join(pathPrefix, entry) };
250+
return { path: isExternalPath(entry) ? entry : join(pathPrefix, entry) };
250251
}
251252
return {
252253
...entry,
253-
path: join(pathPrefix, entry.path),
254+
path: isExternalPath(entry.path)
255+
? entry.path
256+
: join(pathPrefix, entry.path),
254257
};
255258
}
256259

src/project/types/website/website-navigation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1567,7 +1567,7 @@ function navigationDependency(resource: string) {
15671567
};
15681568
}
15691569

1570-
function isExternalPath(path: string) {
1570+
export function isExternalPath(path: string) {
15711571
return /^\w+:/.test(path);
15721572
}
15731573

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
title: "Reproducible Quarto Document"
3+
format:
4+
html: default
5+
dashboard: default
6+
revealjs: default
7+
typst:
8+
keep-typ: true
9+
brand:
10+
logo:
11+
images:
12+
quarto-logo:
13+
path: https://quarto.org/quarto.png
14+
alt: "Quarto icon"
15+
small: quarto-logo
16+
_quarto:
17+
tests:
18+
html:
19+
ensureHtmlElements:
20+
-
21+
- 'img[class*="light-content"][src="https://quarto.org/quarto.png"][alt="Quarto icon"]'
22+
-
23+
- 'img[class*="dark-content"]'
24+
dashboard:
25+
ensureHtmlElements:
26+
-
27+
- 'img[src="https://quarto.org/quarto.png"][alt="Quarto icon"][class="navbar-logo light-content d-inline-block"]'
28+
- 'img[class*="dark-content"]' # oops
29+
- []
30+
revealjs:
31+
ensureHtmlElements:
32+
-
33+
- 'img[src="https://quarto.org/quarto.png"][alt="Quarto icon"]'
34+
-
35+
- 'img[class*="dark-content"]'
36+
typst:
37+
ensureTypstFileRegexMatches:
38+
-
39+
- 'background: align\(left\+top, box\(inset: 0.75in, image\("url-logo_files(/|\\)mediabag(/|\\)quarto.png", width: 1\.5in, alt: "Quarto icon"\)\)'
40+
- []
41+
---
42+
43+
This is a reproducible Quarto document using `format: html`. It is written in Markdown and contains embedded Python code. When you run the code, it will produce a message.
44+
45+
{{< lipsum 1 >}}
46+
47+
{{< brand logo small>}}
48+
49+
The end.

0 commit comments

Comments
 (0)