mirror of
https://github.com/jackyzha0/quartz
synced 2026-11-30 22:44:41 +01:00
Compare commits
18
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9ebfc67c1b | ||
|
|
ffc6bfd3ed | ||
|
|
ea4b07518c | ||
|
|
afebc38b3b | ||
|
|
c7131c909f | ||
|
|
5a740b3ae0 | ||
|
|
6f67702b3e | ||
|
|
685a5c3461 | ||
|
|
114923ac6a | ||
|
|
a7d7389f57 | ||
|
|
699c668cba | ||
|
|
9889d3fb04 | ||
|
|
c68a4945ab | ||
|
|
ce108c8c95 | ||
|
|
57b3b5d0af | ||
|
|
c317915450 | ||
|
|
1e1a3561b3 | ||
|
|
ce1b5d4d89 |
No files matched your search
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
A plugin that depends on a plugin of another pipeline stage (an emitter or component on a transformer) no longer fails the build because of their `order`: order is checked only between plugins of the same stage.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@jackyzha0/quartz": minor
|
||||
---
|
||||
|
||||
`extends` in `quartz.config.yaml` is stable for `default` and local paths: its merge rules won't change in a minor release. `https://` URLs stay experimental. Keys starting with `$` are now reserved in every file of an `extends` chain (the top-level `$schema` aside), so merge operators such as appending to a list can be added later without changing existing configs; a config that uses one stops with an error naming the key. Configs without `extends` are not affected.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
Plugin update: og-image 1.2.0. A page's social image (`socialImage`, or Obsidian's `image` / `cover` property) can be an image in the content folder, written as a wikilink (`[[cover.png]]`), a path from the content folder, a path relative to the note, or a bare file name. Before, every value that was not a URL was read as a path in `quartz/static/`.
|
||||
@@ -1,17 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
Plugin updates with the fixes from a test audit:
|
||||
|
||||
- note-properties: an empty `tags:` or `aliases:` no longer fails the build.
|
||||
- bases-page: sorting, filters, formulas and group headings work as in Obsidian.
|
||||
- encrypted-pages: a numeric `password` encrypts the page, and a custom `outputPath` works.
|
||||
- darkmode, reader-mode, syntax-highlighting and comments: no double handlers after a page is unlocked.
|
||||
- stacked-pages: links work under a base path.
|
||||
- breadcrumbs: `resolveFrontmatterTitle` is honoured.
|
||||
- canvas-page: a `#View` link selects that view.
|
||||
- search: fields left out of `fieldPriority` are searched, and excerpts keep their last word.
|
||||
- explorer: a note next to a folder of the same name stays listed, and folder options apply.
|
||||
- folder-page, og-image, description, table-of-contents, graph, obsidian-flavored-markdown and utils: smaller fixes.
|
||||
- latex: `customMacros` work with MathJax. ox-hugo: figure parameters in backticks.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
Relative links and embeds keep their query string after SPA navigation and in popovers (`./viewer.html?file=a.pdf` no longer loses `?file=a.pdf`).
|
||||
@@ -64,27 +64,3 @@ jobs:
|
||||
run: |
|
||||
npx changeset status --since=origin/v5 >/dev/null 2>&1 \
|
||||
|| echo "::warning::No changeset in this PR. If it changes how Quartz behaves, run 'npx changeset' (see .changeset/README.md)."
|
||||
|
||||
publish-tag:
|
||||
if: ${{ github.repository == 'jackyzha0/quartz' && github.ref == 'refs/heads/v5' }}
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v7
|
||||
with:
|
||||
node-version: 24
|
||||
- name: Get package version
|
||||
run: node -p -e '`PACKAGE_VERSION=${require("./package.json").version}`' >> $GITHUB_ENV
|
||||
- name: Create release tag
|
||||
uses: pkgdeps/git-tag-action@v3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
github_repo: ${{ github.repository }}
|
||||
version: ${{ env.PACKAGE_VERSION }}
|
||||
git_commit_sha: ${{ github.sha }}
|
||||
git_tag_prefix: "v"
|
||||
@@ -85,6 +85,8 @@ jobs:
|
||||
# Letting `gh release create` make the tag instead gives an unsigned annotated tag
|
||||
# object (tagger: whoever merged the release PR), which GitHub marks "Unverified"
|
||||
# (jackyzha0/quartz#2455). `git describe --tags` reads lightweight tags as well.
|
||||
# This is the only place that tags a release: ci.yaml's old `publish-tag` job (an annotated
|
||||
# tag through pkgdeps/git-tag-action) ran first and kept every release tag unverified.
|
||||
if [ -z "$EXISTING" ]; then
|
||||
gh api "repos/$GITHUB_REPOSITORY/git/refs" -f ref="refs/tags/$TAG" -f sha="$GITHUB_SHA" >/dev/null
|
||||
else
|
||||
|
||||
@@ -1,5 +1,31 @@
|
||||
# @jackyzha0/quartz
|
||||
|
||||
## 5.3.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- f285e12: A plugin that depends on a plugin of another pipeline stage (an emitter or component on a transformer) no longer fails the build because of their `order`: order is checked only between plugins of the same stage.
|
||||
- ce108c8: A `locale` that Quartz has no translation for (such as `sv-SE`, `da-DK` or `es-MX`) no longer crashes the build. Quartz uses a translation of the same language (`es-MX` uses `es-ES`), else English, and prints one warning; dates still use the configured locale.
|
||||
- 9889d3f: Plugin updates: folder-page 1.1.5 (a folder's unlisted `index.md` is no longer replaced by a generated folder page), canvas-page 1.1.7 (edges drawn as in Obsidian), search 1.1.5 (Escape with tag suggestions open closes only the suggestions), graph 1.0.10 (the local graph is drawn once per page), stacked-pages 1.0.5 (unused template exports removed) and remark-obsidian 2.2.6.
|
||||
- 37a61cf: Plugin updates with the fixes from a test audit:
|
||||
|
||||
- note-properties: an empty `tags:` or `aliases:` no longer fails the build.
|
||||
- bases-page: sorting, filters, formulas and group headings work as in Obsidian.
|
||||
- encrypted-pages: a numeric `password` encrypts the page, and a custom `outputPath` works.
|
||||
- darkmode, reader-mode, syntax-highlighting and comments: no double handlers after a page is unlocked.
|
||||
- stacked-pages: links work under a base path.
|
||||
- breadcrumbs: `resolveFrontmatterTitle` is honoured.
|
||||
- canvas-page: a `#View` link selects that view.
|
||||
- search: fields left out of `fieldPriority` are searched, and excerpts keep their last word.
|
||||
- explorer: a note next to a folder of the same name stays listed, and folder options apply.
|
||||
- folder-page, og-image, description, table-of-contents, graph, obsidian-flavored-markdown and utils: smaller fixes.
|
||||
- latex: `customMacros` work with MathJax. ox-hugo: figure parameters in backticks.
|
||||
|
||||
- 6729a1e: Relative links and embeds keep their query string after SPA navigation and in popovers (`./viewer.html?file=a.pdf` no longer loses `?file=a.pdf`).
|
||||
- c68a494: Some fixes in this release change how existing pages look, mostly to match Obsidian: Bases sorting (natural text order, empty values last, mixed types), Bases `not:` filters and `== null`, Bases group headings, canvas edges, and folders with an unlisted `index.md`. See [Upgrading from 5.3.0 to 5.3.1](https://quartz.jzhao.xyz/getting-started/upgrading#upgrading-from-530-to-531).
|
||||
- 57b3b5d: `npx quartz plugin install --latest` (and `plugin update`) no longer fails because a disabled plugin can't be updated, for example an old `quartz-themes` entry whose repository moved its plugin. The build doesn't load disabled plugins, so this is now a warning that says how to remove the entry. A failing enabled plugin still fails the command.
|
||||
- 1e1a356: utils 1.3.4: inline `#tag` links from notes two or more folders deep stay under the site's base path. They went to `/tags/…` instead of `/<base>/tags/…`, a 404 on sites served under a sub-path such as GitHub Pages project sites.
|
||||
|
||||
## 5.3.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -44,17 +44,20 @@ plugins:
|
||||
|
||||
- `extends` is `default`, a path to another config file relative to this one (which may itself extend another), an `https://` URL, or a list of those. An empty file (or one with only comments) is an empty config, and `extends: []` extends nothing.
|
||||
- A list stacks presets: each file in it adds its own changes. Quartz puts every file of the `extends` chain in one line and applies each once, its bases before it: the list's entries in order, each after the bases it extends, and your file last. A base that several entries share (usually `default`) is applied once, at its first appearance. So with `extends: [./a.yaml, ./b.yaml]`, where both extend `default`, the order is `default` → `a.yaml` → `b.yaml` → your file: what `a.yaml` changes stays unless `b.yaml` changes the same thing (later entries win), and your file wins over both. An entry that doesn't extend the shared base is applied before it if it comes first, so the base's settings win over it; make such a preset extend `default` too, or list it after the others.
|
||||
- A URL is fetched when the config is loaded (10 s timeout, at most 1 MB) and kept in `.quartz-cache/extends/`. If a later fetch fails (offline, timeout, HTTP error), Quartz uses the cached copy and warns; without one, the build stops. `QUARTZ_EXTENDS_OFFLINE=1` uses only the cached copy. Relative `extends` inside a fetched file are resolved against its URL; `default` always means your local `quartz.config.default.yaml`. Only `https://` URLs are allowed, and only extend configs you trust: they choose which plugins your build runs.
|
||||
- **Experimental:** `https://` URLs. How they are fetched, cached and trusted may still change. A URL is fetched when the config is loaded (10 s timeout, at most 1 MB) and kept in `.quartz-cache/extends/`. If a later fetch fails (offline, timeout, HTTP error), Quartz uses the cached copy and warns; without one, the build stops. `QUARTZ_EXTENDS_OFFLINE=1` uses only the cached copy. Relative `extends` inside a fetched file are resolved against its URL; `default` always means your local `quartz.config.default.yaml`. Only `https://` URLs are allowed, and only extend configs you trust: they choose which plugins your build runs.
|
||||
- `configuration` and `layout` merge key by key, including nested objects (`theme.colors.lightMode.secondary` changes only that colour). Any other value replaces the default: strings, numbers and lists such as `ignorePatterns` or `byPageType.<type>.exclude`. Setting a key to `null` removes it, so the built-in default applies.
|
||||
- A plugin entry changes the default entry for the same plugin, matched by name (`github:quartz-community/explorer` matches `@quartz-community/explorer`, and a fork with the same name replaces it). A source with a `name` matches by that name; a source with a `subdir` and no `name` matches by repository and folder, so two plugins of one repository stay separate. `enabled`, `order` and `source` replace the default values. `options` and `layout` merge like `configuration`, and `null` drops them so the plugin's own defaults apply. A plugin that is not in the base is added, and it needs `enabled: true` just as in a full config.
|
||||
- Keys starting with `$` are reserved in every file of an `extends` chain, at any depth (the top-level `$schema` aside): they are kept free for merge operators, such as adding to a list instead of replacing it. A config that uses one stops with an error naming the key. Values may contain `$` freely.
|
||||
- Plugins run in `order` as before. Your file can change a default plugin's `order`. Where two plugins have the same order, the base config's list order decides, and added plugins come last.
|
||||
- Your updates to `quartz.config.default.yaml` (for example after `npx quartz upgrade`) reach your site without copying them over.
|
||||
|
||||
- `npx quartz build --serve` also rebuilds when a local file your config extends changes.
|
||||
- `npx quartz plugin` commands and `npx quartz info` read the merged configuration, as the build does: `plugin list`, `status`, `doctor`, `install` and `prune` see the plugins your bases configure. Commands that change plugins only ever write your own file, never the merged result: `enable`, `disable` and `config --set` add or change your entry for the plugin (`- source: …` with just that change), `config --unset` removes your value and, when a base sets the option, sets it to `null` so the plugin's default applies, and `add` appends a full entry. `remove` refuses a plugin that a base configures (it can't be removed from your file); disable it instead.
|
||||
|
||||
> [!warning] Experimental
|
||||
> `extends` is experimental: the merge rules may still change.
|
||||
> [!note] Stability
|
||||
> `extends` with `default` and local paths is stable: the merge rules above don't change in a minor release. `https://` URLs are experimental.
|
||||
>
|
||||
> A Quartz upgrade can change the defaults your site extends. A changed default applies to your site unless your file sets that value itself.
|
||||
|
||||
## General Configuration
|
||||
|
||||
|
||||
@@ -28,6 +28,32 @@ npx quartz plugin install --latest
|
||||
|
||||
See the [[upgrade|CLI reference for upgrade]] for more details on available flags.
|
||||
|
||||
## Upgrading from 5.3.0 to 5.3.1
|
||||
|
||||
5.3.1 is a patch release: fixes from a test audit of Quartz and its plugins, many checked against Obsidian. Upgrade as usual:
|
||||
|
||||
```bash
|
||||
npx quartz upgrade
|
||||
npx quartz plugin install --latest
|
||||
```
|
||||
|
||||
### Changes you may notice
|
||||
|
||||
Most of these make a page look the way Obsidian shows it, so an existing site can look different after the upgrade.
|
||||
|
||||
- **[[Bases]] sorting**: text sorts naturally ("Chapter 2" before "Chapter 10") and ignores case, also for the default order by file name. Empty values come last in both directions, including descending sorts. A column that mixes types sorts numbers, dates and durations by value and everything else as text. Group order follows the same rules.
|
||||
- **[[Bases]] filters and formulas**, as in Obsidian:
|
||||
- `not:` leaves out a note that matches _any_ of its conditions (it left out only notes matching all of them).
|
||||
- `status == null` matches notes without `status`, and `status != null` no longer keeps them.
|
||||
- `"5" == 5` and `1 == true` are true, two strings compare as text (`"10" > "9"` is false), and an empty list counts as false.
|
||||
- A formula can use a formula defined after it. `x / 0` shows ∞. `sum()`, `mean()`, `min()` and `max()` skip text and booleans, and are empty without numbers. `number("abc")` is an error.
|
||||
- **[[Bases]] group headings** show their value as a cell does: dates in the local format (not an ISO timestamp, sometimes of the previous day), durations as "4 days", links as the note's name, booleans as a checkbox.
|
||||
- **[[CanvasPage|Canvas]] edges** leave and enter each card through the side they name, with Obsidian's curve, and the arrow points into that side. An edge without sides joins the sides that face each other (it joined the cards' centres).
|
||||
- **Folder pages**: a folder whose own `index.md` is unlisted shows that note, with the folder listing below it. A generated folder page used to replace it.
|
||||
- **Tag links under a base path**: inline `#tag` links from notes two or more folders deep stay on the site. On a site served under a sub-path, such as a GitHub Pages project site, they went to `/tags/…` and returned 404.
|
||||
- **Locales without a translation** (such as `sv-SE`) no longer crash the build: Quartz uses a translation of the same language, else English, and prints a warning. Dates still use your locale.
|
||||
- **`npx quartz plugin install --latest`** no longer fails because a _disabled_ plugin can't be updated (for example an old `quartz-themes` entry). It prints a warning with the command to remove the entry.
|
||||
|
||||
## Upgrading from 5.2 to 5.3
|
||||
|
||||
Quartz 5.3 needs **Node.js 22.22 or later**. Then upgrade as usual:
|
||||
|
||||
Generated
+33
-33
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@jackyzha0/quartz",
|
||||
"version": "5.3.0",
|
||||
"version": "5.3.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@jackyzha0/quartz",
|
||||
"version": "5.3.0",
|
||||
"version": "5.3.1",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@clack/prompts": "^1.8.0",
|
||||
@@ -18,7 +18,7 @@
|
||||
"@quartz-community/backlinks": "^1.0.4",
|
||||
"@quartz-community/bases-page": "^1.5.6",
|
||||
"@quartz-community/breadcrumbs": "^1.0.6",
|
||||
"@quartz-community/canvas-page": "^1.1.6",
|
||||
"@quartz-community/canvas-page": "^1.1.7",
|
||||
"@quartz-community/citations": "^1.0.1",
|
||||
"@quartz-community/cname": "^1.0.1",
|
||||
"@quartz-community/comments": "^1.0.3",
|
||||
@@ -31,23 +31,23 @@
|
||||
"@quartz-community/explicit-publish": "^1.2.0",
|
||||
"@quartz-community/explorer": "^1.2.5",
|
||||
"@quartz-community/favicon": "^1.0.1",
|
||||
"@quartz-community/folder-page": "^1.1.4",
|
||||
"@quartz-community/folder-page": "^1.1.5",
|
||||
"@quartz-community/footer": "^1.1.2",
|
||||
"@quartz-community/github-flavored-markdown": "^2.2.2",
|
||||
"@quartz-community/graph": "^1.0.9",
|
||||
"@quartz-community/graph": "^1.0.10",
|
||||
"@quartz-community/hard-line-breaks": "^1.1.0",
|
||||
"@quartz-community/latex": "^1.1.3",
|
||||
"@quartz-community/note-properties": "^1.2.4",
|
||||
"@quartz-community/obsidian-flavored-markdown": "^2.5.4",
|
||||
"@quartz-community/og-image": "^1.1.4",
|
||||
"@quartz-community/og-image": "^1.2.0",
|
||||
"@quartz-community/ox-hugo": "^1.0.4",
|
||||
"@quartz-community/page-title": "^1.0.2",
|
||||
"@quartz-community/reader-mode": "^1.0.3",
|
||||
"@quartz-community/recent-notes": "^1.0.3",
|
||||
"@quartz-community/roam": "^1.1.0",
|
||||
"@quartz-community/search": "^1.1.4",
|
||||
"@quartz-community/search": "^1.1.5",
|
||||
"@quartz-community/spacer": "^1.0.2",
|
||||
"@quartz-community/stacked-pages": "^1.0.4",
|
||||
"@quartz-community/stacked-pages": "^1.0.5",
|
||||
"@quartz-community/syntax-highlighting": "^1.0.5",
|
||||
"@quartz-community/table-of-contents": "^1.0.6",
|
||||
"@quartz-community/tag-list": "^1.0.3",
|
||||
@@ -97,7 +97,7 @@
|
||||
"devDependencies": {
|
||||
"@changesets/cli": "^3.0.3",
|
||||
"@quartz-community/types": "^1.3.1",
|
||||
"@quartz-community/utils": "^1.3.3",
|
||||
"@quartz-community/utils": "^1.3.4",
|
||||
"@types/hast": "^3.0.4",
|
||||
"@types/node": "^26.5.1",
|
||||
"@types/pretty-time": "^1.1.5",
|
||||
@@ -2383,9 +2383,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/canvas-page": {
|
||||
"version": "1.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/canvas-page/-/canvas-page-1.1.6.tgz",
|
||||
"integrity": "sha512-Cuu3xxC1PCKM5+ixO58cnNmK0So9RHnE1bxVLPW619b0tCL2ZyuN4QQK4yCN7ia8N6uiLyI+jqAALMS1+tl9fA==",
|
||||
"version": "1.1.7",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/canvas-page/-/canvas-page-1.1.7.tgz",
|
||||
"integrity": "sha512-I2I5JqqJ6PGnnwq57KI27Z643o/yUrxl654uwV8m+hFPmaN1iG8OQD7597JDHYXrwWCKWnNi23Wy3HXFu0yPUg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -2664,9 +2664,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/folder-page": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/folder-page/-/folder-page-1.1.4.tgz",
|
||||
"integrity": "sha512-aEaXi5qJdWPMMvtBakaVw/wDU/iVf5ujW1hMnBxDJyCDXF9FRdk1njeFi+Op299y5SWnF7+ruLjhraqeaYLnCA==",
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/folder-page/-/folder-page-1.1.5.tgz",
|
||||
"integrity": "sha512-Uxlno9jMCDzlKbF5HkrvUDzg0zxqabUhIfANsfC1RlfSq6cNmuXUYwe45vhkEp/KDOM8bBcfuHKARO3OqABzGA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -2734,9 +2734,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/graph": {
|
||||
"version": "1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/graph/-/graph-1.0.9.tgz",
|
||||
"integrity": "sha512-7t6v0i9dPr8JIWRQEalszHk25pmhapns/mD18zyt0P1EwbZrU8Kbc5l6nXFM7jSq/pfigDvo9GmcNFFtTMYK1Q==",
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/graph/-/graph-1.0.10.tgz",
|
||||
"integrity": "sha512-UkqWEI48wmxLQPS+HNW4Pm0GnuUpcn7IfZ3ufcg1S4/lVqrdrofj7SioXDm7djuwr/wsLPDsdC1YBCwct/Eu5w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -2853,9 +2853,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/og-image": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/og-image/-/og-image-1.1.4.tgz",
|
||||
"integrity": "sha512-aJyXYMjIPrj3M3jFoYyqW/YODKmSoJP+bbQ5LyH0FnpuWGIGDBPVRqYmx5qUuiVjc5SMiVMMf8AyWuH63nCbUQ==",
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/og-image/-/og-image-1.2.0.tgz",
|
||||
"integrity": "sha512-fVvrOwog7QTGf7X0iNPFAmM5nRvK4Mdh9XQqpE8PDQ3X9fbHcnCq++H1H+a0xXjiB1BADKuT2146pjNmOkPEaw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -2979,9 +2979,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/remark-obsidian": {
|
||||
"version": "2.2.5",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/remark-obsidian/-/remark-obsidian-2.2.5.tgz",
|
||||
"integrity": "sha512-xlJX+6XIWEBCPnJ4Mg8Xnrxeh2+pq0XAKUWXGOEY0kHNf2uDsiM5VRTd15/4jR1J2FN2KmOAB7jV+8J0xSlnqg==",
|
||||
"version": "2.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/remark-obsidian/-/remark-obsidian-2.2.6.tgz",
|
||||
"integrity": "sha512-hDxyFiA5SYIcsO1i3vnlMQEryoev2RtFy9UZ9MGNfANxiWypxCG/uWUjA+uiISMJgHSRk/CpWcn7lTGGvMVT3A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/mdast": "^4.0.0",
|
||||
@@ -3019,9 +3019,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/search": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/search/-/search-1.1.4.tgz",
|
||||
"integrity": "sha512-s02rNbjLkg4rVNdA0Pr2LHlGK1zn0PcS2+mBoyWqhZ4vZraGKgLpbAUiDgXD740GU630vcpEwmtT0FNWbgzl9g==",
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/search/-/search-1.1.5.tgz",
|
||||
"integrity": "sha512-9qgJsfOlqBPP41ICDOmmHOYiJbjlIMYm6EduvjS4t32YWglRJpO5l0Dle6A8VYmt7PW6qrAkh2EU7TvwCUU2Aw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -3062,9 +3062,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/stacked-pages": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/stacked-pages/-/stacked-pages-1.0.4.tgz",
|
||||
"integrity": "sha512-XQsi9CwReWxr7c6e1uWHpYYegQfpaL+sPPASkM+RVX0pw21V9aYpMy0HRFWpbyJnpIM847rVPfZ6W3IH3Db/mw==",
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/stacked-pages/-/stacked-pages-1.0.5.tgz",
|
||||
"integrity": "sha512-sUDlcgREgWyttDg4A6Xp6i3s0jjLzO0g/pvP2a5KSYfNtsN9djbvwaPaewV9e/dn92VyTWrKsXd7K05yTCcFQw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -3230,9 +3230,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/utils": {
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/utils/-/utils-1.3.3.tgz",
|
||||
"integrity": "sha512-g33lwWCBL1SpcWP/NgClXUMG8BILrGbkT6/7xR/Dtnf0X8DP+1em+emRJElckzxGUXsLnDY+jvhn4zu8xaXXFQ==",
|
||||
"version": "1.3.4",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/utils/-/utils-1.3.4.tgz",
|
||||
"integrity": "sha512-S1zlszf1jcHXcWXnlow/VxW3kKlTEWWNGQmWP07b8vAOB8lAIkeYRR5KoUA0TdjZPgN5dRaFHaAhv6sC2g/4Gw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0"
|
||||
|
||||
+8
-8
@@ -2,7 +2,7 @@
|
||||
"name": "@jackyzha0/quartz",
|
||||
"description": "🌱 publish your digital garden and notes as a website",
|
||||
"private": true,
|
||||
"version": "5.3.0",
|
||||
"version": "5.3.1",
|
||||
"type": "module",
|
||||
"author": "jackyzha0 <j.zhao2k19@gmail.com>",
|
||||
"license": "MIT",
|
||||
@@ -48,7 +48,7 @@
|
||||
"@quartz-community/backlinks": "^1.0.4",
|
||||
"@quartz-community/bases-page": "^1.5.6",
|
||||
"@quartz-community/breadcrumbs": "^1.0.6",
|
||||
"@quartz-community/canvas-page": "^1.1.6",
|
||||
"@quartz-community/canvas-page": "^1.1.7",
|
||||
"@quartz-community/citations": "^1.0.1",
|
||||
"@quartz-community/cname": "^1.0.1",
|
||||
"@quartz-community/comments": "^1.0.3",
|
||||
@@ -61,23 +61,23 @@
|
||||
"@quartz-community/explicit-publish": "^1.2.0",
|
||||
"@quartz-community/explorer": "^1.2.5",
|
||||
"@quartz-community/favicon": "^1.0.1",
|
||||
"@quartz-community/folder-page": "^1.1.4",
|
||||
"@quartz-community/folder-page": "^1.1.5",
|
||||
"@quartz-community/footer": "^1.1.2",
|
||||
"@quartz-community/github-flavored-markdown": "^2.2.2",
|
||||
"@quartz-community/graph": "^1.0.9",
|
||||
"@quartz-community/graph": "^1.0.10",
|
||||
"@quartz-community/hard-line-breaks": "^1.1.0",
|
||||
"@quartz-community/latex": "^1.1.3",
|
||||
"@quartz-community/note-properties": "^1.2.4",
|
||||
"@quartz-community/obsidian-flavored-markdown": "^2.5.4",
|
||||
"@quartz-community/og-image": "^1.1.4",
|
||||
"@quartz-community/og-image": "^1.2.0",
|
||||
"@quartz-community/ox-hugo": "^1.0.4",
|
||||
"@quartz-community/page-title": "^1.0.2",
|
||||
"@quartz-community/reader-mode": "^1.0.3",
|
||||
"@quartz-community/recent-notes": "^1.0.3",
|
||||
"@quartz-community/roam": "^1.1.0",
|
||||
"@quartz-community/search": "^1.1.4",
|
||||
"@quartz-community/search": "^1.1.5",
|
||||
"@quartz-community/spacer": "^1.0.2",
|
||||
"@quartz-community/stacked-pages": "^1.0.4",
|
||||
"@quartz-community/stacked-pages": "^1.0.5",
|
||||
"@quartz-community/syntax-highlighting": "^1.0.5",
|
||||
"@quartz-community/table-of-contents": "^1.0.6",
|
||||
"@quartz-community/tag-list": "^1.0.3",
|
||||
@@ -124,7 +124,7 @@
|
||||
"devDependencies": {
|
||||
"@changesets/cli": "^3.0.3",
|
||||
"@quartz-community/types": "^1.3.1",
|
||||
"@quartz-community/utils": "^1.3.3",
|
||||
"@quartz-community/utils": "^1.3.4",
|
||||
"@types/hast": "^3.0.4",
|
||||
"@types/node": "^26.5.1",
|
||||
"@types/pretty-time": "^1.1.5",
|
||||
|
||||
@@ -335,6 +335,17 @@ yargs(hideBin(process.argv))
|
||||
},
|
||||
)
|
||||
.showHelpOnFail(true)
|
||||
.fail((msg, err, y) => {
|
||||
// A mistake in quartz.config.yaml (an `extends` error names the file and the key): the
|
||||
// message says what to fix, so print it without the usage text, which is about arguments.
|
||||
if (err?.name === "ConfigExtendsError") {
|
||||
console.error(`✗ ${err.message}`)
|
||||
process.exit(1)
|
||||
}
|
||||
y.showHelp()
|
||||
console.error(err ?? msg)
|
||||
process.exit(1)
|
||||
})
|
||||
.help()
|
||||
.strict()
|
||||
.demandCommand().argv
|
||||
@@ -1160,6 +1160,13 @@ export async function handlePluginInstallUnified({
|
||||
const pluginsToUpdate = nameFilter ? Array.from(nameFilter) : Object.keys(lockfile.plugins)
|
||||
const updatedPlugins = []
|
||||
let lockfileChanged = false
|
||||
// Disabled in the config: the build never loads them, so failing to update one is a warning,
|
||||
// not a failed update (an old entry whose repository changed layout failed every update).
|
||||
const disabledNames = new Set(
|
||||
(pluginsJson?.plugins ?? [])
|
||||
.filter((entry) => entry.enabled === false)
|
||||
.map((entry) => extractPluginName(entry.source)),
|
||||
)
|
||||
|
||||
// Phase 1: Validate and categorize plugins (fast, sequential)
|
||||
const validPlugins = []
|
||||
@@ -1244,6 +1251,16 @@ export async function handlePluginInstallUnified({
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
if (disabledNames.has(name)) {
|
||||
console.log(
|
||||
styleText(
|
||||
"yellow",
|
||||
`⚠ Could not update ${name} (disabled, so the build does not load it): ${describeCommandError(error)}\n` +
|
||||
` Remove it with \`npx quartz plugin remove ${name}\` or fix its source.`,
|
||||
),
|
||||
)
|
||||
return
|
||||
}
|
||||
console.log(
|
||||
styleText("red", `✗ Failed to update ${name}: ${describeCommandError(error)}`),
|
||||
)
|
||||
|
||||
@@ -294,3 +294,67 @@ describe("plugin commands with an extending config", () => {
|
||||
assert.doesNotMatch(read(dir), /comments/)
|
||||
})
|
||||
})
|
||||
|
||||
describe("plugin install --latest with a plugin that can't be updated", () => {
|
||||
const cli = path.resolve(import.meta.dirname, "..", "bootstrap-cli.mjs")
|
||||
// A Git plugin whose repository no longer has the configured subdirectory (an old
|
||||
// quartz-themes entry: the repository moved its plugin out of `plugin/`).
|
||||
const site = (enabled) => {
|
||||
const repo = path.join(root, "repo")
|
||||
fs.mkdirSync(repo, { recursive: true })
|
||||
fs.writeFileSync(path.join(repo, "README.md"), "no plugin/ here\n")
|
||||
const git = (args) => execSync(`git ${args}`, { cwd: repo, stdio: "ignore", timeout: 30_000 })
|
||||
git("init -q -b main")
|
||||
git("-c user.name=t -c user.email=t@t add .")
|
||||
git("-c user.name=t -c user.email=t@t commit -q -m init")
|
||||
const url = pathToFileURL(repo).href
|
||||
const dir = path.join(root, "site")
|
||||
fs.mkdirSync(path.join(dir, ".quartz", "plugins", "old-theme"), { recursive: true })
|
||||
fs.writeFileSync(path.join(dir, "package.json"), `{ "name": "site", "version": "5.3.1" }`)
|
||||
fs.writeFileSync(
|
||||
path.join(dir, "quartz.config.yaml"),
|
||||
YAML.stringify({
|
||||
configuration: { pageTitle: "t" },
|
||||
plugins: [{ source: { name: "old-theme", repo: url, subdir: "plugin" }, enabled }],
|
||||
}),
|
||||
)
|
||||
fs.writeFileSync(
|
||||
path.join(dir, "quartz.lock.json"),
|
||||
JSON.stringify({
|
||||
version: "1.0.0",
|
||||
plugins: {
|
||||
"old-theme": {
|
||||
source: url,
|
||||
resolved: url,
|
||||
subdir: "plugin",
|
||||
commit: "0000000000000000000000000000000000000000",
|
||||
installedAt: "2026-01-01T00:00:00.000Z",
|
||||
},
|
||||
},
|
||||
}),
|
||||
)
|
||||
return dir
|
||||
}
|
||||
const run = (dir) => {
|
||||
const result = spawnSync(process.execPath, [cli, "plugin", "install", "--latest"], {
|
||||
cwd: dir,
|
||||
encoding: "utf-8",
|
||||
timeout: 60_000,
|
||||
env: { ...process.env, QUARTZ_CONFIG_PATH: "" },
|
||||
})
|
||||
return { output: result.stdout + result.stderr, status: result.status }
|
||||
}
|
||||
|
||||
test("a disabled plugin only warns: the build doesn't load it", () => {
|
||||
const { output, status } = run(site(false))
|
||||
assert.match(output, /Could not update old-theme \(disabled/)
|
||||
assert.match(output, /npx quartz plugin remove old-theme/)
|
||||
assert.strictEqual(status, 0)
|
||||
})
|
||||
|
||||
test("an enabled plugin fails the update", () => {
|
||||
const { output, status } = run(site(true))
|
||||
assert.match(output, /Failed to update old-theme/)
|
||||
assert.strictEqual(status, 1)
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,28 @@
|
||||
import test, { describe } from "node:test"
|
||||
import assert from "node:assert"
|
||||
import { i18n, resolveTranslationLocale } from "./index"
|
||||
|
||||
describe("i18n locale fallback", () => {
|
||||
test("a locale with a translation uses it, whatever its case", (t) => {
|
||||
t.mock.method(console, "warn", () => {})
|
||||
assert.strictEqual(resolveTranslationLocale("de-DE"), "de-DE")
|
||||
assert.strictEqual(resolveTranslationLocale("de-de"), "de-DE")
|
||||
assert.strictEqual(resolveTranslationLocale(undefined), "en-US")
|
||||
})
|
||||
|
||||
test("a locale without one uses the same language, else English, and warns once", (t) => {
|
||||
const warn = t.mock.method(console, "warn", () => {})
|
||||
assert.strictEqual(resolveTranslationLocale("es-MX"), "es-ES")
|
||||
assert.strictEqual(resolveTranslationLocale("es-MX"), "es-ES")
|
||||
assert.strictEqual(resolveTranslationLocale("sv-SE"), "en-US")
|
||||
assert.strictEqual(resolveTranslationLocale("nb"), "nb-NO")
|
||||
assert.strictEqual(warn.mock.callCount(), 3)
|
||||
assert.match(String(warn.mock.calls[0]!.arguments[0]), /no translation for locale "es-MX"/)
|
||||
})
|
||||
|
||||
// used to throw: TRANSLATIONS["sv-SE"] was undefined
|
||||
test("i18n() of a locale without a translation returns one", (t) => {
|
||||
t.mock.method(console, "warn", () => {})
|
||||
assert.strictEqual(i18n("da-DK").pages.error.title, i18n("en-US").pages.error.title)
|
||||
})
|
||||
})
|
||||
+28
-1
@@ -85,6 +85,33 @@ export const TRANSLATIONS = {
|
||||
} as const
|
||||
|
||||
export const defaultTranslation = "en-US"
|
||||
export const i18n = (locale: ValidLocale): Translation => TRANSLATIONS[locale ?? defaultTranslation]
|
||||
|
||||
const warnedLocales = new Set<string>()
|
||||
|
||||
/**
|
||||
* The translation to use for `locale`: its own, else one of the same language (`es-MX` uses
|
||||
* `es-ES`), else English. A locale without a translation used to crash the build
|
||||
* (`TRANSLATIONS[locale]` is undefined); dates and numbers still use the configured locale.
|
||||
*/
|
||||
export function resolveTranslationLocale(locale: string | undefined): ValidLocale {
|
||||
if (!locale) return defaultTranslation
|
||||
const keys = Object.keys(TRANSLATIONS) as ValidLocale[]
|
||||
const exact = keys.find((key) => key.toLowerCase() === locale.toLowerCase())
|
||||
if (exact) return exact
|
||||
const language = locale.split("-")[0]!.toLowerCase()
|
||||
const chosen =
|
||||
keys.find((key) => key.split("-")[0]!.toLowerCase() === language) ?? defaultTranslation
|
||||
if (!warnedLocales.has(locale)) {
|
||||
warnedLocales.add(locale)
|
||||
console.warn(
|
||||
`Quartz has no translation for locale "${locale}"; its text uses ${chosen}. ` +
|
||||
`Dates still use ${locale}. Translations: https://quartz.jzhao.xyz/features/i18n`,
|
||||
)
|
||||
}
|
||||
return chosen
|
||||
}
|
||||
|
||||
export const i18n = (locale: ValidLocale | string | undefined): Translation =>
|
||||
TRANSLATIONS[resolveTranslationLocale(locale)]
|
||||
export type ValidLocale = keyof typeof TRANSLATIONS
|
||||
export type ValidCallout = keyof CalloutTranslation
|
||||
@@ -379,6 +379,70 @@ describe("resolveExtends", () => {
|
||||
)
|
||||
})
|
||||
|
||||
describe("keys starting with $ are reserved", () => {
|
||||
const own = path.join(root, "quartz.config.yaml")
|
||||
const opts = { quartzRoot: root, readFile }
|
||||
|
||||
test("in the extending file, at any depth", async () => {
|
||||
for (const [data, where] of [
|
||||
[
|
||||
{ configuration: { ignorePatterns: { $append: ["drafts"] } } },
|
||||
"configuration.ignorePatterns.$append",
|
||||
],
|
||||
[{ configuration: { $pageTitle: "x" } }, "configuration.$pageTitle"],
|
||||
[
|
||||
{ layout: { byPageType: { folder: { $exclude: [] } } } },
|
||||
"layout.byPageType.folder.$exclude",
|
||||
],
|
||||
[
|
||||
{ plugins: [{ source: "@quartz-community/explorer", options: { $merge: {} } }] },
|
||||
"plugins.0.options.$merge",
|
||||
],
|
||||
[
|
||||
{ plugins: [{ source: "@quartz-community/explorer", $remove: true }] },
|
||||
"plugins.0.$remove",
|
||||
],
|
||||
[{ $plugins: [] }, "$plugins"],
|
||||
] as const) {
|
||||
await assert.rejects(
|
||||
() => resolveExtends({ extends: "default", ...data }, own, opts),
|
||||
{
|
||||
name: "ConfigExtendsError",
|
||||
message: `${own}: "${where}" — keys starting with "$" are reserved in configs that use "extends"`,
|
||||
},
|
||||
where,
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
test("in a base the config extends", async () => {
|
||||
put("preset.yaml", { extends: "default", configuration: { $x: 1 } })
|
||||
await assert.rejects(
|
||||
() => resolveExtends({ extends: "./preset.yaml" }, own, opts),
|
||||
/preset\.yaml: "configuration\.\$x" — keys starting with "\$" are reserved/,
|
||||
)
|
||||
})
|
||||
|
||||
test("the top-level $schema is allowed, and $ inside values is fine", async () => {
|
||||
const merged = await resolveExtends(
|
||||
{
|
||||
$schema: "./quartz/plugins/quartz-plugins.schema.json",
|
||||
extends: "default",
|
||||
configuration: { pageTitle: "$5 tips", ignorePatterns: ["$tmp"] },
|
||||
},
|
||||
own,
|
||||
opts,
|
||||
)
|
||||
assert.strictEqual(merged.configuration.pageTitle, "$5 tips")
|
||||
assert.deepStrictEqual(merged.configuration.ignorePatterns, ["$tmp"])
|
||||
})
|
||||
|
||||
test("a config without extends is not checked", async () => {
|
||||
const data = { configuration: { pageTitle: "x", $custom: 1 }, plugins: [] }
|
||||
assert.strictEqual(await resolveExtends(data, own, opts), data as never)
|
||||
})
|
||||
})
|
||||
|
||||
test("a base that is not a configuration object is an error", async () => {
|
||||
files[path.join(root, "list.yaml")] = "- source: explorer\n- source: graph\n"
|
||||
const file = path.join(root, "list.yaml")
|
||||
|
||||
@@ -342,6 +342,32 @@ export function resolveTarget(target: string, from: string, quartzRoot: string):
|
||||
return resolved
|
||||
}
|
||||
|
||||
/**
|
||||
* Keys starting with `$` are reserved in every file of an `extends` chain (the top-level
|
||||
* `$schema` aside), at any depth: they are kept free for merge operators, such as appending
|
||||
* to a list instead of replacing it, so adding those later changes no existing config.
|
||||
*/
|
||||
export const RESERVED_KEY_PREFIX = "$"
|
||||
|
||||
function assertNoReservedKeys(data: PlainObject, file: string) {
|
||||
const visit = (value: unknown, at: string[]) => {
|
||||
if (Array.isArray(value)) {
|
||||
value.forEach((item, i) => visit(item, [...at, String(i)]))
|
||||
return
|
||||
}
|
||||
if (!isPlainObject(value)) return
|
||||
for (const [key, child] of Object.entries(value)) {
|
||||
if (key.startsWith(RESERVED_KEY_PREFIX) && !(at.length === 0 && key === "$schema")) {
|
||||
throw new ConfigExtendsError(
|
||||
`${file}: "${[...at, key].join(".")}" — keys starting with "${RESERVED_KEY_PREFIX}" are reserved in configs that use "extends"`,
|
||||
)
|
||||
}
|
||||
visit(child, [...at, key])
|
||||
}
|
||||
}
|
||||
visit(data, [])
|
||||
}
|
||||
|
||||
interface ConfigLayer {
|
||||
/** Resolved path or URL ("" for the config being resolved). */
|
||||
file: string
|
||||
@@ -443,6 +469,7 @@ async function extendsLayers(
|
||||
await visit(parsed, targetFile, here)
|
||||
}
|
||||
const { extends: _drop, ...own } = node
|
||||
assertNoReservedKeys(own, nodeFile)
|
||||
layers.push({ file: chain.length === 0 ? "" : self, data: own })
|
||||
applied.add(self)
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
"description": "JSON Schema reference"
|
||||
},
|
||||
"extends": {
|
||||
"description": "Start from another config and apply this file on top: \"default\" (quartz.config.default.yaml) or a path relative to this file, or a list of them (later ones win). Objects merge key by key, other values replace, null removes a key; plugin entries match the base entry of the same plugin by name. Without extends, this file is the whole configuration.",
|
||||
"description": "Start from another config and apply this file on top: \"default\" (quartz.config.default.yaml), a path relative to this file, an https:// URL (experimental), or a list of them (later ones win). Objects merge key by key, other values replace, null removes a key; plugin entries match the base entry of the same plugin by name. Keys starting with $ are reserved (except $schema). Without extends, this file is the whole configuration.",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string"
|
||||
|
||||
Reference in new issue
Block a user