Skip to content

Commit ac878df

Browse files
authored
refactor: move the site theme and chrome into a local extension (#2222)
Move the site theme, scripts, Lua filters and page chrome into a local extension at _extensions/quartoorg/, used through a quartoorg project type. Pages inherit quartoorg-html from the project instead of naming it, so the theme is set in one place and a page cannot drop it silently. This centralises the themes and makes the site easier to maintain, and it lets #2140 pick up the same chrome. - Move the page chooser shortcode and the accessibility fixes from main into the extension, with their CSS in the theme SCSS. - Move brand images to assets/images/ and redirect the old root URLs that other sites and docs still load: /quarto.png, /favicon.png, the og:image files, and the hero and Posit logo images. Files the home page still serves from images/ stay where they are. - Add _tools/check-site-format.ts to CI and the pre-commit hook. It fails when a format: html page drops the site theme. - Dark mode borders use $gray-400, which is 3.70:1 against the page instead of 1.08:1. The main banner is brand blue in dark mode too, and the prerelease banner moves to #e60033 (white text 4.76:1). Notebook preview pages still render with the built-in html format, so they lose the Posit badge, code copy buttons and site grid widths. See quarto-dev/quarto-cli#14954
1 parent 27cd5e6 commit ac878df

158 files changed

Lines changed: 1293 additions & 1208 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.claude/skills/blog-post/references/thumbnail-guide.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ quarto.org / Open Graph standard) — don't copy dimensions from those examples.
3535

3636
## Quarto Brand Colors
3737

38-
Sourced from the website CSS (`index.css`):
38+
Sourced from the website SCSS (`_extensions/quartoorg/scss/partials/_home.scss`):
3939

4040
| Color | Hex | Usage |
4141
|-------|-----|-------|
@@ -148,7 +148,7 @@ SVGs don't center properly in listing cards or social card previews — the
148148
HTML uses flexbox for centering which SVG can't replicate without duplicating all
149149
the layout logic. The SVG is only a source file for regenerating the PNG.
150150

151-
The Quarto logo SVG is at the quarto-web repo root: `quarto-icon.svg` (fill color `#74AADB`
151+
The Quarto logo SVG is in the quarto-web repo at `assets/images/quarto-icon.svg` (fill color `#74AADB`
152152
— recolor to `#5286AB` for thumbnails or `white` for dark backgrounds).
153153

154154
### Attribution

‎.githooks/README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ git config core.hooksPath .githooks
99
## Hooks
1010

1111
**`pre-commit`** — Blocks commits where a `.qmd` file with a `_freeze/` entry was edited but `_freeze/` was not updated. Fix: `quarto render <file.qmd>`, then commit the updated `_freeze/` output alongside the source.
12+
It first runs `_tools/check-site-format.ts`, which blocks a page or a `_metadata.yml` that sets `format: html`, since that drops the site theme.
13+
Remove the `format` key, or use `quartoorg-html` when the page lists several formats.

‎.githooks/pre-commit‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
#!/bin/bash
2-
# Git pre-commit hook: verify _freeze/ is current for staged .qmd files.
2+
# Git pre-commit hook: check page formats, then verify _freeze/ is current for
3+
# staged .qmd files.
34
# Setup: git config core.hooksPath .githooks
5+
set -euo pipefail
46

57
HOOK_DIR="$(cd "$(dirname "$0")" && pwd)"
8+
if command -v quarto >/dev/null 2>&1; then
9+
quarto run "$HOOK_DIR/../_tools/check-site-format.ts" --staged
10+
else
11+
echo "pre-commit: quarto not found, skipping the page format check (CI still runs it)." >&2
12+
fi
613
exec bash "$HOOK_DIR/check-freeze.sh" commit

‎.github/workflows/preview.yml‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,25 @@ jobs:
2929
echo "::error title=Manual action required for preview::PR from fork can't be deployed as preview to Netlify automatically. Use '/deploy-preview' command in comments to trigger the preview manually."
3030
shell: bash
3131

32+
check-site-format:
33+
# Runs on pull requests, forks included: a page with `format: html`
34+
# renders without the site theme and gives no error.
35+
if: github.event_name == 'pull_request'
36+
runs-on: ubuntu-latest
37+
permissions:
38+
contents: read
39+
steps:
40+
- name: Check out repository
41+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
42+
with:
43+
persist-credentials: false
44+
- name: Set up Quarto
45+
uses: quarto-dev/quarto-actions/setup@v2
46+
- name: Test the page format check
47+
run: quarto run _tools/check-site-format.test.ts
48+
- name: Check page formats
49+
run: quarto run _tools/check-site-format.ts
50+
3251
build-deploy-preview:
3352
# Deploy a preview only if
3453
# - the PR is not from a fork,

‎_extensions/page-chooser/_extension.yml‎

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
title: quarto.org website
2+
author: Quarto
3+
version: 1.0.0
4+
quarto-required: ">=1.9.0"
5+
contributes:
6+
formats:
7+
html:
8+
toc: true
9+
theme:
10+
light: [cosmo, scss/quartoorg.scss]
11+
dark: [cosmo, scss/quartoorg-dark.scss]
12+
code-copy: true
13+
code-overflow: wrap
14+
include-in-header:
15+
- assets/scripts/supported-by-posit.html
16+
include-after-body:
17+
- assets/scripts/page-tweaks.html
18+
grid:
19+
sidebar-width: 250px
20+
body-width: 900px
21+
margin-width: 300px
22+
shortcodes:
23+
- shortcodes/page-chooser.lua
24+
filters:
25+
- filters/tools-tabset.lua
26+
- filters/color-box.lua
27+
- filters/shift-headings.lua
28+
- at: post-quarto
29+
path: filters/include-dark.lua
30+
project:
31+
project:
32+
type: website
33+
website:
34+
image: /assets/images/quarto-dark-bg.jpeg
35+
plausible-analytics:
36+
path: assets/scripts/plausible.html
37+
open-graph: true
38+
twitter-card: true
39+
repo-actions: [edit, issue]
40+
page-navigation: true
41+
bread-crumbs: true
42+
search:
43+
show-item-context: true
44+
type: overlay
45+
navbar:
46+
background: light
47+
logo: /assets/images/quarto.png
48+
logo-alt: "Quarto logo."
49+
title: false
50+
collapse-below: lg
51+
syntax-highlighting: a11y
52+
respect-user-color-scheme: true
53+
format: quartoorg-html

js.html renamed to _extensions/quartoorg/assets/scripts/page-tweaks.html

File renamed without changes.

_plausible.html renamed to _extensions/quartoorg/assets/scripts/plausible.html

File renamed without changes.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<script src="https://cdn.jsdelivr.net/gh/posit-dev/supported-by-posit/js/badge.min.js"
2+
data-light-bg="#E8EDF2"
3+
data-light-text="#404041"
4+
data-light-lt="#ee6331"
5+
data-light-gt="#447099"
6+
data-dark-bg="#333333"
7+
data-dark-lt="#ffffff"
8+
data-dark-gt="#ffffff"></script>

filters/color-box.lua renamed to _extensions/quartoorg/filters/color-box.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ Span = function(s)
55
if s.classes:includes('color-box') then
66
local color
77
if s.attributes['color'] then
8-
quarto.log.output("HERE")
98
color = s.attributes['color']
109
s.attributes.color = nil
1110
elseif #s.content == 1 and s.content[1] and s.content[1].t == "Code" and s.content[1].text and s.content[1].text:sub(1, 1) == '#' then

0 commit comments

Comments
 (0)