Compare commits

..
14 Commits
Author SHA1 Message Date
Emile Bangma 2386362d57 Merge pull request #2668 from jackyzha0/changeset-release/v5
chore: release Quartz
2026-11-22 23:48:35 +01:00
github-actions[bot] d533468802 chore: release Quartz 2026-11-22 22:47:05 +00:00
Emile Bangma 048519774a Merge pull request #2667 from jackyzha0/dev-mode/themes-core-3.1.1
chore: @quartz-themes/core 3.1.1 (Obsidian template's default theme)
2026-11-22 23:46:38 +01:00
saberzero1 ee1cdffd0d chore: @quartz-themes/core 3.1.1 (Obsidian template's default theme) 2026-11-22 23:41:06 +01:00
Emile Bangma 08fddad0e8 Merge pull request #2665 from jackyzha0/changeset-release/v5
chore: release Quartz
2026-11-22 21:54:11 +01:00
github-actions[bot] 506a7caa8c chore: release Quartz 2026-11-22 20:52:31 +00:00
Emile Bangma 678398d235 Merge pull request #2666 from jackyzha0/dev-mode/themes-core-3
chore: @quartz-themes/core 3.1, @quartz-community/explorer 1.1.1
2026-11-22 21:52:08 +01:00
saberzero1 6f82d03fd4 chore: @quartz-community/explorer 1.1.1 in the lockfile 2026-11-22 21:49:37 +01:00
saberzero1 95e96b4871 chore: @quartz-themes/core 3.1 (themes converted at build time) 2026-11-22 21:28:07 +01:00
Emile Bangma 23b70cdba0 Merge pull request #2663 from jackyzha0/dev-mode/mobile-grid-minmax
fix(styles): phone/tablet content column can't grow past the screen
2026-11-22 21:27:45 +01:00
Emile Bangma 829bec461f Merge pull request #2664 from jackyzha0/dev-mode/fonts-body-overrides
fix(fonts): explicit fonts apply under Obsidian themes; interface and heading fonts load
2026-11-22 21:27:27 +01:00
saberzero1 c392e177a7 fix(fonts): load the interface and per-heading fonts; single-weight fonts request their weight 2026-11-22 21:25:05 +01:00
saberzero1 3f8104fb50 fix(fonts): explicit body, code and interface fonts apply with an Obsidian theme (Obsidian's --font-*-override variables on body) 2026-11-22 20:44:21 +01:00
saberzero1 7531e678f5 fix(styles): the phone/tablet content column is minmax(0, 1fr), and header text wraps, so wide chrome can't widen the page 2026-11-22 14:01:07 +01:00
8 changed files with 147 additions and 39 deletions

No files matched your search

+15
View File
@@ -1,5 +1,20 @@
# @jackyzha0/quartz
## 5.2.2
### Patch Changes
- ee1cdff: Updates `@quartz-themes/core` to 3.1.1: the Obsidian template (`theme: default`) works again (since 3.0 the plugin failed to initialise looking "default" up as a community theme); `default`, `obsidian` and `Obsidian default` use Obsidian's built-in theme.
## 5.2.1
### Patch Changes
- 3f8104f: Fonts: explicitly configured `body`, `code` and `interface` fonts now apply with an Obsidian theme. They are also written to Obsidian's `--font-*-override` variables on `body`, which the theme's styles read; before, the theme's own `body` font variables won over Quartz's `:root` ones.
- c392e17: Fonts: the `interface` font and per-heading fonts (`h1` … `h6`) are now loaded from Google Fonts (or self-hosted with `fontOrigin: selfHosted`) like the other fonts; before, they only rendered if installed locally. A font with a single weight now loads that weight (`weights: [700]` loaded 400), and a single-weight italic font no longer makes the Google Fonts request fail.
- 7531e67: On phones and tablets, one too-wide item in the header row (a long page title, or an Obsidian theme's styled header) no longer widens the page past the screen. The content column is `minmax(0, 1fr)` instead of `auto` (also in the full-width and minimal frames), and text in the phone header row may break anywhere.
- 95e96b4: Updates `@quartz-themes/core` to 3.1, which converts any Obsidian community theme at build time: name a theme as Obsidian lists it (`Minimal`, `AnuPpuccin`), a GitHub repository, a URL or a local `theme.css`; Style Settings exports and CSS snippets apply as in Obsidian. Theme ids from 2.x (`tokyo-night`) keep working; `aspects`, `include`, `calloutStyle` and `fonts` were removed, and the `@quartz-themes/<theme>` packages are no longer needed. Quartz keeps its own page layout under a theme, `themeFonts: false` uses the site's Quartz fonts, and a theme's embedded fonts ship as separate files. See [ThemesCore](https://quartz.jzhao.xyz/plugins/ThemesCore).
## 5.2.0
### Minor Changes
+10 -9
View File
@@ -1,12 +1,12 @@
{
"name": "@jackyzha0/quartz",
"version": "5.2.0",
"version": "5.2.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@jackyzha0/quartz",
"version": "5.2.0",
"version": "5.2.2",
"license": "MIT",
"dependencies": {
"@clack/prompts": "^1.8.0",
@@ -53,7 +53,7 @@
"@quartz-community/tag-list": "^1.0.3",
"@quartz-community/tag-page": "^1.0.5",
"@quartz-community/unlisted-pages": "^1.2.0",
"@quartz-themes/core": "^2.0.1",
"@quartz-themes/core": "^3.1.0",
"ansi-truncate": "^1.4.0",
"async-mutex": "^0.5.0",
"chokidar": "^5.0.0",
@@ -2717,9 +2717,9 @@
}
},
"node_modules/@quartz-community/explorer": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@quartz-community/explorer/-/explorer-1.1.0.tgz",
"integrity": "sha512-FWTdzQAMyg1TMxctALnsp2V/9oawREGEjp5D8WtGDJZ69ZYQvdX9g1F/odFRWzIdgZ9IjXaSD0y98zMHEtXa2w==",
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@quartz-community/explorer/-/explorer-1.1.1.tgz",
"integrity": "sha512-uSfzNq1gnWRuOEeP+Sp8SI8DxgojPnx9OMo7+VzBDRERYRzuryz2ivRmXflzRwIRcPjIrsZzF557dLgDgsv6NA==",
"license": "MIT",
"dependencies": {
"@quartz-community/types": "^1.0.0",
@@ -3335,9 +3335,9 @@
}
},
"node_modules/@quartz-themes/core": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@quartz-themes/core/-/core-2.0.1.tgz",
"integrity": "sha512-1jECQpq9HS2shyfc/xQfxvhanAtYFR2ewEveinq4nLSxplEdHoLtIm+ymmnV/HVvXbCoYXUXAyimhsVLN9eRMg==",
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/@quartz-themes/core/-/core-3.1.1.tgz",
"integrity": "sha512-asH2I06OE2qnzyKu4JTsJRPHYopUcRY1KIJv/M03OutdzKngfYkXN7L247poXYbaorehZCDO4x1xXgXhSJNjsg==",
"license": "MIT",
"dependencies": {
"@quartz-community/types": "^1.0.0"
@@ -3346,6 +3346,7 @@
"node": ">=22"
},
"peerDependencies": {
"lightningcss": "^1.31.1",
"preact": "^10.0.0"
},
"peerDependenciesMeta": {
+2 -2
View File
@@ -2,7 +2,7 @@
"name": "@jackyzha0/quartz",
"description": "🌱 publish your digital garden and notes as a website",
"private": true,
"version": "5.2.0",
"version": "5.2.2",
"type": "module",
"author": "jackyzha0 <j.zhao2k19@gmail.com>",
"license": "MIT",
@@ -83,7 +83,7 @@
"@quartz-community/tag-list": "^1.0.3",
"@quartz-community/tag-page": "^1.0.5",
"@quartz-community/unlisted-pages": "^1.2.0",
"@quartz-themes/core": "^2.0.1",
"@quartz-themes/core": "^3.1.0",
"ansi-truncate": "^1.4.0",
"async-mutex": "^0.5.0",
"chokidar": "^5.0.0",
+1 -1
View File
@@ -99,7 +99,7 @@ plugins:
- source: "@quartz-themes/core"
enabled: false
options:
theme: tokyo-night
theme: Tokyo Night
mode: both
- source: "@quartz-community/explicit-publish"
enabled: false
+54 -1
View File
@@ -14,7 +14,13 @@ import {
readFrontmatterData,
} from "./frontmatter"
import { Links } from "./links"
import { buildLayeredCSS, buildUnlayeredCSS, resolveFonts } from "./fonts"
import {
buildLayeredCSS,
buildUnlayeredCSS,
googleFontHref,
resolveFontSpecs,
resolveFonts,
} from "./fonts"
import { isContentError } from "../../util/pluginErrors"
import { Drafts, isDraft } from "./drafts"
import {
@@ -642,4 +648,51 @@ describe("fonts built-in", () => {
delete (globalThis as Record<string, unknown>).__quartzFonts
}
})
test("the interface and per-heading fonts are loaded from Google Fonts", () => {
const href = decodeURIComponent(
googleFontHref(
resolveFontSpecs(
{ interface: "Inter", h1: { name: "Playfair Display", weights: [700] } },
{},
),
),
)
assert.match(href, /family=Inter:wght@400;600/)
assert.match(href, /family=Playfair Display:wght@700/)
assert.doesNotMatch(decodeURIComponent(googleFontHref(resolveFontSpecs({}, {}))), /Inter/)
const single = (spec: object) =>
decodeURIComponent(googleFontHref(resolveFontSpecs({ title: spec as never }, {})))
assert.match(single({ name: "Lora", weights: [400] }), /family=Lora&/)
assert.match(
single({ name: "Lora", weights: [400], includeItalic: true }),
/family=Lora:ital@0;1&/,
)
assert.match(
single({ name: "Lora", weights: [700], includeItalic: true }),
/family=Lora:ital,wght@0,700;1,700&/,
)
})
test("explicit body/interface/code fonts set Obsidian's overrides on body", () => {
;(globalThis as Record<string, unknown>).__quartzFonts = {
themeName: "Things",
fonts: { "--font-text": "Inter", "--font-monospace": "JetBrains Mono" },
}
try {
const opts = { body: "Lora", code: "Fira Code" }
const css = buildUnlayeredCSS(resolveFonts(opts, {}), opts, true)
assert.match(css, /html body \{[^}]*--font-text-override: Lora;/)
assert.match(css, /html body \{[^}]*--font-monospace-override: Fira Code;/)
assert.doesNotMatch(css, /--font-interface-override/)
// a theme with themeFonts: false registers no fonts, but still reads the overrides
assert.match(
buildUnlayeredCSS(resolveFonts({ interface: "Inter" }, {}), { interface: "Inter" }, false),
/html body \{\n --font-interface-override: Inter;\n\}/,
)
assert.doesNotMatch(buildUnlayeredCSS(resolveFonts({}, {}), {}, true), /override/)
} finally {
delete (globalThis as Record<string, unknown>).__quartzFonts
}
})
})
+50 -20
View File
@@ -23,7 +23,7 @@ import { QuartzEmitterPlugin } from "../types"
const HEADING_LEVELS = ["h1", "h2", "h3", "h4", "h5", "h6"] as const
type HeadingLevel = (typeof HEADING_LEVELS)[number]
type FontRole = "title" | "header" | "body" | "code"
type FontRole = "title" | "header" | "body" | "code" | "interface"
export const SELF_HOSTED_STYLESHEET = "static/fonts/quartz-fonts.css"
export const QUARTZ_DEFAULT_HEADER = "Schibsted Grotesk"
@@ -40,12 +40,14 @@ const DEFAULT_WEIGHTS: Record<FontRole, number[]> = {
header: [400, 700],
body: [400, 600],
code: [400, 600],
interface: [400, 600],
}
const DEFAULT_ITALIC: Record<FontRole, boolean> = {
title: false,
header: false,
body: true,
code: false,
interface: false,
}
/** Option defaults; every key is listed so unknown options can be reported. */
@@ -107,13 +109,20 @@ export function readConfiguredTypography(ctx: BuildCtx | undefined): ConfiguredT
return result
}
/** Options first, then `configuration.theme.typography`, then Quartz's defaults. */
/**
* Options first, then `configuration.theme.typography`, then Quartz's defaults. The interface
* and per-heading fonts exist only as options.
*/
export function resolveFontSpecs(options: FontsConfig, typography: ConfiguredTypography) {
return {
title: options.title ?? typography.title,
header: options.header ?? typography.header ?? QUARTZ_DEFAULT_HEADER,
body: options.body ?? typography.body ?? QUARTZ_DEFAULT_BODY,
code: options.code ?? typography.code ?? QUARTZ_DEFAULT_CODE,
interface: options.interface,
headings: HEADING_LEVELS.map((l) => options[l]).filter(
(spec): spec is FontSpecification => spec !== undefined,
),
}
}
@@ -140,20 +149,16 @@ function mergeInto(map: Map<string, MergedFont>, role: FontRole, spec: FontSpeci
}
}
/** Google Fonts css2 `family` value; a single weight still names its axis unless it's 400. */
function formatMerged(entry: MergedFont): string {
const weights = [...entry.weights].sort((a, b) => a - b)
const features: string[] = []
if (entry.italic) features.push("ital")
if (weights.length > 1) {
const spec = entry.italic
? weights
.flatMap((w) => [`0,${w}`, `1,${w}`])
.sort()
.join(";")
: weights.join(";")
features.push(`wght@${spec}`)
const defaultWeight = weights.length === 1 && weights[0] === 400
if (entry.italic) {
if (defaultWeight) return `${entry.name}:ital@0;1`
const tuples = [...weights.map((w) => `0,${w}`), ...weights.map((w) => `1,${w}`)]
return `${entry.name}:ital,wght@${tuples.join(";")}`
}
return features.length > 0 ? `${entry.name}:${features.join(",")}` : entry.name
return defaultWeight ? entry.name : `${entry.name}:wght@${weights.join(";")}`
}
export function googleFontHref(fonts: ReturnType<typeof resolveFontSpecs>): string {
@@ -162,6 +167,8 @@ export function googleFontHref(fonts: ReturnType<typeof resolveFontSpecs>): stri
mergeInto(merged, "body", fonts.body)
mergeInto(merged, "code", fonts.code)
if (fonts.title) mergeInto(merged, "title", fonts.title)
if (fonts.interface) mergeInto(merged, "interface", fonts.interface)
for (const spec of fonts.headings) mergeInto(merged, "header", spec)
const params = [...merged.values()]
.map(formatMerged)
.map((f) => `family=${encodeURIComponent(f)}`)
@@ -218,6 +225,7 @@ function validate(options: FontsConfig) {
check("header", options.header, "header")
check("body", options.body, "body")
check("code", options.code, "code")
check("interface", options.interface, "interface")
for (const level of HEADING_LEVELS) check(level, options[level], "header")
}
@@ -310,15 +318,37 @@ export function buildLayeredCSS(fonts: ResolvedFonts, options: FontsConfig, them
].join("\n")
}
/** Unlayered heading fonts beat every layer; with a theme, only explicitly configured ones. */
/** Obsidian's override variables for the body, interface and code roles. */
const OBSIDIAN_OVERRIDES: [string, "body" | "interface" | "code"][] = [
["--font-text-override", "body"],
["--font-interface-override", "interface"],
["--font-monospace-override", "code"],
]
/**
* Unlayered heading fonts beat every layer; with a theme, only explicitly configured ones.
*
* Explicitly configured body/interface/code fonts also go to Obsidian's `--font-*-override`
* variables on `body`: an Obsidian theme's app.css sets `--font-text` and friends on `body`
* itself, so the `:root` values from {@link buildLayeredCSS} never reach the page. This holds
* whether or not the theme registers its fonts (with `themeFonts: false` it maps the overrides
* to Quartz's font variables on `body`), so the selector is `html body`, which wins over a
* theme's `body` rule regardless of stylesheet order. Without an Obsidian theme nothing reads
* the overrides.
*/
export function buildUnlayeredCSS(
fonts: ResolvedFonts,
options: FontsConfig,
themeActive: boolean,
) {
return HEADING_LEVELS.filter((l) => !themeActive || isExplicit(options, l))
.map((l) => `${l} { font-family: ${fonts[l]}; }`)
.join("\n")
const rules = HEADING_LEVELS.filter((l) => !themeActive || isExplicit(options, l)).map(
(l) => `${l} { font-family: ${fonts[l]}; }`,
)
const overrides = OBSIDIAN_OVERRIDES.filter(([, key]) => options[key] !== undefined).map(
([name, key]) => ` ${name}: ${fonts[key]};`,
)
if (overrides.length > 0) rules.push(["html body {", ...overrides, "}"].join("\n"))
return rules.join("\n")
}
// ---- plugin ------------------------------------------------------------------------
@@ -345,9 +375,9 @@ export const Fonts: QuartzEmitterPlugin<FontsConfig> = (userOpts) => {
const theme = ctx?.cfg?.configuration?.theme as
{ cdnCaching?: boolean; fontOrigin?: string } | undefined
const headLinksTypography = theme?.cdnCaching === true && theme?.fontOrigin === "googleFonts"
const overridesTypography = (["title", "header", "body", "code"] as const).some(
(k) => options[k] !== undefined,
)
const overridesTypography = (
["title", "header", "body", "code", "interface", ...HEADING_LEVELS] as const
).some((k) => options[k] !== undefined)
if (options.fontOrigin === "googleFonts" && (!headLinksTypography || overridesTypography)) {
const href = googleFontHref(resolveFontSpecs(options, typography))
additionalHead = [
+10 -4
View File
@@ -264,6 +264,12 @@ a {
flex-direction: row;
padding: 0;
padding-top: 2rem;
// text in the header row (a long page title) may break anywhere, so the row fits the
// screen; the buttons keep their size. Links set their own overflow-wrap.
& > *,
& > * a {
overflow-wrap: anywhere;
}
}
}
@@ -355,7 +361,7 @@ a {
// Full-width frame: no sidebars, center content spans full width
.page[data-frame="full-width"] > #quartz-body {
grid-template-columns: auto;
grid-template-columns: minmax(0, 1fr);
grid-template-rows: auto auto auto;
grid-template-areas:
"grid-header"
@@ -363,7 +369,7 @@ a {
"grid-footer";
@media all and ($tablet) {
grid-template-columns: auto;
grid-template-columns: minmax(0, 1fr);
}
& .center.full-width {
@@ -374,14 +380,14 @@ a {
// Minimal frame: no sidebars, no header/footer chrome, body content only + footer
.page[data-frame="minimal"] > #quartz-body {
grid-template-columns: auto;
grid-template-columns: minmax(0, 1fr);
grid-template-rows: auto auto;
grid-template-areas:
"grid-center"
"grid-footer";
@media all and ($tablet) {
grid-template-columns: auto;
grid-template-columns: minmax(0, 1fr);
}
& .center.minimal {
+5 -2
View File
@@ -23,9 +23,12 @@ $boldWeight: 700;
$semiBoldWeight: 600;
$normalWeight: 400;
// The content column is minmax(0, 1fr), not auto: an auto track grows to its widest item's
// min-content, so one wide element (a themed header row, a long unbreakable word) widened the
// whole page past the screen instead of overflowing on its own.
$mobileGrid: (
templateRows: "auto auto auto auto auto",
templateColumns: "auto",
templateColumns: "minmax(0, 1fr)",
rowGap: "5px",
columnGap: "5px",
templateAreas:
@@ -37,7 +40,7 @@ $mobileGrid: (
);
$tabletGrid: (
templateRows: "auto auto auto auto",
templateColumns: "#{$sidePanelWidth} auto",
templateColumns: "#{$sidePanelWidth} minmax(0, 1fr)",
rowGap: "5px",
columnGap: "5px",
templateAreas: