Compare commits

..
Author SHA1 Message Date
saberzero1 c4d02241d5 Merge remote-tracking branch 'origin/v5' into deps/is-absolute-url-5 2026-11-26 00:28:28 +01:00
Emile Bangma 8ce7599280 Merge pull request #2675 from jackyzha0/deps/js-yaml-5
chore(deps): js-yaml 5
2026-11-26 00:28:09 +01:00
saberzero1 df13ac29e5 chore(deps): is-absolute-url 5 (Quartz already passes httpOnly: false; its types now include the option) 2026-11-26 00:11:56 +01:00
saberzero1 3b78d1658d chore(deps): js-yaml 5 (frontmatter reads YAML 1.2's core schema; comment-only frontmatter has no properties) 2026-11-26 00:10:30 +01:00
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
Emile Bangma 568004496b Merge pull request #2630 from jackyzha0/changeset-release/v5
chore: release Quartz
2026-11-22 01:16:12 +01:00
github-actions[bot] d80bb003f1 chore: release Quartz 2026-11-22 00:12:17 +00:00
Emile Bangma 6f79e008e2 Merge pull request #2660 from jackyzha0/dev-mode/plugin-checkout-force
fix(plugins): force the checkout of a pinned plugin commit (#2639)
2026-11-22 01:11:58 +01:00
24 changed files with 268 additions and 139 deletions

No files matched your search

-9
View File
@@ -1,9 +0,0 @@
---
"@jackyzha0/quartz": patch
---
Bases (bases-page 1.4.0) render closer to Obsidian:
- custom summaries are evaluated, and summaries show their name and appear per group;
- `html()`, `image()`, `icon()`, regular expressions and `file.backlinks` work in formulas;
- `kanban` views, `groupOrder`, grouped list and cards views, and the list and row height options work.
-5
View File
@@ -1,5 +0,0 @@
---
"@jackyzha0/quartz": patch
---
Bases inside a transcluded note render that note's own base, and links in bases follow `configuration.links` (external-link icon, new tab, lazy images, popovers) (bases-page 1.5.1).
-5
View File
@@ -1,5 +0,0 @@
---
"@jackyzha0/quartz": patch
---
Bases columns are labelled with the property's name, as in Obsidian (`priority`, `file name`), instead of title-cased (`Priority`, `Name`); bases-page's new `propertyLabels: title` option keeps the title-cased labels (bases-page 1.5.0).
-5
View File
@@ -1,5 +0,0 @@
---
"@jackyzha0/quartz": minor
---
`quartz build --config <path>` (or `-C`) reads the site configuration from another file than `./quartz.config.yaml`, so the config can live with the content outside the Quartz folder, and one Quartz install can build several content repositories (#2646). With `--watch`/`--serve`, changes to that file trigger a rebuild.
-5
View File
@@ -1,5 +0,0 @@
---
"@jackyzha0/quartz": patch
---
Updates `@quartz-community/obsidian-flavored-markdown` to 2.3.1, which renders callout titles in `.callout-title-inner` without a `<p>`, as in Obsidian (themes put the title below its icon otherwise). Callout titles are styled on `.callout-title-inner` itself (colour, margin, line height); the `> p` rule stays for sites on an older obsidian-flavored-markdown.
-5
View File
@@ -1,5 +0,0 @@
---
"@jackyzha0/quartz": patch
---
Updates dependencies with minor and patch releases: `@clack/prompts` 1.9.0, `@napi-rs/simple-git` 1.2.0, `isomorphic-git` 1.44.18, `minimatch` 11.0.9, `preact-render-to-string` 6.8.3 and `prettier` 3.10.1.
+5
View File
@@ -0,0 +1,5 @@
---
"@jackyzha0/quartz": patch
---
Frontmatter is read with js-yaml 5, using YAML 1.2's core schema (the values Quartz read before are unchanged). Frontmatter with only comments now has no properties, as in Obsidian, instead of being reported as invalid frontmatter.
-5
View File
@@ -1,5 +0,0 @@
---
"@jackyzha0/quartz": patch
---
Permalinks work on large sites: sites of 192 or more files are parsed in worker threads, which didn't receive the permalinks, so a note with a `permalink` was published at its file path (#2644). A permalink with `.` or `..` segments is ignored with a warning instead of writing pages outside the output folder (#2641). With `prettyLinks`, a wikilink to a note whose name has a space or a non-ASCII letter reads as the note's name without its folder, as other links do (#2643).
-5
View File
@@ -1,5 +0,0 @@
---
"@jackyzha0/quartz": patch
---
`quartz plugin install` moves a plugin to its pinned commit even when the plugin's build left tracked files changed (its `package-lock.json`). In CI, a plugin cache restored through `restore-keys` kept those changes, and installing an updated plugin failed with "Please commit your changes or stash them" (#2639).
-5
View File
@@ -1,5 +0,0 @@
---
"@jackyzha0/quartz": patch
---
Updates `@quartz-community/alias-redirects` to 1.0.4 (aliases that point outside the site are skipped, #2641) and `@quartz-community/note-properties` to 1.1.5 (links in properties to missing pages get the `broken` class with `disableBrokenWikilinks`, #2635).
-5
View File
@@ -1,5 +0,0 @@
---
"@jackyzha0/quartz": patch
---
Updated plugins that rely on Quartz 5.1 and now declare it (`quartzVersion: ">=5.1.0"`): encrypted-pages 1.2.0, explicit-publish 1.2.0, unlisted-pages 1.2.0, obsidian-flavored-markdown 2.2.0, folder-page 1.1.0 and bases-page 1.3.0.
-5
View File
@@ -1,5 +0,0 @@
---
"@jackyzha0/quartz": minor
---
Theme support for Obsidian themes: plugin factories may be async (Quartz awaits them); font loading is built in as `configuration.fonts` (formerly the `@quartz-community/quartz-fonts` plugin, whose config entry is applied automatically); callouts and transclusions render as `<div>` like in Obsidian; popovers carry Obsidian's `hover-popover`/`markdown-embed` classes.
-5
View File
@@ -1,5 +0,0 @@
---
"@jackyzha0/quartz": minor
---
Transformers can declare `renderTransforms`: transforms of a page's content when it is rendered, `before` transclusions are inlined and page types' `treeTransforms` run (bases are filled in), and `after` them, on the finished content. encrypted-pages uses them to encrypt a note's finished content, so bases and transclusions in encrypted notes show when unlocked (quartz-community/encrypted-pages#2).
-5
View File
@@ -1,5 +0,0 @@
---
"@jackyzha0/quartz": patch
---
Transcluded content no longer duplicates ids. Headings and footnotes inside a transclusion get ids unique on the page, and the links inside it go to them, so the host's footnotes and a `[[#Heading]]` link inside a transclusion jump to the right place. A same-page link whose target isn't in the transcluded section links to the transcluded page. A heading transclusion (`![[note#Heading]]`) holds only the footnotes it references instead of the page's whole footnotes section.
+41
View File
@@ -1,5 +1,46 @@
# @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
- 4ed26b3: `quartz build --config <path>` (or `-C`) reads the site configuration from another file than `./quartz.config.yaml`, so the config can live with the content outside the Quartz folder, and one Quartz install can build several content repositories (#2646). With `--watch`/`--serve`, changes to that file trigger a rebuild.
- 607ccb8: Theme support for Obsidian themes: plugin factories may be async (Quartz awaits them); font loading is built in as `configuration.fonts` (formerly the `@quartz-community/quartz-fonts` plugin, whose config entry is applied automatically); callouts and transclusions render as `<div>` like in Obsidian; popovers carry Obsidian's `hover-popover`/`markdown-embed` classes.
- 9705969: Transformers can declare `renderTransforms`: transforms of a page's content when it is rendered, `before` transclusions are inlined and page types' `treeTransforms` run (bases are filled in), and `after` them, on the finished content. encrypted-pages uses them to encrypt a note's finished content, so bases and transclusions in encrypted notes show when unlocked (quartz-community/encrypted-pages#2).
### Patch Changes
- ed4f653: Bases (bases-page 1.4.0) render closer to Obsidian:
- custom summaries are evaluated, and summaries show their name and appear per group;
- `html()`, `image()`, `icon()`, regular expressions and `file.backlinks` work in formulas;
- `kanban` views, `groupOrder`, grouped list and cards views, and the list and row height options work.
- 99685cf: Bases inside a transcluded note render that note's own base, and links in bases follow `configuration.links` (external-link icon, new tab, lazy images, popovers) (bases-page 1.5.1).
- 9a04652: Bases columns are labelled with the property's name, as in Obsidian (`priority`, `file name`), instead of title-cased (`Priority`, `Name`); bases-page's new `propertyLabels: title` option keeps the title-cased labels (bases-page 1.5.0).
- 9c46b01: Updates `@quartz-community/obsidian-flavored-markdown` to 2.3.1, which renders callout titles in `.callout-title-inner` without a `<p>`, as in Obsidian (themes put the title below its icon otherwise). Callout titles are styled on `.callout-title-inner` itself (colour, margin, line height); the `> p` rule stays for sites on an older obsidian-flavored-markdown.
- cdc5a02: Updates dependencies with minor and patch releases: `@clack/prompts` 1.9.0, `@napi-rs/simple-git` 1.2.0, `isomorphic-git` 1.44.18, `minimatch` 11.0.9, `preact-render-to-string` 6.8.3 and `prettier` 3.10.1.
- 8578f2f: Permalinks work on large sites: sites of 192 or more files are parsed in worker threads, which didn't receive the permalinks, so a note with a `permalink` was published at its file path (#2644). A permalink with `.` or `..` segments is ignored with a warning instead of writing pages outside the output folder (#2641). With `prettyLinks`, a wikilink to a note whose name has a space or a non-ASCII letter reads as the note's name without its folder, as other links do (#2643).
- 166d09b: `quartz plugin install` moves a plugin to its pinned commit even when the plugin's build left tracked files changed (its `package-lock.json`). In CI, a plugin cache restored through `restore-keys` kept those changes, and installing an updated plugin failed with "Please commit your changes or stash them" (#2639).
- 6f872d4: Updates `@quartz-community/alias-redirects` to 1.0.4 (aliases that point outside the site are skipped, #2641) and `@quartz-community/note-properties` to 1.1.5 (links in properties to missing pages get the `broken` class with `disableBrokenWikilinks`, #2635).
- 0ab525c: Updated plugins that rely on Quartz 5.1 and now declare it (`quartzVersion: ">=5.1.0"`): encrypted-pages 1.2.0, explicit-publish 1.2.0, unlisted-pages 1.2.0, obsidian-flavored-markdown 2.2.0, folder-page 1.1.0 and bases-page 1.3.0.
- 49d0563: Transcluded content no longer duplicates ids. Headings and footnotes inside a transclusion get ids unique on the page, and the links inside it go to them, so the host's footnotes and a `[[#Heading]]` link inside a transclusion jump to the right place. A same-page link whose target isn't in the transcluded section links to the transcluded page. A heading transclusion (`![[note#Heading]]`) holds only the footnotes it references instead of the page's whole footnotes section.
## 5.1.0
### Minor Changes
+65 -32
View File
@@ -1,12 +1,12 @@
{
"name": "@jackyzha0/quartz",
"version": "5.1.0",
"version": "5.2.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@jackyzha0/quartz",
"version": "5.1.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",
@@ -63,9 +63,9 @@
"hast-util-from-html": "^2.0.0",
"hast-util-to-html": "^9.0.5",
"hast-util-to-jsx-runtime": "^2.3.6",
"is-absolute-url": "^4.0.1",
"is-absolute-url": "^5.0.0",
"isomorphic-git": "^1.36.3",
"js-yaml": "^4.1.0",
"js-yaml": "^5.5.0",
"lightningcss": "^1.31.1",
"micromorph": "^0.4.5",
"minimatch": "^11.0.5",
@@ -99,7 +99,6 @@
"@quartz-community/types": "^1.3.1",
"@quartz-community/utils": "^1.2.0",
"@types/hast": "^3.0.4",
"@types/js-yaml": "^4.0.9",
"@types/node": "^26.5.1",
"@types/pretty-time": "^1.1.5",
"@types/semver": "^7.7.1",
@@ -324,6 +323,36 @@
"js-yaml": "^4.1.1"
}
},
"node_modules/@changesets/parse/node_modules/argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"dev": true,
"license": "Python-2.0"
},
"node_modules/@changesets/parse/node_modules/js-yaml": {
"version": "4.3.2",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz",
"integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/puzrin"
},
{
"type": "github",
"url": "https://github.com/sponsors/nodeca"
}
],
"license": "MIT",
"dependencies": {
"argparse": "^2.0.1"
},
"bin": {
"js-yaml": "bin/js-yaml.js"
}
},
"node_modules/@changesets/pre": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@changesets/pre/-/pre-2.0.2.tgz",
@@ -2717,9 +2746,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 +3364,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 +3375,7 @@
"node": ">=22"
},
"peerDependencies": {
"lightningcss": "^1.31.1",
"preact": "^10.0.0"
},
"peerDependenciesMeta": {
@@ -3399,13 +3429,6 @@
"@types/unist": "*"
}
},
"node_modules/@types/js-yaml": {
"version": "4.0.9",
"resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.9.tgz",
"integrity": "sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==",
"dev": true,
"license": "MIT"
},
"node_modules/@types/katex": {
"version": "0.16.8",
"resolved": "https://registry.npmjs.org/@types/katex/-/katex-0.16.8.tgz",
@@ -3551,10 +3574,20 @@
}
},
"node_modules/argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"license": "Python-2.0"
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-3.0.4.tgz",
"integrity": "sha512-fwWK3Zq22l4XJJjx5mcBHGikIk+hJqO+32dPm0Jur7+rtG5x1scOjSfdT9ZKeWHPpsya/l0HHK4tDImBkTrtvA==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/puzrin"
},
{
"type": "github",
"url": "https://github.com/sponsors/nodeca"
}
],
"license": "PSF-2.0"
},
"node_modules/array-union": {
"version": "2.1.0",
@@ -4826,12 +4859,12 @@
"license": "MIT"
},
"node_modules/is-absolute-url": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-4.0.1.tgz",
"integrity": "sha512-/51/TKE88Lmm7Gc4/8btclNXWS+g50wXhYJq8HWIBAGUBnoAdRu1aXeh364t/O7wXDAcTJDP8PNuNKWUDWie+A==",
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-5.0.0.tgz",
"integrity": "sha512-sdJyNpBnQHuVnBunfzjAecOhZr2+A30ywfFvu3EnxtKLUWfwGgyWUmqHbGZiU6vTfHpCPm5GvLe4BAvlU9n8VQ==",
"license": "MIT",
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
"node": ">=20"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
@@ -5056,9 +5089,9 @@
}
},
"node_modules/js-yaml": {
"version": "4.3.2",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz",
"integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==",
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-5.5.0.tgz",
"integrity": "sha512-paNr4LFIFPjeeSmwNYdrb8FafLLG/Cr2Af3GjbsHJ5CxIjH4r0c2emlmRdAtpPAieP1gRVzk6buBbVP5gBMGAg==",
"funding": [
{
"type": "github",
@@ -5071,10 +5104,10 @@
],
"license": "MIT",
"dependencies": {
"argparse": "^2.0.1"
"argparse": "^3.0.3"
},
"bin": {
"js-yaml": "bin/js-yaml.js"
"js-yaml": "bin/js-yaml.mjs"
}
},
"node_modules/jsonfile": {
+5 -6
View File
@@ -1,8 +1,8 @@
{
"name": "@jackyzha0/quartz",
"description": "\ud83c\udf31 publish your digital garden and notes as a website",
"description": "🌱 publish your digital garden and notes as a website",
"private": true,
"version": "5.1.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",
@@ -93,9 +93,9 @@
"hast-util-from-html": "^2.0.0",
"hast-util-to-html": "^9.0.5",
"hast-util-to-jsx-runtime": "^2.3.6",
"is-absolute-url": "^4.0.1",
"is-absolute-url": "^5.0.0",
"isomorphic-git": "^1.36.3",
"js-yaml": "^4.1.0",
"js-yaml": "^5.5.0",
"lightningcss": "^1.31.1",
"micromorph": "^0.4.5",
"minimatch": "^11.0.5",
@@ -126,7 +126,6 @@
"@quartz-community/types": "^1.3.1",
"@quartz-community/utils": "^1.2.0",
"@types/hast": "^3.0.4",
"@types/js-yaml": "^4.0.9",
"@types/node": "^26.5.1",
"@types/pretty-time": "^1.1.5",
"@types/semver": "^7.7.1",
+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
+71 -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 {
@@ -217,6 +223,23 @@ describe("frontmatter built-in", () => {
)
})
test("reads YAML frontmatter with YAML 1.2's core schema, as Obsidian does", () => {
const data = readFrontmatterData(
"---\ntitle: Hello world\ndate: 2024-01-02\ndraft: True\nn: 012\nnone: ~\nratio: .5\nalias: yes\n---\n",
)
assert.deepStrictEqual(data, {
title: "Hello world",
date: "2024-01-02",
draft: true,
n: 12,
none: null,
ratio: 0.5,
alias: "yes",
})
// a block without a document holds no properties
assert.deepStrictEqual(readFrontmatterData("---\n# only a comment\n---\nbody\n"), {})
})
test("refuses JavaScript frontmatter instead of executing it", async () => {
const g = globalThis as { __quartzFrontmatterRan?: boolean }
delete g.__quartzFrontmatterRan
@@ -642,4 +665,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 = [
+13 -2
View File
@@ -1,6 +1,6 @@
import matter from "gray-matter"
import remarkFrontmatter from "remark-frontmatter"
import yaml from "js-yaml"
import { CORE_SCHEMA, loadAll } from "js-yaml"
import toml from "toml"
import { QuartzTransformerPlugin } from "../types"
import { QuartzPluginData } from "../vfile"
@@ -141,6 +141,17 @@ const refuseJavaScript = (): never => {
)
}
/**
* YAML frontmatter as properties. YAML 1.2's core schema, as Obsidian reads properties: `true`,
* `null`, `~` and numbers resolve, dates stay strings. A block without a document (empty, or only
* comments) holds no properties.
*/
function loadYaml(source: string): object {
const docs = loadAll(source, { schema: CORE_SCHEMA })
if (docs.length > 1)
throw new Error("expected a single document in the frontmatter, but found more")
return (docs[0] ?? {}) as object
}
/** Parse a file's frontmatter with the configured delimiters and language (`{}` when it has none). */
export function readFrontmatterData(
source: Buffer | string,
@@ -158,7 +169,7 @@ export function readFrontmatterData(
delimiters: options.delimiters ?? frontmatterDefaults.delimiters,
language,
engines: {
yaml: (s) => yaml.load(s, { schema: yaml.JSON_SCHEMA }) as object,
yaml: loadYaml,
toml: (s) => toml.parse(s) as object,
javascript: refuseJavaScript,
js: refuseJavaScript,
+2 -2
View File
@@ -46,10 +46,10 @@ export const legacyCrawlLinksDefaults: Partial<LinksConfig> = {
markdownLinkResolution: "absolute",
}
const isAbsolute = isAbsoluteUrl as (url: string, options?: { httpOnly?: boolean }) => boolean
// As in Obsidian: a URL with a scheme (`x:y`, but not `../x:y`), or a link whose path is not valid
// percent-encoding (`%zz`, `a%E2.md`), which names no file
const isExternalUrl = (url: string) => isAbsolute(url, { httpOnly: false }) || !linkPathDecodes(url)
const isExternalUrl = (url: string) =>
isAbsoluteUrl(url, { httpOnly: false }) || !linkPathDecodes(url)
// An href percent-decoded, to compare with link text; left as it is when it does not decode
const decodedHref = (href: string) => {
try {
+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: