Skip to content

Commit 59aee74

Browse files
brand logo shortcode: don't add class if variant specified
it's a potential footgun and anyone who wants this can build it themself
1 parent 9553c5e commit 59aee74

File tree

6 files changed

+20
-29
lines changed

6 files changed

+20
-29
lines changed

news/changelog-1.8.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
- ([#13383](https://github.com/quarto-dev/quarto-cli/issues/13383)): Fix failure when combining `minimal: true` with brand.yml.
66
- ([#13396](https://github.com/quarto-dev/quarto-cli/issues/13396)): Fix `quarto publish connect` regression.
7-
- ([#13418](https://github.com/quarto-dev/quarto-cli/issues/13418): Resolve logo paths specified directly in `brand.logo.{size}`.
7+
- ([#13418](https://github.com/quarto-dev/quarto-cli/issues/13418)): Resolve logo paths specified directly in `brand.logo.{size}`.
8+
- ([#13445](https://github.com/quarto-dev/quarto-cli/pull/13445)): Brand logo shortcode will not add `.light-content`, `.dark-content` classes when `light` or `dark` is specifically requested.
89

910
# v1.8 changes
1011

src/resources/filters/quarto-pre/shortcodes-handlers.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,14 @@ function initShortcodeHandlers()
174174
end
175175
local images = {}
176176
if lightLogo then
177+
local classes = brandMode == 'both' and {"light-content"} or {}
177178
table.insert(images, pandoc.Image(pandoc.Inlines {}, add_leading_slash(lightLogo.path), "",
178-
pandoc.Attr("", {"light-content"}, {alt = lightLogo.alt})))
179+
pandoc.Attr("", classes, {alt = lightLogo.alt})))
179180
end
180181
if darkLogo then
182+
local classes = brandMode == 'both' and {"dark-content"} or {}
181183
table.insert(images, pandoc.Image(pandoc.Inlines {}, add_leading_slash(darkLogo.path), "",
182-
pandoc.Attr("", {"dark-content"}, {alt = darkLogo.alt})))
184+
pandoc.Attr("", classes, {alt = darkLogo.alt})))
183185
end
184186
if context == "block" then
185187
return pandoc.Blocks(images)

tests/docs/smoke-all/shortcodes/brand-logo-dark.qmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ _quarto:
1313
html:
1414
ensureFileRegexMatches:
1515
-
16-
- '<img src="\.(/|\\)moon\.png" class="dark-content.*>'
16+
- '<img src="\.(/|\\)moon\.png" class="img-fluid.*>'
1717
- []
1818
---
1919

tests/docs/smoke-all/shortcodes/brand-logo-fallback-light.qmd

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,20 @@ brand:
66
logo:
77
small: dark-logo.png
88
medium: dark-medium-logo.png
9-
# No light logo specified
9+
large: dark-large-logo.png
1010
_quarto:
1111
tests:
1212
html:
1313
ensureFileRegexMatches:
1414
-
15-
# When requesting dark mode explicitly, should get dark logo
16-
- '<img src="\.(/|\\)dark-logo\.png" class="dark-content.*>'
17-
# When requesting light mode explicitly (which doesn't exist), should fall back to dark logo but with light-content class
18-
- '<img src="\.(/|\\)dark-logo\.png" class="light-content.*>'
19-
# When requesting medium size with light mode (doesn't exist), should fall back to dark-medium with light-content class
20-
- '<img src="\.(/|\\)dark-medium-logo\.png" class="light-content.*>'
15+
- '<img src="\.(/|\\)dark-logo\.png" class="img-fluid.*>'
16+
- '<img src="\.(/|\\)dark-medium-logo\.png" class="img-fluid.*>'
17+
- '<img src="\.(/|\\)dark-large-logo\.png" class="img-fluid.*>'
2118
- []
2219
---
2320

24-
### Dark Logo (Dark Mode)
2521
{{< brand logo small dark >}}
2622

27-
### Dark Logo (Light Mode - should fall back)
28-
{{< brand logo small light >}}
23+
{{< brand logo medium light >}}
2924

30-
### Medium Logo (Light Mode - should fall back)
31-
{{< brand logo medium light >}}
25+
{{< brand logo large light >}}

tests/docs/smoke-all/shortcodes/brand-logo-fallback.qmd

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,20 @@ brand:
66
logo:
77
small: light-logo.png
88
medium: light-medium-logo.png
9-
# No dark logo specified
9+
large: light-large-logo.png
1010
_quarto:
1111
tests:
1212
html:
1313
ensureFileRegexMatches:
1414
-
15-
# When requesting light mode explicitly, should get light logo
16-
- '<img src="\.(/|\\)light-logo\.png" class="light-content.*>'
17-
# When requesting dark mode explicitly (which doesn't exist), should fall back to light logo but with dark-content class
18-
- '<img src="\.(/|\\)light-logo\.png" class="dark-content.*>'
19-
# When requesting medium size with dark mode (doesn't exist), should fall back to light-medium with dark-content class
20-
- '<img src="\.(/|\\)light-medium-logo\.png" class="dark-content.*>'
15+
- '<img src="\.(/|\\)light-logo\.png" class="img-fluid.*>'
16+
- '<img src="\.(/|\\)light-medium-logo\.png" class="img-fluid.*>'
17+
- '<img src="\.(/|\\)light-large-logo\.png" class="img-fluid.*>'
2118
- []
2219
---
2320

24-
### Light Logo (Light Mode)
2521
{{< brand logo small light >}}
2622

27-
### Light Logo (Dark Mode - should fall back)
28-
{{< brand logo small dark >}}
23+
{{< brand logo medium dark >}}
2924

30-
### Medium Logo (Dark Mode - should fall back)
31-
{{< brand logo medium dark >}}
25+
{{< brand logo large dark >}}

tests/docs/smoke-all/shortcodes/brand-logo-light.qmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ _quarto:
1313
html:
1414
ensureFileRegexMatches:
1515
-
16-
- '<img src="\.(/|\\)sun\.png" class="light-content.*>'
16+
- '<img src="\.(/|\\)sun\.png" class="img-fluid.*>'
1717
- []
1818
---
1919

0 commit comments

Comments
 (0)