mirror of
https://github.com/jackyzha0/quartz
synced 2026-11-30 22:44:41 +01:00
Compare commits
66
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2386362d57 | ||
|
|
d533468802 | ||
|
|
048519774a | ||
|
|
ee1cdffd0d | ||
|
|
08fddad0e8 | ||
|
|
506a7caa8c | ||
|
|
678398d235 | ||
|
|
6f82d03fd4 | ||
|
|
95e96b4871 | ||
|
|
23b70cdba0 | ||
|
|
829bec461f | ||
|
|
c392e177a7 | ||
|
|
3f8104fb50 | ||
|
|
7531e678f5 | ||
|
|
568004496b | ||
|
|
d80bb003f1 | ||
|
|
6f79e008e2 | ||
|
|
166d09b876 | ||
|
|
3960252445 | ||
|
|
436cce7610 | ||
|
|
4ed26b3943 | ||
|
|
8f469ed237 | ||
|
|
cdc5a0297f | ||
|
|
1dfe7fcdb0 | ||
|
|
7453f7f0d0 | ||
|
|
9c46b01c57 | ||
|
|
842a293ab1 | ||
|
|
6f872d4302 | ||
|
|
8578f2fdb2 | ||
|
|
5b863b0752 | ||
|
|
d092a3179b | ||
|
|
dacfeba928 | ||
|
|
5fafbf37b7 | ||
|
|
2e4ef40bc0 | ||
|
|
99685cf741 | ||
|
|
b58a7f20fe | ||
|
|
49d05638f2 | ||
|
|
d7d6c7b17f | ||
|
|
db2ce262b7 | ||
|
|
29a5bdf4b9 | ||
|
|
97059690a0 | ||
|
|
e2e248b9b8 | ||
|
|
9a04652b4f | ||
|
|
b19cdb8a09 | ||
|
|
ed4f6537e0 | ||
|
|
64dde0cb9c | ||
|
|
d8e2c7fb43 | ||
|
|
61329d2f74 | ||
|
|
ffc6e36ee9 | ||
|
|
46312a6197 | ||
|
|
607ccb8561 | ||
|
|
2fda5546dc | ||
|
|
006b75e4b0 | ||
|
|
e342ec5943 | ||
|
|
6a9d08ae1a | ||
|
|
f690faad9e | ||
|
|
546703340e | ||
|
|
7cfb079616 | ||
|
|
bdc1c71f65 | ||
|
|
beeeed45b8 | ||
|
|
0ab525ce4d | ||
|
|
2ec28ddd04 | ||
|
|
da4fb9bb7b | ||
|
|
b84c323224 | ||
|
|
ba5a9a6ce0 | ||
|
|
08e9470577 |
No files matched your search
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": minor
|
||||
---
|
||||
|
||||
A page type's `generate` can be async: it may return a promise of its virtual pages, which Quartz awaits in full and incremental builds. Page types that create pages from other files (like `.mdx`) can now run content through the site's transformers or bundle with esbuild; previously a promise crashed the build with "virtualPages is not iterable" (#2575).
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": minor
|
||||
---
|
||||
|
||||
Clearer failures: errors thrown by a plugin now name the plugin (package, version, source), what it was doing (transforming, filtering, emitting, rendering a component) and the file or page, list problems Quartz already knew about that plugin (incompatible Quartz version, missing required data), and say how to check and where to report it. Plugin stack frames are no longer hidden. Warnings from loading the config are repeated in a summary at the end of the build, together with a note about links to pages that are not on the site (including links to drafts).
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": minor
|
||||
---
|
||||
|
||||
Frontmatter parsing, link resolution, draft handling and the content index are now built into Quartz (configured under `configuration.frontmatter`, `.links`, `.drafts` and `.contentIndex`) instead of being plugins that silently broke the site when disabled. Existing `crawl-links`, `remove-draft` and `content-index` entries keep working and are applied automatically; `npx quartz plugin doctor --fix` moves them into `configuration`. Plugins can add fields to `contentIndex.json` with an `extendContentIndex` hook, and emitters can reuse the built index via `ctx.contentIndex`. The effective built-in settings are available to plugins as `ctx.cfg.configuration.<key>`.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
A plugin that lists a plugin now built into Quartz in `quartz.dependencies` (`@quartz-community/crawl-links`, `remove-draft` or `content-index`) no longer fails the build with "requires crawl-links. Run: npx quartz plugin add …". The built-in (`configuration.links`, `drafts`, `contentIndex`) satisfies the dependency. A warning is shown when that built-in is disabled. `npx quartz plugin doctor` checks the same way.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
More build errors caused by content are reported as content problems ("fix the file and build again") instead of "This is likely a Quartz bug": frontmatter that holds a single value or a list instead of properties, Markdown files and assets Quartz can't read (permission denied, a directory named like a note). Plugins can do the same by throwing an `Error` with `quartzContent = true` (see "Reporting problems in content" in Making plugins).
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
Plugins can declare `window.quartzStaticUrl` and `window.quartzPrefetch` in `capabilities.requires.globals` without a false "nothing provides it" warning: Quartz counts both as its own (`quartzPrefetch` unless `prefetch` is off).
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
A plugin whose dependency is configured but disabled gets the intended warning ("depends on X which is disabled") instead of failing the build with "requires X. Run: npx quartz plugin add X".
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
When a build stops on an error, Quartz stops esbuild before exiting. esbuild runs as a child process that writes to the same terminal; left running, it could print "fatal error: all goroutines are asleep - deadlock!" and a long goroutine dump after Quartz's error message.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
The folder hierarchy used by folder pages and breadcrumbs now includes the pages of page types that render files (`.base`, `.canvas`, …): folder pages list them, and a folder that holds only such pages has its own node (#2576). Documented that while a page type's `generate` runs, `ctx.virtualPages` holds the virtual pages of the page types before it.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
French: "Vue graphique" and "Table des matières" use French capitalisation (jackyzha0/quartz#2513).
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
Embedding a section by the anchor Obsidian writes for its heading works when that anchor differs from the heading's id: `![[note#Colon unspaced]]` now embeds `## Colon:unspaced`. It needs GitHubFlavoredMarkdown 2.1.0 or later, which marks those anchors on the heading.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
Layout fixes: the `has-backlinks` condition works, `byPageType.exclude` matches npm plugin sources, layout overrides in `quartz.ts` are applied, `position: footer` is accepted by the config schema, and typos in positions, display values, frames or page types produce a "did you mean" warning instead of silently dropping the component. `quartz build --verbose` prints a layout report.
|
||||
@@ -1,10 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
Links as in Obsidian 1.15.0:
|
||||
|
||||
- A Markdown link whose path is not valid percent-encoding (`[x](%zz)`, `[x](a%E2.md)`) is an external link. Before, it failed the whole build with `URI malformed`.
|
||||
- Link paths are NFC-normalized, so a link spelled with a decomposed `é` reaches `café.md`.
|
||||
- An image of a file the site doesn't have, with no alt text, gets its percent-decoded path as alt (`` → “missing pic.png”), as Obsidian names a missing embed.
|
||||
- A wikilink's `^id` no longer names its paragraph (Obsidian Flavored Markdown).
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
Security updates: `sharp` 0.35.5 (GHSA-wq5f-xc86-pv6w), `toml` 5 (prototype pollution and DoS advisories; TOML frontmatter parses the same, and now also accepts plain dates like `date = 2024-01-02`) and `minimatch` 11 (GHSA-g3hv-75wg-m249; `ignorePatterns` match the same). The plugin schema's `layout.position` lists exactly the positions Quartz renders. `npx quartz tui` points to the right install command (`github:quartz-community/tui`).
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
Pages no longer scroll sideways on phones: long words (a page title such as "ObsidianFlavoredMarkdown", long inline code) break where they don't fit, and the right sidebar's components (graph, backlinks) wrap below each other when they don't fit side by side.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
Security: frontmatter can no longer run code during a build. A note starting with `---js` or `---javascript` had its frontmatter evaluated as JavaScript (gray-matter's default engine), so building content you didn't write, such as a pull request preview, could run arbitrary code. Quartz now refuses JavaScript frontmatter with an error naming the file. Invalid frontmatter (for example broken YAML) is now reported as a problem in that file instead of as a Quartz bug.
|
||||
@@ -1,12 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": minor
|
||||
---
|
||||
|
||||
Markdown renders as it does in Obsidian: Quartz now uses ObsidianFlavoredMarkdown 2.0 and GitHubFlavoredMarkdown 2.0.
|
||||
|
||||
- **Line breaks changed:** a single line break inside a paragraph now renders as `<br>`, as in Obsidian's default reading view. Set `strictLineBreaks: true` in the ObsidianFlavoredMarkdown options to keep the previous behaviour (a space).
|
||||
- ObsidianFlavoredMarkdown parses with Obsidian's own parser by default (`preset: "legacy"`). Use `preset: "strict"` for TOML (`+++`) frontmatter or plugins that add their own Markdown syntax.
|
||||
- Also new: callouts parsed like Obsidian, inline footnotes (`text^[note]`), image sizes on Markdown images (``), Mermaid diagrams that follow the theme's colours, an opt-in Pele diagram renderer, and inline tags that only link to tag pages that exist.
|
||||
- GitHubFlavoredMarkdown now runs before ObsidianFlavoredMarkdown (order 30, then 40), as in the default config. If your config sets `order` for either plugin, keep GitHubFlavoredMarkdown first.
|
||||
|
||||
See the plugins' changelogs for details.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
Plugin option checks use the option schemas first-party plugins ship. These are declared as `quartz.optionSchema`, the name Quartz Syncer reads, as a flat map of option to type (`{ limit: { type: "number" }, mode: { type: "enum", values: [...] } }`). Before, only a JSON Schema in `quartz.configSchema` was read, so no first-party plugin's schema was used. A misspelled option, an enum value that isn't allowed, or a value of the wrong type is now a warning. A value of the same type as the plugin's default is always accepted, even where a schema disagrees.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": minor
|
||||
---
|
||||
|
||||
Permalinks work as in Obsidian Publish (jackyzha0/quartz#2572): `permalink: page` makes the note's address `/page`, whatever its file path. Links to the note, backlinks, the graph, the sitemap, RSS and the content index use the permalink, links inside the note still resolve relative to its file, and the note's file path redirects to the permalink (with AliasRedirects, like `aliases`). Previously the permalink was only a redirect to the file path. A permalink that is already another page's address is ignored with a warning. In navigation (the content trie used by the explorer, folder pages and breadcrumbs) the note stays in its folder, as on Obsidian Publish sites.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": minor
|
||||
---
|
||||
|
||||
Plugins can ship files with the site: `externalResources()` may return `assets: [{ from, to }]` (a file or directory on disk), which Quartz copies to `static/plugins/<to>`. Client scripts find them through the new `window.quartzStaticUrl` page global (absolute URL of `static/`, valid across SPA navigations). Use it for large or optional client code loaded with `import()` only where needed, instead of inline scripts, which every page downloads. Invalid or conflicting targets and missing sources are build warnings.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": minor
|
||||
---
|
||||
|
||||
Plugins can declare what they provide and need (`quartz.capabilities`); the build warns when a required provider is missing (e.g. "backlinks requires data `links` … enable configuration.links"). Rendered plugin components carry `data-quartz-plugin` / `data-quartz-component` attributes, so you can tell which plugin rendered which part of a page. `fetchData` resolves to `{}` instead of rejecting when `contentIndex.json` is missing.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": minor
|
||||
---
|
||||
|
||||
Plugin management: plugin commands exit non-zero on failure, CLI edits keep comments in `quartz.config.yaml`, lockfile pins are honoured everywhere, npm plugins show up in `plugin list`, `plugin add` detects duplicates, misspelled plugin options are flagged, and the new `plugin doctor` checks config, lockfile and installs. `plugin config --set a.b=1` now writes a nested key.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": minor
|
||||
---
|
||||
|
||||
Plugins can be marked deprecated with `quartz.deprecated` (a message naming the replacement) in their `package.json`. Quartz warns while a deprecated plugin is enabled — when the build loads the config (repeated in the end-of-build summary), in `plugin add` and in `plugin doctor` — and suggests removing it. The deprecated `hard-line-breaks` plugin is no longer listed in the default config and templates: ObsidianFlavoredMarkdown 2.0+ handles line breaks (`strictLineBreaks`).
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
Tag pages honour the TagPage `numPages` and `sort` options (tag-page 1.0.4); before, they always used the defaults. Plugin client scripts can use `window.quartzStaticUrl` and `window.quartzPrefetch` with the declarations in `@quartz-community/types` 1.3.1.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
On Windows, regenerating `.quartz/plugins/index.ts` (`npm run install-plugins`, which also runs before every `npm run build`) no longer skips npm plugins with "dist/index.d.ts could not be found", which left exports such as `ExternalPlugin.Explorer` undefined. The package's location was read from a `file:` URL's pathname (`/C:/…`), which is not a Windows path.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": minor
|
||||
---
|
||||
|
||||
Plugins that fail to load (can't be installed, throw on import, export no plugin) are reported as errors with the plugin, version, the file and line where it failed and what to do, and listed again at the top of the end-of-build summary. Previously some of these failures were silent. Locally the build continues without them; in CI (`CI` set) it fails unless `QUARTZ_ALLOW_BROKEN_PLUGINS=1`. Fixed along the way: the entry module of npm-installed component plugins (and npm plugins without a declared category) was never imported, so their `init(options)` never ran.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
`quartz.ts` overrides (`ExternalPlugin.Explorer({...})`) work for npm plugins and for component plugins (#2565): overrides are registered under the key the loader looks up (the package name for npm plugins), and component constructors re-exported from a plugin's sub-module are wrapped too. The wrapper also returns what the plugin returns, so `ExternalPlugin.X(...)` works both as a statement and as a component in a layout override. `quartz plugin …` commands no longer drop npm plugins from the generated `.quartz/plugins/index.ts`; both generators are now one shared module.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
Plugin fixes for Windows: relative aliases (`./old`, `../x`) redirect to the right page (alias-redirects 1.0.3), and git dates of notes in folders are read from git instead of the filesystem (created-modified-date 1.0.3).
|
||||
@@ -1,12 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": minor
|
||||
---
|
||||
|
||||
Updated default plugins (see each plugin's changelog for details):
|
||||
|
||||
- **Changed heading ids:** with SmartyPants on (the default), a heading containing `--` now gets the same id as on GitHub: `## Range 1--2` → `range-1--2` (was `range-12`). Links that hard-code the old id need updating; `[[page#Range 1--2]]` keeps working. Links Obsidian writes to headings containing `:`, `|`, `^`, `#` or `\` now reach them, and heading ids, links and table-of-contents entries share one slug function (GitHubFlavoredMarkdown 2.1.0, TableOfContents, CrawlLinks, utils 1.1).
|
||||
- **Bases now behave as in Obsidian 1.15** (BasesPage 1.2.0, checked against real Obsidian): subtracting dates gives a duration (`(due - today()).days`); nested tags match (`file.tags.contains("#project")` finds `#project/x`); dates display in the site's locale, and `date()` reads only ISO-style dates; cards use Obsidian's aspect ratio and layout; `link()` with any URL is an external link; a base opens on its first view; tags link to their tag pages; `this.<property>` in an embedded base reads the embedding note. Base views also list canvas and Excalidraw files with their real paths, `this` in an embedded base is that note, and Quartz's generated pages (404, tags, folder listings) no longer appear as notes. **Changed:** `file.tags` keeps `#` and the original case, the `tags` property no longer includes inline tags, `hasTag(a, b)` matches any of its tags, the root folder is `/`, text `contains` ignores case, and the cards' `imageAspectRatio` is height/width (it was inverted). `file.name` is as in Obsidian: a Markdown note's name has no extension (`Note`), other files keep theirs (`Plan.canvas`); `file.fullname` has the extension for every file.
|
||||
- Folder pages list folders that hold only canvas, base or other generated pages (FolderPage).
|
||||
- A footnote referenced only from a table cell past the table's columns is rendered, as in Obsidian (ObsidianFlavoredMarkdown 2.1.1, with remark-obsidian 2.2.0: faster parsing and fixes for deeply nested notes and `\r\n` line endings).
|
||||
- A short wikilink to an Obsidian folder note (`[[Topic]]` for `Topic/Topic.md`) reaches the folder page (utils 1.1).
|
||||
- NoteProperties no longer bundles gray-matter's `eval`-based JavaScript frontmatter engine.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": minor
|
||||
---
|
||||
|
||||
Plugin version requirements are enforced: a plugin's `quartzVersion` (`package.json` → `quartz.quartzVersion`, any semver range) is checked when the config loads (a warning locally; in CI — `CI` set — the build fails unless `QUARTZ_ALLOW_INCOMPATIBLE_PLUGINS=1`), by `plugin add` and by `plugin doctor`, with a message saying whether to update Quartz or the plugin. Previously the field was never checked (and the old checker read `">=5.0.0"` as `0.0.0`).
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
Plugins use Quartz's own Preact instead of each bundling a copy, so components can use hooks and context across plugins (a component using `preact/hooks` with another plugin's components crashed), and plugin bundles are smaller. The default plugins and the plugin template are updated; a third-party plugin made from the template before this release still bundles its own copy until it updates its `tsup.config.ts` (see quartz-community/plugin-template).
|
||||
@@ -1,11 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": minor
|
||||
---
|
||||
|
||||
Prefetching: Quartz fetches pages before their links are followed, so they open at once. New `configuration.prefetch`:
|
||||
|
||||
- `viewport` (default): links on screen are fetched while the browser is idle, and links pointed at, focused or touched first.
|
||||
- `hover`: only links pointed at, focused or touched.
|
||||
- `"off"`.
|
||||
|
||||
It works with and without SPA routing. With SPA routing, fetched pages are kept in memory (five minutes, at most 40) and used by both page navigation and popover previews, which no longer download a page the router fetches again. Without it, Quartz asks the browser to prefetch (Speculation Rules, or `<link rel="prefetch">`). Nothing is prefetched from links to other sites, files, or pages the site doesn't have, or with Data Saver on or a 2G connection (except links pointed at). Add `data-no-prefetch` to a link to exclude it. See https://quartz.jzhao.xyz/features/prefetching
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": minor
|
||||
---
|
||||
|
||||
New `configuration.publishAssets: "referenced"` (default `"all"`): only copy the images, PDFs and other files that published pages link to or embed, so files that only unpublished notes use stay private (#2531, from #2544). References are matched against published (slugified) file names and include `<object data>` SVG embeds, `srcset` and URL-encoded paths.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": minor
|
||||
---
|
||||
|
||||
New `npx quartz info` command: prints the Quartz version (with `git describe`, branch and local changes), Node/npm/OS, the config file, built-ins and every plugin with its version, source and compatibility, as a Markdown block to paste into bug reports. The build banner and `plugin doctor` also show where the checkout is relative to the last release.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
The Roam Research plugin works with ObsidianFlavoredMarkdown on, as in the default config (roam 1.1.0). `{{[[TODO]]}}`, `{{[[DONE]]}}`, `[[>]]` and `{{[[video]]: …}}` no longer render as wikilinks, and `__italic__` is italic instead of bold.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
Security: plugin commands no longer build shell commands from plugin sources, refs, pinned commits or package names (#2571). git and npm run with argument arrays, refs/commits/URLs/package names are validated (so a value can't be read as an option either), and generated plugin imports are written as escaped string literals. A source such as `github:owner/repo#main;cmd` used to run `cmd`; it is now rejected as an invalid ref. Also fixes restoring a plugin pinned in `quartz.lock.json` to a commit that is no longer its branch tip (#2559).
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": minor
|
||||
---
|
||||
|
||||
New `layout.sidebars` option: how each sidebar handles content taller than the screen. `fit` (default, unchanged) keeps it one screen tall and components shrink and scroll themselves; `scroll` keeps it in view and lets it scroll itself, so nothing is ever out of reach; `static` lets it scroll away with the page. Page types can override it (`byPageType.<type>.sidebars`). New `docs` template for documentation sites (`npx quartz create --template docs`), with both sidebars `static`. Frames receive the modes as a `sidebars` prop and put them on sidebar elements as `data-sidebar-mode`, which plugins can target in CSS.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
SPA navigation follows redirects correctly: when a link is redirected (for example `folder` → `folder/` on static hosts, or an alias page's canonical link), relative links on the new page resolve against where it really is, and the address bar shows that URL. Links on folder pages and parent tag pages reached through slash-less links pointed one level too high.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
Sites created with `npx quartz create` from a template (default, blog, docs, obsidian, ttrpg) run GitHubFlavoredMarkdown before ObsidianFlavoredMarkdown (orders 30 and 40), as the default config does and 5.1 requires. The templates still had the old orders (40 and 30). The obsidian and ttrpg templates no longer set `parseArrows`, which ObsidianFlavoredMarkdown doesn't have.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": minor
|
||||
---
|
||||
|
||||
`npx quartz upgrade` shows the release notes of every version between the old and the new Quartz, then runs the new version's checks: it restores plugins, runs `plugin doctor` (plugin entries that are built in now, plugins that don't support the new version …) and lists plugin updates. Plugin install/restore skip plugins that are built into Quartz now, and `plugin doctor --fix` also removes their unused lockfile pins.
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": minor
|
||||
---
|
||||
|
||||
Pages that page types render from files (`.base`, `.canvas`, Excalidraw drawings) follow the site's publish filters (quartz-community/bases-page#11). The filters see each such page with the frontmatter its page type gives it and `file.data.referencedBy`, the published pages that link to it; a page a filter rejects is not emitted and not listed in the content index, sitemap, RSS, folder pages, explorer or search, and can't be embedded. Before, every such file was published regardless of the filters. New transformer hook `virtualPageHtmlPlugins(ctx, content)`: rehype plugins run on these pages' rendered bodies, which never pass through `htmlPlugins`, so plugins such as encrypted-pages can encrypt them.
|
||||
@@ -1,7 +0,0 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
A local plugin source written with Windows separators (`.\my-plugin`, `..\plugins\my-plugin`) is recognised as a local path. Before, it was read as a git or npm source and failed with "Expected github:owner/repo".
|
||||
|
||||
Pretty links shorten link text the same way on every OS: Windows also cut it at a backslash (`[[a\b]]` showed `b`).
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
# @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
|
||||
|
||||
- eab5c53: A page type's `generate` can be async: it may return a promise of its virtual pages, which Quartz awaits in full and incremental builds. Page types that create pages from other files (like `.mdx`) can now run content through the site's transformers or bundle with esbuild; previously a promise crashed the build with "virtualPages is not iterable" (#2575).
|
||||
- f768b1e: Clearer failures: errors thrown by a plugin now name the plugin (package, version, source), what it was doing (transforming, filtering, emitting, rendering a component) and the file or page, list problems Quartz already knew about that plugin (incompatible Quartz version, missing required data), and say how to check and where to report it. Plugin stack frames are no longer hidden. Warnings from loading the config are repeated in a summary at the end of the build, together with a note about links to pages that are not on the site (including links to drafts).
|
||||
- f768b1e: Frontmatter parsing, link resolution, draft handling and the content index are now built into Quartz (configured under `configuration.frontmatter`, `.links`, `.drafts` and `.contentIndex`) instead of being plugins that silently broke the site when disabled. Existing `crawl-links`, `remove-draft` and `content-index` entries keep working and are applied automatically; `npx quartz plugin doctor --fix` moves them into `configuration`. Plugins can add fields to `contentIndex.json` with an `extendContentIndex` hook, and emitters can reuse the built index via `ctx.contentIndex`. The effective built-in settings are available to plugins as `ctx.cfg.configuration.<key>`.
|
||||
- e4ebd28: Markdown renders as it does in Obsidian: Quartz now uses ObsidianFlavoredMarkdown 2.0 and GitHubFlavoredMarkdown 2.0.
|
||||
|
||||
- **Line breaks changed:** a single line break inside a paragraph now renders as `<br>`, as in Obsidian's default reading view. Set `strictLineBreaks: true` in the ObsidianFlavoredMarkdown options to keep the previous behaviour (a space).
|
||||
- ObsidianFlavoredMarkdown parses with Obsidian's own parser by default (`preset: "legacy"`). Use `preset: "strict"` for TOML (`+++`) frontmatter or plugins that add their own Markdown syntax.
|
||||
- Also new: callouts parsed like Obsidian, inline footnotes (`text^[note]`), image sizes on Markdown images (``), Mermaid diagrams that follow the theme's colours, an opt-in Pele diagram renderer, and inline tags that only link to tag pages that exist.
|
||||
- GitHubFlavoredMarkdown now runs before ObsidianFlavoredMarkdown (order 30, then 40), as in the default config. If your config sets `order` for either plugin, keep GitHubFlavoredMarkdown first.
|
||||
|
||||
See the plugins' changelogs for details.
|
||||
|
||||
- 15b8eef: Permalinks work as in Obsidian Publish (jackyzha0/quartz#2572): `permalink: page` makes the note's address `/page`, whatever its file path. Links to the note, backlinks, the graph, the sitemap, RSS and the content index use the permalink, links inside the note still resolve relative to its file, and the note's file path redirects to the permalink (with AliasRedirects, like `aliases`). Previously the permalink was only a redirect to the file path. A permalink that is already another page's address is ignored with a warning. In navigation (the content trie used by the explorer, folder pages and breadcrumbs) the note stays in its folder, as on Obsidian Publish sites.
|
||||
- c84f348: Plugins can ship files with the site: `externalResources()` may return `assets: [{ from, to }]` (a file or directory on disk), which Quartz copies to `static/plugins/<to>`. Client scripts find them through the new `window.quartzStaticUrl` page global (absolute URL of `static/`, valid across SPA navigations). Use it for large or optional client code loaded with `import()` only where needed, instead of inline scripts, which every page downloads. Invalid or conflicting targets and missing sources are build warnings.
|
||||
- f768b1e: Plugins can declare what they provide and need (`quartz.capabilities`); the build warns when a required provider is missing (e.g. "backlinks requires data `links` … enable configuration.links"). Rendered plugin components carry `data-quartz-plugin` / `data-quartz-component` attributes, so you can tell which plugin rendered which part of a page. `fetchData` resolves to `{}` instead of rejecting when `contentIndex.json` is missing.
|
||||
- f768b1e: Plugin management: plugin commands exit non-zero on failure, CLI edits keep comments in `quartz.config.yaml`, lockfile pins are honoured everywhere, npm plugins show up in `plugin list`, `plugin add` detects duplicates, misspelled plugin options are flagged, and the new `plugin doctor` checks config, lockfile and installs. `plugin config --set a.b=1` now writes a nested key.
|
||||
- 3c18be8: Plugins can be marked deprecated with `quartz.deprecated` (a message naming the replacement) in their `package.json`. Quartz warns while a deprecated plugin is enabled — when the build loads the config (repeated in the end-of-build summary), in `plugin add` and in `plugin doctor` — and suggests removing it. The deprecated `hard-line-breaks` plugin is no longer listed in the default config and templates: ObsidianFlavoredMarkdown 2.0+ handles line breaks (`strictLineBreaks`).
|
||||
- 50203da: Plugins that fail to load (can't be installed, throw on import, export no plugin) are reported as errors with the plugin, version, the file and line where it failed and what to do, and listed again at the top of the end-of-build summary. Previously some of these failures were silent. Locally the build continues without them; in CI (`CI` set) it fails unless `QUARTZ_ALLOW_BROKEN_PLUGINS=1`. Fixed along the way: the entry module of npm-installed component plugins (and npm plugins without a declared category) was never imported, so their `init(options)` never ran.
|
||||
- 01bc5c5: Updated default plugins (see each plugin's changelog for details):
|
||||
|
||||
- **Changed heading ids:** with SmartyPants on (the default), a heading containing `--` now gets the same id as on GitHub: `## Range 1--2` → `range-1--2` (was `range-12`). Links that hard-code the old id need updating; `[[page#Range 1--2]]` keeps working. Links Obsidian writes to headings containing `:`, `|`, `^`, `#` or `\` now reach them, and heading ids, links and table-of-contents entries share one slug function (GitHubFlavoredMarkdown 2.1.0, TableOfContents, CrawlLinks, utils 1.1).
|
||||
- **Bases now behave as in Obsidian 1.15** (BasesPage 1.2.0, checked against real Obsidian): subtracting dates gives a duration (`(due - today()).days`); nested tags match (`file.tags.contains("#project")` finds `#project/x`); dates display in the site's locale, and `date()` reads only ISO-style dates; cards use Obsidian's aspect ratio and layout; `link()` with any URL is an external link; a base opens on its first view; tags link to their tag pages; `this.<property>` in an embedded base reads the embedding note. Base views also list canvas and Excalidraw files with their real paths, `this` in an embedded base is that note, and Quartz's generated pages (404, tags, folder listings) no longer appear as notes. **Changed:** `file.tags` keeps `#` and the original case, the `tags` property no longer includes inline tags, `hasTag(a, b)` matches any of its tags, the root folder is `/`, text `contains` ignores case, and the cards' `imageAspectRatio` is height/width (it was inverted). `file.name` is as in Obsidian: a Markdown note's name has no extension (`Note`), other files keep theirs (`Plan.canvas`); `file.fullname` has the extension for every file.
|
||||
- Folder pages list folders that hold only canvas, base or other generated pages (FolderPage).
|
||||
- A footnote referenced only from a table cell past the table's columns is rendered, as in Obsidian (ObsidianFlavoredMarkdown 2.1.1, with remark-obsidian 2.2.0: faster parsing and fixes for deeply nested notes and `\r\n` line endings).
|
||||
- A short wikilink to an Obsidian folder note (`[[Topic]]` for `Topic/Topic.md`) reaches the folder page (utils 1.1).
|
||||
- NoteProperties no longer bundles gray-matter's `eval`-based JavaScript frontmatter engine.
|
||||
|
||||
- f768b1e: Plugin version requirements are enforced: a plugin's `quartzVersion` (`package.json` → `quartz.quartzVersion`, any semver range) is checked when the config loads (a warning locally; in CI — `CI` set — the build fails unless `QUARTZ_ALLOW_INCOMPATIBLE_PLUGINS=1`), by `plugin add` and by `plugin doctor`, with a message saying whether to update Quartz or the plugin. Previously the field was never checked (and the old checker read `">=5.0.0"` as `0.0.0`).
|
||||
- 6210f28: Prefetching: Quartz fetches pages before their links are followed, so they open at once. New `configuration.prefetch`:
|
||||
|
||||
- `viewport` (default): links on screen are fetched while the browser is idle, and links pointed at, focused or touched first.
|
||||
- `hover`: only links pointed at, focused or touched.
|
||||
- `"off"`.
|
||||
|
||||
It works with and without SPA routing. With SPA routing, fetched pages are kept in memory (five minutes, at most 40) and used by both page navigation and popover previews, which no longer download a page the router fetches again. Without it, Quartz asks the browser to prefetch (Speculation Rules, or `<link rel="prefetch">`). Nothing is prefetched from links to other sites, files, or pages the site doesn't have, or with Data Saver on or a 2G connection (except links pointed at). Add `data-no-prefetch` to a link to exclude it. See https://quartz.jzhao.xyz/features/prefetching
|
||||
|
||||
- 3103485: New `configuration.publishAssets: "referenced"` (default `"all"`): only copy the images, PDFs and other files that published pages link to or embed, so files that only unpublished notes use stay private (#2531, from #2544). References are matched against published (slugified) file names and include `<object data>` SVG embeds, `srcset` and URL-encoded paths.
|
||||
- f768b1e: New `npx quartz info` command: prints the Quartz version (with `git describe`, branch and local changes), Node/npm/OS, the config file, built-ins and every plugin with its version, source and compatibility, as a Markdown block to paste into bug reports. The build banner and `plugin doctor` also show where the checkout is relative to the last release.
|
||||
- 08c2857: New `layout.sidebars` option: how each sidebar handles content taller than the screen. `fit` (default, unchanged) keeps it one screen tall and components shrink and scroll themselves; `scroll` keeps it in view and lets it scroll itself, so nothing is ever out of reach; `static` lets it scroll away with the page. Page types can override it (`byPageType.<type>.sidebars`). New `docs` template for documentation sites (`npx quartz create --template docs`), with both sidebars `static`. Frames receive the modes as a `sidebars` prop and put them on sidebar elements as `data-sidebar-mode`, which plugins can target in CSS.
|
||||
- d66968c: `npx quartz upgrade` shows the release notes of every version between the old and the new Quartz, then runs the new version's checks: it restores plugins, runs `plugin doctor` (plugin entries that are built in now, plugins that don't support the new version …) and lists plugin updates. Plugin install/restore skip plugins that are built into Quartz now, and `plugin doctor --fix` also removes their unused lockfile pins.
|
||||
- fe6a3ea: Pages that page types render from files (`.base`, `.canvas`, Excalidraw drawings) follow the site's publish filters (quartz-community/bases-page#11). The filters see each such page with the frontmatter its page type gives it and `file.data.referencedBy`, the published pages that link to it; a page a filter rejects is not emitted and not listed in the content index, sitemap, RSS, folder pages, explorer or search, and can't be embedded. Before, every such file was published regardless of the filters. New transformer hook `virtualPageHtmlPlugins(ctx, content)`: rehype plugins run on these pages' rendered bodies, which never pass through `htmlPlugins`, so plugins such as encrypted-pages can encrypt them.
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- ac8cc4b: A plugin that lists a plugin now built into Quartz in `quartz.dependencies` (`@quartz-community/crawl-links`, `remove-draft` or `content-index`) no longer fails the build with "requires crawl-links. Run: npx quartz plugin add …". The built-in (`configuration.links`, `drafts`, `contentIndex`) satisfies the dependency. A warning is shown when that built-in is disabled. `npx quartz plugin doctor` checks the same way.
|
||||
- f8b5638: More build errors caused by content are reported as content problems ("fix the file and build again") instead of "This is likely a Quartz bug": frontmatter that holds a single value or a list instead of properties, Markdown files and assets Quartz can't read (permission denied, a directory named like a note). Plugins can do the same by throwing an `Error` with `quartzContent = true` (see "Reporting problems in content" in Making plugins).
|
||||
- e8a192e: Plugins can declare `window.quartzStaticUrl` and `window.quartzPrefetch` in `capabilities.requires.globals` without a false "nothing provides it" warning: Quartz counts both as its own (`quartzPrefetch` unless `prefetch` is off).
|
||||
- 85d2b43: A plugin whose dependency is configured but disabled gets the intended warning ("depends on X which is disabled") instead of failing the build with "requires X. Run: npx quartz plugin add X".
|
||||
- 28fcb64: When a build stops on an error, Quartz stops esbuild before exiting. esbuild runs as a child process that writes to the same terminal; left running, it could print "fatal error: all goroutines are asleep - deadlock!" and a long goroutine dump after Quartz's error message.
|
||||
- 913f9f0: The folder hierarchy used by folder pages and breadcrumbs now includes the pages of page types that render files (`.base`, `.canvas`, …): folder pages list them, and a folder that holds only such pages has its own node (#2576). Documented that while a page type's `generate` runs, `ctx.virtualPages` holds the virtual pages of the page types before it.
|
||||
- 5507de3: French: "Vue graphique" and "Table des matières" use French capitalisation (jackyzha0/quartz#2513).
|
||||
- 2ef60c6: Embedding a section by the anchor Obsidian writes for its heading works when that anchor differs from the heading's id: `![[note#Colon unspaced]]` now embeds `## Colon:unspaced`. It needs GitHubFlavoredMarkdown 2.1.0 or later, which marks those anchors on the heading.
|
||||
- f768b1e: Layout fixes: the `has-backlinks` condition works, `byPageType.exclude` matches npm plugin sources, layout overrides in `quartz.ts` are applied, `position: footer` is accepted by the config schema, and typos in positions, display values, frames or page types produce a "did you mean" warning instead of silently dropping the component. `quartz build --verbose` prints a layout report.
|
||||
- fc86552: Links as in Obsidian 1.15.0:
|
||||
|
||||
- A Markdown link whose path is not valid percent-encoding (`[x](%zz)`, `[x](a%E2.md)`) is an external link. Before, it failed the whole build with `URI malformed`.
|
||||
- Link paths are NFC-normalized, so a link spelled with a decomposed `é` reaches `café.md`.
|
||||
- An image of a file the site doesn't have, with no alt text, gets its percent-decoded path as alt (`` → “missing pic.png”), as Obsidian names a missing embed.
|
||||
- A wikilink's `^id` no longer names its paragraph (Obsidian Flavored Markdown).
|
||||
|
||||
- 671ca49: Security updates: `sharp` 0.35.5 (GHSA-wq5f-xc86-pv6w), `toml` 5 (prototype pollution and DoS advisories; TOML frontmatter parses the same, and now also accepts plain dates like `date = 2024-01-02`) and `minimatch` 11 (GHSA-g3hv-75wg-m249; `ignorePatterns` match the same). The plugin schema's `layout.position` lists exactly the positions Quartz renders. `npx quartz tui` points to the right install command (`github:quartz-community/tui`).
|
||||
- b7998bb: Pages no longer scroll sideways on phones: long words (a page title such as "ObsidianFlavoredMarkdown", long inline code) break where they don't fit, and the right sidebar's components (graph, backlinks) wrap below each other when they don't fit side by side.
|
||||
- b2da325: Security: frontmatter can no longer run code during a build. A note starting with `---js` or `---javascript` had its frontmatter evaluated as JavaScript (gray-matter's default engine), so building content you didn't write, such as a pull request preview, could run arbitrary code. Quartz now refuses JavaScript frontmatter with an error naming the file. Invalid frontmatter (for example broken YAML) is now reported as a problem in that file instead of as a Quartz bug.
|
||||
- e41ebf6: Plugin option checks use the option schemas first-party plugins ship. These are declared as `quartz.optionSchema`, the name Quartz Syncer reads, as a flat map of option to type (`{ limit: { type: "number" }, mode: { type: "enum", values: [...] } }`). Before, only a JSON Schema in `quartz.configSchema` was read, so no first-party plugin's schema was used. A misspelled option, an enum value that isn't allowed, or a value of the wrong type is now a warning. A value of the same type as the plugin's default is always accepted, even where a schema disagrees.
|
||||
- edb64cd: Tag pages honour the TagPage `numPages` and `sort` options (tag-page 1.0.4); before, they always used the defaults. Plugin client scripts can use `window.quartzStaticUrl` and `window.quartzPrefetch` with the declarations in `@quartz-community/types` 1.3.1.
|
||||
- 28581e8: On Windows, regenerating `.quartz/plugins/index.ts` (`npm run install-plugins`, which also runs before every `npm run build`) no longer skips npm plugins with "dist/index.d.ts could not be found", which left exports such as `ExternalPlugin.Explorer` undefined. The package's location was read from a `file:` URL's pathname (`/C:/…`), which is not a Windows path.
|
||||
- ba5a9a6: Option checks know the FolderPage `prefixFolders`, TagPage `prefixTags` and Latex `customMacros` options (folder-page 1.0.4, tag-page 1.0.5, latex 1.0.2 declare them in their manifests).
|
||||
- e44f2b0: `quartz.ts` overrides (`ExternalPlugin.Explorer({...})`) work for npm plugins and for component plugins (#2565): overrides are registered under the key the loader looks up (the package name for npm plugins), and component constructors re-exported from a plugin's sub-module are wrapped too. The wrapper also returns what the plugin returns, so `ExternalPlugin.X(...)` works both as a statement and as a component in a layout override. `quartz plugin …` commands no longer drop npm plugins from the generated `.quartz/plugins/index.ts`; both generators are now one shared module.
|
||||
- 8854aeb: Plugin fixes for Windows: relative aliases (`./old`, `../x`) redirect to the right page (alias-redirects 1.0.3), and git dates of notes in folders are read from git instead of the filesystem (created-modified-date 1.0.3).
|
||||
- f687f58: Plugins use Quartz's own Preact instead of each bundling a copy, so components can use hooks and context across plugins (a component using `preact/hooks` with another plugin's components crashed), and plugin bundles are smaller. The default plugins and the plugin template are updated; a third-party plugin made from the template before this release still bundles its own copy until it updates its `tsup.config.ts` (see quartz-community/plugin-template).
|
||||
- 2a4ab67: The Roam Research plugin works with ObsidianFlavoredMarkdown on, as in the default config (roam 1.1.0). `{{[[TODO]]}}`, `{{[[DONE]]}}`, `[[>]]` and `{{[[video]]: …}}` no longer render as wikilinks, and `__italic__` is italic instead of bold.
|
||||
- 8eae6a1: Security: plugin commands no longer build shell commands from plugin sources, refs, pinned commits or package names (#2571). git and npm run with argument arrays, refs/commits/URLs/package names are validated (so a value can't be read as an option either), and generated plugin imports are written as escaped string literals. A source such as `github:owner/repo#main;cmd` used to run `cmd`; it is now rejected as an invalid ref. Also fixes restoring a plugin pinned in `quartz.lock.json` to a commit that is no longer its branch tip (#2559).
|
||||
- 3e4a50a: SPA navigation follows redirects correctly: when a link is redirected (for example `folder` → `folder/` on static hosts, or an alias page's canonical link), relative links on the new page resolve against where it really is, and the address bar shows that URL. Links on folder pages and parent tag pages reached through slash-less links pointed one level too high.
|
||||
- 7236249: Sites created with `npx quartz create` from a template (default, blog, docs, obsidian, ttrpg) run GitHubFlavoredMarkdown before ObsidianFlavoredMarkdown (orders 30 and 40), as the default config does and 5.1 requires. The templates still had the old orders (40 and 30). The obsidian and ttrpg templates no longer set `parseArrows`, which ObsidianFlavoredMarkdown doesn't have.
|
||||
- f5ef8f7: A local plugin source written with Windows separators (`.\my-plugin`, `..\plugins\my-plugin`) is recognised as a local path. Before, it was read as a git or npm source and failed with "Expected github:owner/repo".
|
||||
|
||||
Pretty links shorten link text the same way on every OS: Windows also cut it at a backslash (`[[a\b]]` showed `b`).
|
||||
@@ -41,7 +41,7 @@ This question is best answered by tracing what happens when a user (you!) runs `
|
||||
2. The `PageTypeDispatcher` emitter renders the HTML pages (`quartz/plugins/pageTypes/dispatcher.ts`):
|
||||
1. Each page type's `generate` runs, one after another in priority order, and returns virtual pages (folder and tag pages, `.base` and `.canvas` pages, …). They are collected in `ctx.virtualPages`. Pages that stand for a file (page types with `fileExtensions`) first go through the site's filters, with `file.data.referencedBy` set to the pages that link to them.
|
||||
2. The bodies of the virtual pages are rendered (so they can be embedded), and the transformers' `virtualPageHtmlPlugins` run on those of file-backed pages.
|
||||
3. Every content page is rendered by the first page type (highest priority) whose `match` accepts it, and every virtual page by the page type that generated it. Rendering transforms the [hast](https://github.com/syntax-tree/hast) produced in the parse step to JSX using [hast-util-to-jsx-runtime](https://github.com/syntax-tree/hast-util-to-jsx-runtime) with the [Preact](https://preactjs.com/) runtime, applies the page types' `treeTransforms`, assembles the page [[layout]] and [[layout#Page Frames|frame]], and renders the JSX to HTML using [preact-render-to-string](https://github.com/preactjs/preact-render-to-string) (statically: `useState`, `useEffect` and other interactive bits don't run). The bulk of this logic can be found in `quartz/components/renderPage.tsx`.
|
||||
3. Every content page is rendered by the first page type (highest priority) whose `match` accepts it, and every virtual page by the page type that generated it. Rendering transforms the [hast](https://github.com/syntax-tree/hast) produced in the parse step to JSX using [hast-util-to-jsx-runtime](https://github.com/syntax-tree/hast-util-to-jsx-runtime) with the [Preact](https://preactjs.com/) runtime, applies the transformers' `renderTransforms` (`before`), inlines transclusions, applies the page types' `treeTransforms` and the transformers' `renderTransforms` (`after`), assembles the page [[layout]] and [[layout#Page Frames|frame]], and renders the JSX to HTML using [preact-render-to-string](https://github.com/preactjs/preact-render-to-string) (statically: `useState`, `useEffect` and other interactive bits don't run). The bulk of this logic can be found in `quartz/components/renderPage.tsx`.
|
||||
3. The content index is built once from the published and virtual pages (`ctx.contentIndex`), then all other emitters run in parallel over the same content (virtual pages included). The built-in content index emitter writes `static/contentIndex.json`, the sitemap and the RSS feed; plugin emitters write their own files.
|
||||
7. If the `--serve` flag was detected, we also set up another file watcher to detect content changes (only `.md` files). We keep a content map that tracks the parsed AST and plugin data for each slug and update this on file changes. Newly added or modified paths are rebuilt and added to the content map. Then, all the filters and emitters are run over the resulting content map. This file watcher is debounced with a threshold of 250ms. On success, we send a client refresh signal using the passed in callback function.
|
||||
|
||||
|
||||
@@ -107,6 +107,7 @@ export type QuartzTransformerPluginInstance = {
|
||||
markdownPlugins?: (ctx: BuildCtx) => PluggableList
|
||||
htmlPlugins?: (ctx: BuildCtx) => PluggableList
|
||||
virtualPageHtmlPlugins?: (ctx: BuildCtx, content: ProcessedContent[]) => PluggableList
|
||||
renderTransforms?: (ctx: BuildCtx) => { before?: TreeTransform[]; after?: TreeTransform[] }
|
||||
externalResources?: (ctx: BuildCtx) => Partial<StaticResources> | undefined
|
||||
extendContentIndex?: ContentIndexExtension // any plugin type, see below
|
||||
}
|
||||
@@ -118,6 +119,7 @@ All transformer plugins must define at least a `name` field to register the plug
|
||||
- `markdownPlugins` defines a list of [remark plugins](https://github.com/remarkjs/remark/blob/main/doc/plugins.md). `remark` is a tool that transforms Markdown to Markdown in a structured way.
|
||||
- `htmlPlugins` defines a list of [rehype plugins](https://github.com/rehypejs/rehype/blob/main/doc/plugins.md). Similar to how `remark` works, `rehype` is a tool that transforms HTML to HTML in a structured way.
|
||||
- `virtualPageHtmlPlugins` (Quartz 5.1+) defines rehype plugins for the pages that page types render from files (`.base`, `.canvas`, Excalidraw drawings). Those pages are rendered when emitting and never pass through `htmlPlugins`, so a plugin that should also act on them (e.g. encryption) registers its rehype plugin here too. They run on the page's rendered body, with the page's vfile (`file.data.frontmatter`, `file.data.referencedBy`), after the filters published the page; the page then shows the resulting tree. `content` is the published content.
|
||||
- `renderTransforms` (Quartz 5.2+) defines transforms of a page's content tree when the page is rendered, when other pages' content and `allFiles` are available. Each is a function `(root, slug, componentData) => void` that changes `root`, a copy of the page's tree. `before` transforms run before transclusions are inlined and page types' `treeTransforms` run (bases are filled in, for example); `after` transforms run on the finished content. [encrypted-pages](https://github.com/quartz-community/encrypted-pages) uses both: `before` puts its page's content back, `after` encrypts the finished content, transclusions and bases included. Something that only needs the finished content, such as rewriting all links in it, needs only `after`.
|
||||
- `externalResources` defines any external resources the plugin may need to load on the client-side for it to work properly.
|
||||
|
||||
Transformers run in plugin order (see [[plugin manifest#defaultOrder]]); the built-in frontmatter parsing runs at order 0 and the built-in link processing, which sets `file.data.links`, at 60.
|
||||
|
||||
@@ -42,7 +42,7 @@ and says whether to update Quartz (`npx quartz upgrade`) or the plugin. If an in
|
||||
|
||||
### For plugin authors
|
||||
|
||||
- Set `quartzVersion` to the **oldest Quartz version your plugin works with**. Raise it when you start using a newer API — for example a plugin that relies on [[built-in processing]] (core-parsed frontmatter, `ctx.contentIndex`, `extendContentIndex`), an async page type `generate`, `virtualPageHtmlPlugins`, `assets` or `window.quartzStaticUrl` needs `">=5.1.0"`. The [plugin template](https://github.com/quartz-community/plugin-template) starts with `">=5.0.0"`.
|
||||
- Set `quartzVersion` to the **oldest Quartz version your plugin works with**. Raise it when you start using a newer API — for example a plugin that relies on [[built-in processing]] (core-parsed frontmatter, `ctx.contentIndex`, `extendContentIndex`), an async page type `generate`, `virtualPageHtmlPlugins`, `assets` or `window.quartzStaticUrl` needs `">=5.1.0"`; one that relies on `renderTransforms` needs `">=5.2.0"` (or treats the hook as optional, as Quartz 5.1 never calls it). The [plugin template](https://github.com/quartz-community/plugin-template) starts with `">=5.0.0"`.
|
||||
- Prefer a lower bound (`>=5.1.0`) over a caret range: minor Quartz releases don't break plugins, so `^5` would only add an upper bound you'd have to bump at every major release. Add an upper bound when you know a major version breaks you.
|
||||
- Raising `quartzVersion` is a breaking change for users on older Quartz versions: release it as a new major (or at least minor) version of your plugin and say so in its changelog.
|
||||
- Pre-releases count: Quartz `5.2.0-beta.1` satisfies `>=5.1.0`.
|
||||
|
||||
@@ -11,6 +11,7 @@ The `build` command transforms your Markdown content into a static HTML website.
|
||||
| Flag | Shorthand | Description | Default |
|
||||
| ----------------- | --------- | ---------------------------------------------------------------------------------- | ------------------ |
|
||||
| `--directory` | `-d` | The content folder | `content` |
|
||||
| `--config` | `-C` | Path to the config file to load (see [[#Custom config file]]) | quartz.config.yaml |
|
||||
| `--verbose` | `-v` | Print detailed build information (see [[#Verbose output]]) | `false` |
|
||||
| `--output` | `-o` | The directory where the built site will be saved | `public` |
|
||||
| `--serve` | | Start a local development server | `false` |
|
||||
@@ -56,6 +57,17 @@ If you have a very large vault, you can limit the number of concurrent workers t
|
||||
npx quartz build --concurrency 2
|
||||
```
|
||||
|
||||
### Custom config file
|
||||
|
||||
By default Quartz loads `quartz.config.yaml` from the current working directory. Use `--config` (or `-C`) to point at a config file elsewhere — for example when the config lives alongside your content rather than inside the Quartz install.
|
||||
|
||||
```shell
|
||||
npx quartz build --config ../my-vault/quartz.config.yaml
|
||||
```
|
||||
|
||||
> [!note]
|
||||
> The shorthand for `--config` is an uppercase `-C`. A lowercase `-c` is the shorthand for `--concurrency`, so the two are distinct.
|
||||
|
||||
### Verbose output
|
||||
|
||||
`npx quartz build --verbose` also prints:
|
||||
|
||||
@@ -68,7 +68,7 @@ This part of the configuration concerns anything that can affect the whole site.
|
||||
}
|
||||
```
|
||||
|
||||
Use a path relative to the site root like above (no leading `/`) so it also works when the site is served from a subpath. To have Quartz download Google Fonts at build time and serve them from your site instead, use the [[plugins/Fonts|Fonts]] plugin with `fontOrigin: selfHosted`.
|
||||
Use a path relative to the site root like above (no leading `/`) so it also works when the site is served from a subpath. To have Quartz download Google Fonts at build time and serve them from your site instead, set `configuration.fonts.fontOrigin: selfHosted` (see [[plugins/Fonts|Fonts]]).
|
||||
- `cdnCaching`: if `true` (default), use Google CDN to cache the fonts. This will generally be faster. Disable (`false`) this if you want Quartz to download the fonts to be self-contained.
|
||||
- `typography`: what fonts to use. Any font available on [Google Fonts](https://fonts.google.com/) works here.
|
||||
- `title`: font for the title of the site (optional, same as `header` by default)
|
||||
@@ -362,4 +362,4 @@ export const layout = await loadQuartzLayout()
|
||||
```
|
||||
|
||||
> [!tip]
|
||||
> For per-heading font control, self-hosted fonts, or Obsidian theme font bridging, see the [[plugins/Fonts|Fonts]] plugin. It can download Google Fonts at build time and serve them locally with `fontOrigin: selfHosted`, making your site fully self-contained.
|
||||
> For per-heading fonts and self-hosted fonts, see [[plugins/Fonts|Fonts]] (`configuration.fonts`). With `fontOrigin: selfHosted`, Quartz downloads Google Fonts at build time and serves them from your site, making it fully self-contained.
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Built-in processing
|
||||
description: Frontmatter parsing, link resolution, drafts and the content index are part of Quartz itself.
|
||||
description: Frontmatter parsing, link resolution, drafts, the content index and font loading are part of Quartz itself.
|
||||
tags:
|
||||
- feature
|
||||
---
|
||||
@@ -13,6 +13,7 @@ Some processing steps are needed by every Quartz site. They are built into Quart
|
||||
| [[CrawlLinks\|links]] | `configuration.links` | Makes internal links relative, classifies links, records outgoing links for backlinks and graph | `crawl-links` |
|
||||
| [[RemoveDrafts\|drafts]] | `configuration.drafts` | Does not publish pages with `draft: true` | `remove-draft` |
|
||||
| [[ContentIndex\|contentIndex]] | `configuration.contentIndex` | Emits `static/contentIndex.json` (search, explorer, graph, …), `sitemap.xml` and the RSS feed | `content-index` |
|
||||
| [[Fonts\|fonts]] | `configuration.fonts` | Loads fonts (Google Fonts, self-hosted or local), per-heading fonts, theme font handling | `quartz-fonts` |
|
||||
|
||||
Without them a site would silently break: pages titled "Untitled", links that 404 on nested pages, empty backlinks and graph, drafts published, no search.
|
||||
|
||||
@@ -42,6 +43,9 @@ configuration:
|
||||
rssFullHtml: false
|
||||
rssSlug: index
|
||||
includeEmptyFiles: true
|
||||
fonts:
|
||||
fontOrigin: googleFonts # googleFonts | selfHosted | local
|
||||
h1: Playfair Display # per-heading fonts; title/header/body/code override theme.typography
|
||||
```
|
||||
|
||||
Each built-in also accepts:
|
||||
@@ -49,17 +53,18 @@ Each built-in also accepts:
|
||||
- `enabled: false` (or the shorthand `links: false`) to turn it off;
|
||||
- `order` to change where it runs relative to plugins of the same kind (frontmatter runs at `0`, links at `60`, the same scale as plugin `order`).
|
||||
|
||||
See the individual pages for every option: [[Frontmatter]], [[CrawlLinks]], [[RemoveDrafts]], [[ContentIndex]].
|
||||
See the individual pages for every option: [[Frontmatter]], [[CrawlLinks]], [[RemoveDrafts]], [[ContentIndex]], [[Fonts]].
|
||||
|
||||
## Replacing a built-in
|
||||
|
||||
A plugin can take over a built-in by declaring that it provides the same thing in its [[plugin capabilities|capabilities]] (`package.json` → `quartz.capabilities.provides`):
|
||||
|
||||
| Built-in | Replaced by a plugin that provides |
|
||||
| ------------ | ------------------------------------- |
|
||||
| frontmatter | `data: ["frontmatter"]` |
|
||||
| links | `data: ["links"]` |
|
||||
| contentIndex | `files: ["static/contentIndex.json"]` |
|
||||
| Built-in | Replaced by a plugin that provides |
|
||||
| ------------ | ------------------------------------------ |
|
||||
| frontmatter | `data: ["frontmatter"]` |
|
||||
| links | `data: ["links"]` |
|
||||
| contentIndex | `files: ["static/contentIndex.json"]` |
|
||||
| fonts | `files: ["static/fonts/quartz-fonts.css"]` |
|
||||
|
||||
When such a plugin is enabled, the built-in steps aside (`quartz build --verbose` shows `off — replaced by plugin "…"`). Set `enabled: true` on the built-in to run both.
|
||||
|
||||
@@ -67,7 +72,7 @@ Drafts can't be replaced: a filter plugin runs in addition to the built-in.
|
||||
|
||||
## Upgrading from the plugins
|
||||
|
||||
Existing `quartz.config.yaml` files keep working: entries for `@quartz-community/crawl-links`, `@quartz-community/remove-draft` and `@quartz-community/content-index` are applied to the matching built-in (options, `order` and `enabled: false` carry over) and the packages are no longer loaded. The build prints a notice for each.
|
||||
Existing `quartz.config.yaml` files keep working: entries for `@quartz-community/crawl-links`, `@quartz-community/remove-draft`, `@quartz-community/content-index` and (since 5.2) `@quartz-community/quartz-fonts` are applied to the matching built-in (options, `order` and `enabled: false` carry over) and the packages are no longer loaded. The build prints a notice for each.
|
||||
|
||||
To update the file, run:
|
||||
|
||||
@@ -85,6 +90,6 @@ The [[Frontmatter#Properties panel|properties panel]] is still a plugin (`note-p
|
||||
## For plugin authors
|
||||
|
||||
- The data the built-ins produce is unchanged: `file.data.frontmatter`, `aliases`, `frontmatterLinks`, `links`, and the same `contentIndex.json` format. Plugins that read them need no changes.
|
||||
- Built-ins count as providers for [[plugin capabilities]], so a requirement such as `requires: { data: ["links"] }` is satisfied without any plugin. Built-in links also provides the classes it puts on links: `.internal`, `.external` and `.broken` (`dom` capabilities). In `from`, name the built-ins `quartz:frontmatter`, `quartz:links`, `quartz:drafts` and `quartz:contentIndex`.
|
||||
- Built-ins count as providers for [[plugin capabilities]], so a requirement such as `requires: { data: ["links"] }` is satisfied without any plugin. Built-in links also provides the classes it puts on links: `.internal`, `.external` and `.broken` (`dom` capabilities). In `from`, name the built-ins `quartz:frontmatter`, `quartz:links`, `quartz:drafts`, `quartz:contentIndex` and `quartz:fonts`.
|
||||
- Don't list `@quartz-community/crawl-links`, `remove-draft` or `content-index` in your manifest's [[plugin manifest#dependencies|`dependencies`]]: Quartz 5.1 treats them as satisfied by the built-ins, but Quartz 5.0 fails the build when the plugin isn't in the config. To run after built-in links, set a `defaultOrder` above 60 (a transformer with a lower order that depends on `crawl-links` fails the build).
|
||||
- Plugins can add their own fields to `contentIndex.json` — see [[making plugins#Extending the content index]].
|
||||
+27
-209
@@ -1,227 +1,45 @@
|
||||
---
|
||||
title: Fonts
|
||||
description: Fine-grained font control with per-heading support, Google Fonts integration, and theme font discovery.
|
||||
description: Built-in font loading — Google Fonts, self-hosted or local — with per-heading fonts.
|
||||
tags:
|
||||
- plugin/transformer
|
||||
- plugin/emitter
|
||||
image:
|
||||
repository: "[quartz-community/fonts](https://github.com/quartz-community/fonts)"
|
||||
enabled: true
|
||||
required: false
|
||||
- feature
|
||||
- built-in
|
||||
---
|
||||
|
||||
This plugin provides fine-grained control over fonts in your Quartz site. It supports per-heading font families, automatic theme font discovery when used with [[ThemesCore|Quartz Themes]], Google Fonts integration with automatic weight and italic loading, and otherwise falls back to the fonts set in `configuration.theme.typography`.
|
||||
|
||||
> [!note]
|
||||
> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page.
|
||||
|
||||
## Why use Fonts?
|
||||
|
||||
Quartz uses three CSS variables for fonts: `--headerFont`, `--bodyFont`, and `--codeFont`. Obsidian themes use a different system with per-heading variables (`--h1-font` through `--h6-font`), `--font-text`, and `--font-monospace`. These two systems don't bridge correctly, causing heading fonts to not render as themes intend.
|
||||
|
||||
Fonts solves this by:
|
||||
|
||||
1. Bridging the Obsidian and Quartz font systems
|
||||
2. Emitting **unlayered** CSS that correctly overrides Quartz's base heading styles
|
||||
3. Providing per-heading font control that neither system offers alone
|
||||
4. Optionally loading fonts from Google Fonts with fine-grained weight and italic control
|
||||
Font loading is [[built-in processing|built into Quartz]] (since 5.2; formerly the `@quartz-community/quartz-fonts` plugin). It loads the fonts set in `configuration.theme.typography`, and adds per-heading fonts, an interface font, and self-hosting.
|
||||
|
||||
## Configuration
|
||||
|
||||
Font options accept either a CSS font-family string or an object with Google Fonts loading control:
|
||||
|
||||
```yaml
|
||||
# String form
|
||||
body: '"Inter", sans-serif'
|
||||
|
||||
# Object form (for Google Fonts weight/italic control)
|
||||
body:
|
||||
name: Inter
|
||||
weights: [400, 600, 700]
|
||||
includeItalic: true
|
||||
```
|
||||
|
||||
This plugin accepts the following configuration options:
|
||||
|
||||
| Option | Type | Default | Description |
|
||||
| --------------- | ------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------- |
|
||||
| `title` | `FontSpecification` | `header` value | Font family for the site title. |
|
||||
| `body` | `FontSpecification` | see below | Font family for body text. |
|
||||
| `header` | `FontSpecification` | see below | Default font family for all headings (h1-h6). |
|
||||
| `code` | `FontSpecification` | see below | Font family for code and monospace elements. |
|
||||
| `interface` | `FontSpecification` | Obsidian default | Font family for UI elements. |
|
||||
| `h1` – `h6` | `FontSpecification` | `header` value | Per-heading font family overrides. |
|
||||
| `useThemeFonts` | `boolean` | `true` | Use fonts from [[ThemesCore\|Quartz Themes]] as defaults when it is enabled. |
|
||||
| `fontOrigin` | `string` | `"googleFonts"` | `"googleFonts"` to load from Google Fonts CDN, `"selfHosted"` to download and serve locally, `"local"` for no loading. |
|
||||
|
||||
### Default options
|
||||
Options go under `configuration.fonts` in `quartz.config.yaml`:
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: "@quartz-community/quartz-fonts"
|
||||
enabled: true
|
||||
options:
|
||||
useThemeFonts: true
|
||||
fontOrigin: googleFonts
|
||||
```
|
||||
|
||||
### Font resolution
|
||||
|
||||
Fonts are resolved using a priority chain:
|
||||
|
||||
```
|
||||
Plugin option
|
||||
→ Theme font (from Quartz Themes, if enabled and useThemeFonts is on)
|
||||
→ configuration.theme.typography (header, body, code, title)
|
||||
→ Quartz defaults (Schibsted Grotesk, Source Sans Pro, IBM Plex Mono)
|
||||
```
|
||||
|
||||
For individual headings:
|
||||
|
||||
```
|
||||
h1 option → theme --h1-font → header option → theme body font → resolved header font
|
||||
```
|
||||
|
||||
For the site title:
|
||||
|
||||
```
|
||||
title option → configuration.theme.typography.title → resolved header font
|
||||
```
|
||||
|
||||
The `interface` font comes from the option, then the theme's `--font-interface`, then Obsidian's default sans-serif stack.
|
||||
|
||||
With `fontOrigin: googleFonts` or `selfHosted`, the header, body, code and title fonts are loaded from Google Fonts: the plugin options if set, otherwise `configuration.theme.typography`, otherwise the Quartz defaults.
|
||||
|
||||
## Usage with Quartz Themes
|
||||
|
||||
When [[ThemesCore|Quartz Themes]] is enabled, Fonts automatically discovers the theme's font metadata and uses it as defaults. Any options you explicitly set in Fonts will override the theme fonts.
|
||||
|
||||
Fonts must run **after** Quartz Themes. This is handled automatically by plugin ordering (Quartz Themes = 10, Fonts = 60).
|
||||
|
||||
> [!warning]
|
||||
> If Quartz Themes is enabled but hasn't run yet when Fonts executes, you'll see a warning in the console. Make sure Quartz Themes has a lower `defaultOrder` than Fonts.
|
||||
|
||||
## Usage without Quartz Themes
|
||||
|
||||
Fonts works standalone. Without a theme, it uses `configuration.theme.typography` (or the Quartz defaults). You can set fonts explicitly via the plugin options.
|
||||
|
||||
## Examples
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
# Use theme fonts automatically (default behavior)
|
||||
- source: "@quartz-community/quartz-fonts"
|
||||
enabled: true
|
||||
|
||||
# Override just the heading font
|
||||
- source: "@quartz-community/quartz-fonts"
|
||||
enabled: true
|
||||
options:
|
||||
header: '"Playfair Display", serif'
|
||||
|
||||
# Full control with per-heading fonts
|
||||
- source: "@quartz-community/quartz-fonts"
|
||||
enabled: true
|
||||
options:
|
||||
body: '"Inter", sans-serif'
|
||||
header: '"Playfair Display", serif'
|
||||
code: '"JetBrains Mono", monospace'
|
||||
h1: '"Playfair Display", serif'
|
||||
h2: '"Lora", serif'
|
||||
|
||||
# Load from Google Fonts automatically
|
||||
- source: "@quartz-community/quartz-fonts"
|
||||
enabled: true
|
||||
options:
|
||||
fontOrigin: googleFonts
|
||||
body: Inter
|
||||
header: Playfair Display
|
||||
code: JetBrains Mono
|
||||
|
||||
# Google Fonts with weight/italic control
|
||||
- source: "@quartz-community/quartz-fonts"
|
||||
enabled: true
|
||||
options:
|
||||
fontOrigin: googleFonts
|
||||
body:
|
||||
name: Inter
|
||||
weights: [400, 600, 700]
|
||||
includeItalic: true
|
||||
header:
|
||||
name: Playfair Display
|
||||
weights: [400, 700]
|
||||
code:
|
||||
name: JetBrains Mono
|
||||
weights: [400]
|
||||
|
||||
# Custom title font (separate from header)
|
||||
- source: "@quartz-community/quartz-fonts"
|
||||
enabled: true
|
||||
options:
|
||||
fontOrigin: googleFonts
|
||||
title: Abril Fatface
|
||||
header: Playfair Display
|
||||
body: Inter
|
||||
code: JetBrains Mono
|
||||
|
||||
# Self-hosted fonts (downloaded at build time, no external requests)
|
||||
- source: "@quartz-community/quartz-fonts"
|
||||
enabled: true
|
||||
options:
|
||||
configuration:
|
||||
theme:
|
||||
typography:
|
||||
header: Schibsted Grotesk
|
||||
body: Source Sans Pro
|
||||
code: IBM Plex Mono
|
||||
fonts:
|
||||
fontOrigin: selfHosted
|
||||
body: Inter
|
||||
header: Playfair Display
|
||||
code: JetBrains Mono
|
||||
|
||||
# Ignore theme fonts entirely
|
||||
- source: "@quartz-community/quartz-fonts"
|
||||
enabled: true
|
||||
options:
|
||||
useThemeFonts: false
|
||||
body: '"Inter", sans-serif'
|
||||
h1: { name: Playfair Display, weights: [700] }
|
||||
```
|
||||
|
||||
## Self-Hosted Fonts
|
||||
- `fontOrigin`: where fonts load from. Default `"googleFonts"`.
|
||||
- `"googleFonts"`: link the fonts from Google Fonts.
|
||||
- `"selfHosted"`: download them from Google Fonts at build time and serve them from your site (`static/fonts/`), so the site is self-contained.
|
||||
- `"local"`: don't load anything; the fonts must be available otherwise.
|
||||
- `title`, `header`, `body`, `code`: override the matching `theme.typography` font.
|
||||
- `interface`: font for interface elements (Obsidian's `--font-interface`).
|
||||
- `h1` … `h6`: per-heading fonts. Unset headings use `header`.
|
||||
- `useThemeFonts`: use the fonts of a theme plugin such as [[ThemesCore|Quartz Themes]]. Default `true`.
|
||||
- `enabled: false` turns font handling off; `order` changes when it runs.
|
||||
|
||||
When `fontOrigin: selfHosted` is set, Fonts downloads fonts from Google Fonts during the build and serves them from your site's `static/fonts/` directory. This makes your site fully self-contained with no external requests to Google at runtime.
|
||||
A font is a name (any [Google Font](https://fonts.google.com/)) or `{ name, weights, includeItalic }`; see [[configuration#Fonts|Fonts in the configuration]].
|
||||
|
||||
At build time, the plugin:
|
||||
## With Quartz Themes
|
||||
|
||||
1. Fetches the Google Fonts CSS for your configured fonts
|
||||
2. Downloads each font file (`.woff2`, `.woff`, etc.)
|
||||
3. Writes the font files to `static/fonts/` in your build output
|
||||
4. Generates a `quartz-fonts.css` file with `@font-face` rules pointing to the local files
|
||||
An Obsidian theme sets its own fonts, including heading fonts. With [[ThemesCore|Quartz Themes]] enabled, Quartz leaves them to the theme and only applies the fonts you set explicitly here (for example `h1`, or `header` for all headings).
|
||||
|
||||
The stylesheet is linked relative to each page and the font files relative to the stylesheet, so self-hosted fonts work on `localhost`, on any host and under a base path; `baseUrl` is not needed.
|
||||
## Upgrading from the plugin
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
plugins:
|
||||
- source: "@quartz-community/quartz-fonts"
|
||||
enabled: true
|
||||
options:
|
||||
fontOrigin: selfHosted
|
||||
body: Inter
|
||||
header: Playfair Display
|
||||
code: JetBrains Mono
|
||||
```
|
||||
|
||||
## Google Fonts Validation
|
||||
|
||||
When `fontOrigin: googleFonts` is set and the optional [`google-font-metadata`](https://www.npmjs.com/package/google-font-metadata) package is installed, Fonts validates your font configuration at build time:
|
||||
|
||||
- Checks that font family names exist in Google Fonts.
|
||||
- Warns if requested weights are not available for a font.
|
||||
- Warns if italic is requested but the font doesn't support it.
|
||||
|
||||
Install it to enable validation:
|
||||
|
||||
```bash
|
||||
npm install google-font-metadata
|
||||
```
|
||||
|
||||
Validation warnings are logged to the console but do not block the build.
|
||||
|
||||
## API
|
||||
|
||||
- Category: Transformer, Emitter
|
||||
- Function name: `ExternalPlugin.Fonts()` (transformer), `ExternalPlugin.FontsEmitter()` (emitter).
|
||||
- Source: [`quartz-community/fonts`](https://github.com/quartz-community/fonts)
|
||||
- Install: `npx quartz plugin add @quartz-community/quartz-fonts` (included in the default configuration)
|
||||
An existing `@quartz-community/quartz-fonts` entry keeps working: its options are applied to `configuration.fonts` and the package is no longer loaded. Run `npx quartz plugin doctor --fix` to move them.
|
||||
+21
-17
@@ -3,7 +3,7 @@ title: ThemesCore
|
||||
aliases:
|
||||
- QuartzThemes
|
||||
- Quartz Themes
|
||||
description: Obsidian community themes for Quartz, with per-aspect mix-and-match.
|
||||
description: Use any Obsidian community theme, converted at build time.
|
||||
tags:
|
||||
- plugin/transformer
|
||||
image:
|
||||
@@ -13,24 +13,29 @@ enabled: false
|
||||
required: false
|
||||
---
|
||||
|
||||
This plugin styles your site with an Obsidian community theme from [Quartz Themes](https://github.com/saberzero1/quartz-themes): hundreds of themes, converted from their Obsidian CSS. The theme's CSS is added to every page; the [[features/darkmode|dark mode]] toggle switches between its light and dark variants.
|
||||
This plugin styles your site with any Obsidian community theme. You name the theme; at build time the plugin downloads it (the same file Obsidian installs) and converts its CSS for Quartz. The [[features/darkmode|dark mode]] toggle switches between the theme's light and dark variants, and [Style Settings](https://github.com/mgmeyers/obsidian-style-settings) exports apply as they do in Obsidian.
|
||||
|
||||
> [!note]
|
||||
> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page.
|
||||
|
||||
A theme colours the page through Obsidian's CSS variables, so `configuration.theme.colors` then has little or no effect; see [[configuration#General Configuration|Configuration]] for overriding a theme's colours. With [[Fonts]] enabled, the theme's fonts are used as defaults (Quartz Themes runs first, at order `10`).
|
||||
A theme colours the page through Obsidian's CSS variables, so `configuration.theme.colors` then has little or no effect; see [[configuration#General Configuration|Configuration]] for overriding a theme's colours. With [[Fonts]] enabled, configured fonts still apply to Quartz's own interface; the theme keeps its fonts for content unless you set `header`/`h1`–`h6` explicitly.
|
||||
|
||||
## Configuration
|
||||
|
||||
This plugin accepts the following configuration options:
|
||||
|
||||
- `theme`: The theme's id, e.g. `tokyo-night`, `catppuccin`, `minimal`. Defaults to `"tokyo-night"`.
|
||||
- `theme`: The theme. Defaults to `"Tokyo Night"`. Accepts:
|
||||
- a community theme name, as listed in Obsidian (`Minimal`, `AnuPpuccin`);
|
||||
- a GitHub repository for themes outside the registry (`kepano/obsidian-minimal`);
|
||||
- a URL to a `theme.css`, or a local path (`./themes/My Theme`, `./my-theme.css`);
|
||||
- an id from earlier versions (`tokyo-night`, `catppuccin.frappe`), which maps to the theme and the Style Settings preset it used.
|
||||
- `mode`: `"both"`, `"light"` or `"dark"`. Defaults to `"both"`. With a single mode (or a theme that only has one), the dark mode toggle is hidden and the site stays in that mode.
|
||||
- `variation`: A variation of the theme, if it has any (e.g. `frappe` for `catppuccin`).
|
||||
- `aspects`: Take single aspects from other themes, or leave them out with `false`, e.g. `{ callouts: anuppuccin, code: false }`. Aspects: `base`, `headings`, `typography`, `callouts`, `tables`, `code`, `links`, `blockquotes`, `checkboxes`, `images`, `embeds`, `cards`, `search`, `scrollbars`, `explorer`, `toc`, `graph`, `popover`, `footer`, `recentNotes`, `listPage`, `darkmode`, `breadcrumbs`, `lists`, `canvas`, `bases`, `properties`, `stacked`, `misc`.
|
||||
- `include`: Only include these aspects (plus those set in `aspects`). Defaults to all.
|
||||
- `themeFonts`: Whether to include the theme's fonts. Defaults to `true`.
|
||||
- `styleSettings`: Settings for themes that support the Obsidian [Style Settings](https://github.com/mgmeyers/obsidian-style-settings) plugin: an export from that plugin, or the path to a JSON file holding one. Keys look like `minimal-style@@bg1`.
|
||||
- `styleSettings`: An export from the Style Settings plugin, or the path to a JSON file holding one. Keys look like `minimal-style@@h1-color@@dark`.
|
||||
- `snippets`: Obsidian CSS snippets (paths or URLs), applied after the theme.
|
||||
- `version`: Pin a community theme to a release version. Defaults to the latest.
|
||||
- `themeFonts`: Whether to include the theme's own web fonts. Defaults to `true`.
|
||||
- `cacheDir`: Where downloaded themes are cached. Defaults to `.quartz-cache/quartz-themes`. Builds work offline from the cache.
|
||||
- `cacheHours`: How long before checking for a new theme version. Defaults to `24`.
|
||||
|
||||
### Default options
|
||||
|
||||
@@ -40,24 +45,23 @@ The default config has a disabled entry for this plugin. Set `enabled: true` to
|
||||
- source: "@quartz-themes/core"
|
||||
enabled: true
|
||||
options:
|
||||
theme: tokyo-night
|
||||
theme: Tokyo Night
|
||||
mode: both
|
||||
```
|
||||
|
||||
Mixing aspects:
|
||||
With Style Settings:
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: "@quartz-themes/core"
|
||||
enabled: true
|
||||
options:
|
||||
theme: tokyo-night
|
||||
mode: both
|
||||
aspects:
|
||||
callouts: anuppuccin
|
||||
tables: minimal
|
||||
code: false
|
||||
theme: Minimal
|
||||
styleSettings: ./style-settings.json
|
||||
```
|
||||
|
||||
> [!info] Upgrading from 2.x
|
||||
> Per-theme `@quartz-themes/<theme>` packages are no longer used and can be removed. `aspects`, `include`, `calloutStyle` and `fonts` were removed: themes are converted whole. Theme ids from 2.x keep working.
|
||||
|
||||
## API
|
||||
|
||||
- Category: Transformer
|
||||
|
||||
Generated
+158
-177
@@ -1,22 +1,22 @@
|
||||
{
|
||||
"name": "@jackyzha0/quartz",
|
||||
"version": "5.0.0",
|
||||
"version": "5.2.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@jackyzha0/quartz",
|
||||
"version": "5.0.0",
|
||||
"version": "5.2.2",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@clack/prompts": "^1.8.0",
|
||||
"@floating-ui/dom": "^1.7.4",
|
||||
"@myriaddreamin/rehype-typst": "^0.7.0",
|
||||
"@napi-rs/simple-git": "1.1.0",
|
||||
"@napi-rs/simple-git": "1.2.0",
|
||||
"@quartz-community/alias-redirects": "^1.0.3",
|
||||
"@quartz-community/article-title": "^1.0.2",
|
||||
"@quartz-community/backlinks": "^1.0.3",
|
||||
"@quartz-community/bases-page": "^1.2.1",
|
||||
"@quartz-community/bases-page": "^1.3.0",
|
||||
"@quartz-community/breadcrumbs": "^1.0.3",
|
||||
"@quartz-community/canvas-page": "^1.0.3",
|
||||
"@quartz-community/citations": "^1.0.1",
|
||||
@@ -27,22 +27,21 @@
|
||||
"@quartz-community/created-modified-date": "^1.0.3",
|
||||
"@quartz-community/darkmode": "^1.0.2",
|
||||
"@quartz-community/description": "^1.0.2",
|
||||
"@quartz-community/encrypted-pages": "^1.1.1",
|
||||
"@quartz-community/explicit-publish": "^1.1.0",
|
||||
"@quartz-community/encrypted-pages": "^1.2.0",
|
||||
"@quartz-community/explicit-publish": "^1.2.0",
|
||||
"@quartz-community/explorer": "^1.0.3",
|
||||
"@quartz-community/favicon": "^1.0.1",
|
||||
"@quartz-community/folder-page": "^1.0.3",
|
||||
"@quartz-community/folder-page": "^1.1.0",
|
||||
"@quartz-community/footer": "^1.1.1",
|
||||
"@quartz-community/github-flavored-markdown": "^2.1.1",
|
||||
"@quartz-community/graph": "^1.0.3",
|
||||
"@quartz-community/hard-line-breaks": "^1.1.0",
|
||||
"@quartz-community/latex": "^1.0.1",
|
||||
"@quartz-community/latex": "^1.0.2",
|
||||
"@quartz-community/note-properties": "^1.1.4",
|
||||
"@quartz-community/obsidian-flavored-markdown": "^2.1.3",
|
||||
"@quartz-community/obsidian-flavored-markdown": "^2.2.0",
|
||||
"@quartz-community/og-image": "^1.1.1",
|
||||
"@quartz-community/ox-hugo": "^1.0.1",
|
||||
"@quartz-community/page-title": "^1.0.2",
|
||||
"@quartz-community/quartz-fonts": "^1.0.2",
|
||||
"@quartz-community/reader-mode": "^1.0.2",
|
||||
"@quartz-community/recent-notes": "^1.0.3",
|
||||
"@quartz-community/roam": "^1.1.0",
|
||||
@@ -52,9 +51,9 @@
|
||||
"@quartz-community/syntax-highlighting": "^1.0.3",
|
||||
"@quartz-community/table-of-contents": "^1.0.3",
|
||||
"@quartz-community/tag-list": "^1.0.3",
|
||||
"@quartz-community/tag-page": "^1.0.4",
|
||||
"@quartz-community/unlisted-pages": "^1.1.0",
|
||||
"@quartz-themes/core": "^2.0.1",
|
||||
"@quartz-community/tag-page": "^1.0.5",
|
||||
"@quartz-community/unlisted-pages": "^1.2.0",
|
||||
"@quartz-themes/core": "^3.1.0",
|
||||
"ansi-truncate": "^1.4.0",
|
||||
"async-mutex": "^0.5.0",
|
||||
"chokidar": "^5.0.0",
|
||||
@@ -402,28 +401,29 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@clack/core": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/@clack/core/-/core-1.5.1.tgz",
|
||||
"integrity": "sha512-iHTrHA8MtVuLl2TfZySmcKv1qO2PoyC9Z7pfSDozEuV5vtY3/wcOPKJXlqJ5Oq2Cx5DDGQGAMVx6HZfRRoVEbQ==",
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@clack/core/-/core-1.6.0.tgz",
|
||||
"integrity": "sha512-4GZynIB2IIe431odxesswvWTCP6orvqd6e2b07b3VFWBQRqUqIHc/EPIZwFoKS692QBp+ooPuXKaJV8g4kXuYA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"fast-string-width": "^3.0.2",
|
||||
"fast-wrap-ansi": "^0.2.0",
|
||||
"sisteransi": "^1.0.5"
|
||||
"sisteransi": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 20.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@clack/prompts": {
|
||||
"version": "1.8.1",
|
||||
"resolved": "https://registry.npmjs.org/@clack/prompts/-/prompts-1.8.1.tgz",
|
||||
"integrity": "sha512-dlT1m5e/0yUL0kRNcQn7yGLVThkgbB0Ga/1AmfDDC/8ik6AIiSf2QLQO2zPYvefsHP0aFgxO93cVLCCfDp7kzQ==",
|
||||
"version": "1.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@clack/prompts/-/prompts-1.9.0.tgz",
|
||||
"integrity": "sha512-tEj8X2No2A1c9NDnZECxiiJ8TP3vmFlN9tLlLeSaMqVW4tUmVG2R4qpv/eP4zymWxnymYLkLcIYVV0VcWj3RCQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@clack/core": "1.5.1",
|
||||
"@clack/core": "1.6.0",
|
||||
"fast-string-width": "^3.0.2",
|
||||
"fast-wrap-ansi": "^0.2.0",
|
||||
"sisteransi": "^1.0.5"
|
||||
"sisteransi": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 20.12.0"
|
||||
@@ -1434,6 +1434,12 @@
|
||||
"integrity": "sha512-GPm/Dbvk5RLmhRnxXIa7nTpK0xtl4E0wj0MslsuNiJ1FIROU+2+9lgUC/dgF7Ey4QCWhfEsgxilMRMCdHPfDfw==",
|
||||
"license": "BlueOak-1.0.0"
|
||||
},
|
||||
"node_modules/@lucide/icons": {
|
||||
"version": "1.77.0",
|
||||
"resolved": "https://registry.npmjs.org/@lucide/icons/-/icons-1.77.0.tgz",
|
||||
"integrity": "sha512-hboHeVf49oxM3i5wyczUiXVie1o2RqEtnJ8B+yWW5Xxi4/bQqJI8DV5HUwmKuHZxrd7GrXDjB15Y1DYX3tK6vw==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/@manypkg/find-root": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@manypkg/find-root/-/find-root-1.1.0.tgz",
|
||||
@@ -1762,9 +1768,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@napi-rs/simple-git": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git/-/simple-git-1.1.0.tgz",
|
||||
"integrity": "sha512-u7GiDtu3a5EKh7D0cKYHszWxBWvo8sDEzfv4N/A/4t3FFzu1ctMjz3H8DqlPs2CPrGQOEX2IEY9/f3FAbg9YDA==",
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git/-/simple-git-1.2.0.tgz",
|
||||
"integrity": "sha512-lsUGiHAJmdijXhHCR8d8W931mguJqV7QqXvBTS82BxYadBpW/ot8tXKObQ+c1N31H0Mz0h6mLm2MIBqRInuXWg==",
|
||||
"license": "MIT",
|
||||
"workspaces": [
|
||||
"website"
|
||||
@@ -1773,27 +1779,27 @@
|
||||
"node": ">= 10"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@napi-rs/simple-git-android-arm-eabi": "1.1.0",
|
||||
"@napi-rs/simple-git-android-arm64": "1.1.0",
|
||||
"@napi-rs/simple-git-darwin-arm64": "1.1.0",
|
||||
"@napi-rs/simple-git-darwin-x64": "1.1.0",
|
||||
"@napi-rs/simple-git-freebsd-x64": "1.1.0",
|
||||
"@napi-rs/simple-git-linux-arm-gnueabihf": "1.1.0",
|
||||
"@napi-rs/simple-git-linux-arm64-gnu": "1.1.0",
|
||||
"@napi-rs/simple-git-linux-arm64-musl": "1.1.0",
|
||||
"@napi-rs/simple-git-linux-ppc64-gnu": "1.1.0",
|
||||
"@napi-rs/simple-git-linux-s390x-gnu": "1.1.0",
|
||||
"@napi-rs/simple-git-linux-x64-gnu": "1.1.0",
|
||||
"@napi-rs/simple-git-linux-x64-musl": "1.1.0",
|
||||
"@napi-rs/simple-git-win32-arm64-msvc": "1.1.0",
|
||||
"@napi-rs/simple-git-win32-ia32-msvc": "1.1.0",
|
||||
"@napi-rs/simple-git-win32-x64-msvc": "1.1.0"
|
||||
"@napi-rs/simple-git-android-arm-eabi": "1.2.0",
|
||||
"@napi-rs/simple-git-android-arm64": "1.2.0",
|
||||
"@napi-rs/simple-git-darwin-arm64": "1.2.0",
|
||||
"@napi-rs/simple-git-darwin-x64": "1.2.0",
|
||||
"@napi-rs/simple-git-freebsd-x64": "1.2.0",
|
||||
"@napi-rs/simple-git-linux-arm-gnueabihf": "1.2.0",
|
||||
"@napi-rs/simple-git-linux-arm64-gnu": "1.2.0",
|
||||
"@napi-rs/simple-git-linux-arm64-musl": "1.2.0",
|
||||
"@napi-rs/simple-git-linux-ppc64-gnu": "1.2.0",
|
||||
"@napi-rs/simple-git-linux-s390x-gnu": "1.2.0",
|
||||
"@napi-rs/simple-git-linux-x64-gnu": "1.2.0",
|
||||
"@napi-rs/simple-git-linux-x64-musl": "1.2.0",
|
||||
"@napi-rs/simple-git-win32-arm64-msvc": "1.2.0",
|
||||
"@napi-rs/simple-git-win32-ia32-msvc": "1.2.0",
|
||||
"@napi-rs/simple-git-win32-x64-msvc": "1.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@napi-rs/simple-git-android-arm-eabi": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git-android-arm-eabi/-/simple-git-android-arm-eabi-1.1.0.tgz",
|
||||
"integrity": "sha512-6/2i3G9LJ8TOq5+DrQj5NObP3sOMdBatNxJBFeTpEqe+B6uBjn/3NrVQ2nvp/bfUNLHRSynQQma7QkrMbBRDnQ==",
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git-android-arm-eabi/-/simple-git-android-arm-eabi-1.2.0.tgz",
|
||||
"integrity": "sha512-WnSWDLbECx/0QfvVpqorUIAAmJ60gSwX/3g0dQwZLNa8RY7oHh/3cQqYRIW0SWv5JD4ckwXvkehVed7LTUKE7g==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
@@ -1807,9 +1813,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@napi-rs/simple-git-android-arm64": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git-android-arm64/-/simple-git-android-arm64-1.1.0.tgz",
|
||||
"integrity": "sha512-y47tEA1J/0QYIstjqPuQxFTSXhsjE6HMLXW53wB+MJ07jDe5jQK9b//nXnypx4oJ7DbKwUuWZDbrptq3Cdg+DQ==",
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git-android-arm64/-/simple-git-android-arm64-1.2.0.tgz",
|
||||
"integrity": "sha512-nBfjOUxBzyA82zChLcL9CTBRcCgElYs1lgxymus/v5imZs2+re7tYvTi0rcQ1YdpVmkNZWHiWdngeHxvGzsUvw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -1823,9 +1829,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@napi-rs/simple-git-darwin-arm64": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git-darwin-arm64/-/simple-git-darwin-arm64-1.1.0.tgz",
|
||||
"integrity": "sha512-XX1W7+NS5scOmxbrkbMQBn6DQ+zCLqbrFFQ8YeSO6KLznLOQe50EAOQOCZAABUBxTBTKJPaq6sBC25vslwrs8A==",
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git-darwin-arm64/-/simple-git-darwin-arm64-1.2.0.tgz",
|
||||
"integrity": "sha512-P7wBGhnlFTRTPDqf0mji1tNYBzsa+/VJdIUWqe3Ne+wNzwDYPakzuyO9iHMRKAVBUgbyTgtuKuVWw1G7uEEDsQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -1839,9 +1845,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@napi-rs/simple-git-darwin-x64": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git-darwin-x64/-/simple-git-darwin-x64-1.1.0.tgz",
|
||||
"integrity": "sha512-5BMOxXk31SKcS2ueoOuqe2d/LOvM6BOf2ODrIwELV4KwAxBmPShh69cZHKX7GrbO7FrNGQIeF4Wyz7z2x/w2mA==",
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git-darwin-x64/-/simple-git-darwin-x64-1.2.0.tgz",
|
||||
"integrity": "sha512-qYFRJj61kjWQ5vgBMGfiNuGKl7aTt1fHY4Y+Ra8a7G3g9IQm9Wx4FXebGVoQ6D8kU3hbizzT8mpqopw1QfHipA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -1855,9 +1861,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@napi-rs/simple-git-freebsd-x64": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git-freebsd-x64/-/simple-git-freebsd-x64-1.1.0.tgz",
|
||||
"integrity": "sha512-CinaCoDXPTIV1SDAgVHSdsYXw93M4fqkekL2qgXpMQPKYEDyIOyWyJ6ciGQWpRAkBxRYPpUYU28McKBa01mbrQ==",
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git-freebsd-x64/-/simple-git-freebsd-x64-1.2.0.tgz",
|
||||
"integrity": "sha512-LEU6FS4aLbe6SdAPi7pxN52R36zUeZTC2//xd3ttH4/eu0NFr/Ha4U1Qtb0rMYL7z9UWMU/T7aT6jopTsOH8XQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -1871,9 +1877,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@napi-rs/simple-git-linux-arm-gnueabihf": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git-linux-arm-gnueabihf/-/simple-git-linux-arm-gnueabihf-1.1.0.tgz",
|
||||
"integrity": "sha512-Eg2KdwAyNDGpC74W/0Cnv4lAIUB2Uhg1+KT59mZlELvxdmbJFE4xDCS4Zh50EDK9nS+t45PZhaxmRrxA7whXzg==",
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git-linux-arm-gnueabihf/-/simple-git-linux-arm-gnueabihf-1.2.0.tgz",
|
||||
"integrity": "sha512-G33B6VAF9uf7fSGp2RNL7ZBi4E75uVyqPRccpaDHxZS1RUsoV0PzzHlMi4nJoWdJ5Jnzx+fEvkchMYZ6tjXfZQ==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
@@ -1887,9 +1893,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@napi-rs/simple-git-linux-arm64-gnu": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git-linux-arm64-gnu/-/simple-git-linux-arm64-gnu-1.1.0.tgz",
|
||||
"integrity": "sha512-AYZsGSmd5RR847XqKjpqmwLoT/847GvGIF1OhNqtN4UI16gFMlHU3XO+IMxf6quNgA/bY3ILUI5YGswU8e0Y9g==",
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git-linux-arm64-gnu/-/simple-git-linux-arm64-gnu-1.2.0.tgz",
|
||||
"integrity": "sha512-MZQ3J6A0exMNkRNSIjypAwwrpxbsvECMjFPnFraFi8kkDCCALdRVeMmfDYM+DYn6S+/VRK5RCgLsiLFMt288uQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -1903,9 +1909,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@napi-rs/simple-git-linux-arm64-musl": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git-linux-arm64-musl/-/simple-git-linux-arm64-musl-1.1.0.tgz",
|
||||
"integrity": "sha512-UanfuFboJWiJ4n5BTUmI28sQ2JjssGExn5jcn8BAQ4CECwHpNVanM1Lmw4xGuQCcULxUCUS6speOA8zz7PaOqA==",
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git-linux-arm64-musl/-/simple-git-linux-arm64-musl-1.2.0.tgz",
|
||||
"integrity": "sha512-/bdgsHtq3GHaeItxLCQ571WU20k6e5lOhbs3nz4Nf3utzhmxiAqi8vmlw5RQpYWAae3LlpZIPr6xXl30ASudRQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -1919,9 +1925,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@napi-rs/simple-git-linux-ppc64-gnu": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git-linux-ppc64-gnu/-/simple-git-linux-ppc64-gnu-1.1.0.tgz",
|
||||
"integrity": "sha512-EzW2jhtVZYM+N3A0Mc7Ju2+Js8s2HcoK+Cu+TM+XArodnoHNR2VrHVxMG+WY1Ra6pHBd1kyNdHmuSscuo8E60w==",
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git-linux-ppc64-gnu/-/simple-git-linux-ppc64-gnu-1.2.0.tgz",
|
||||
"integrity": "sha512-HHIPt6QnnmrMkO2MJEUPYfrmSgN5h+GCP9dCcmD72fXlTOHiMmMwC7NaW08h05SK8NMxli/h8E5dxt4WilxvIg==",
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
@@ -1935,9 +1941,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@napi-rs/simple-git-linux-s390x-gnu": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git-linux-s390x-gnu/-/simple-git-linux-s390x-gnu-1.1.0.tgz",
|
||||
"integrity": "sha512-u9J6YYf7BrvNQ2pTLkPyOGdRhTVz/Nl+FtznebKaxuw7QCZYkOlGWbAeJRdBQ2wXNtdqwfcZZZYa93YxwjsMOA==",
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git-linux-s390x-gnu/-/simple-git-linux-s390x-gnu-1.2.0.tgz",
|
||||
"integrity": "sha512-hD1YMetNhL7C3LZrnFfjgCCuLePsazYj/lEgnfmGEzqa0n8DPZmpMJ2itoKQcnnf7CnxUFuhJ0NF6hH/bk98kA==",
|
||||
"cpu": [
|
||||
"s390x"
|
||||
],
|
||||
@@ -1951,9 +1957,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@napi-rs/simple-git-linux-x64-gnu": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git-linux-x64-gnu/-/simple-git-linux-x64-gnu-1.1.0.tgz",
|
||||
"integrity": "sha512-owuVJqIb7HXOokeDSe6ipNv1JOv3MUZlGuKs3bbP/b50iV9Wixx4L7Hsph450ERcmoSmQdiQjU9nyC5wEsdf5w==",
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git-linux-x64-gnu/-/simple-git-linux-x64-gnu-1.2.0.tgz",
|
||||
"integrity": "sha512-E2PKw0ZRQ0RH1odOmW+92dkJg705YTeIhdAr6Tml5lFxRlwvupsxhiXEIPhd5q+S7iYnb8jdI5C+Ye8iNbsFNw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -1967,9 +1973,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@napi-rs/simple-git-linux-x64-musl": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git-linux-x64-musl/-/simple-git-linux-x64-musl-1.1.0.tgz",
|
||||
"integrity": "sha512-687mjASLaoAkwD9Uu7/tJspV6Np+G6dp/V3CDNssfgl8r/Gdv/hhxC4vE7+QlSeqRJ8cdTl7bA7JKUKxgXQV/A==",
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git-linux-x64-musl/-/simple-git-linux-x64-musl-1.2.0.tgz",
|
||||
"integrity": "sha512-yQCvgBVJJf6fVl3YwyAJCcV4IW9kn3Ozgz6Fw3bz6mUSjQ6xlsSc7GM+sug5mIdrSHyRpxT8BXiTP4flGYlC9g==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -1983,9 +1989,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@napi-rs/simple-git-win32-arm64-msvc": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git-win32-arm64-msvc/-/simple-git-win32-arm64-msvc-1.1.0.tgz",
|
||||
"integrity": "sha512-REQsy+VMd7JIl4wFvggQE87XmPK3R0nfT7AEys6cU2zyCokogAEkbI2/y/gQLzZ62Evfy0IkdvzWUorS9984DA==",
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git-win32-arm64-msvc/-/simple-git-win32-arm64-msvc-1.2.0.tgz",
|
||||
"integrity": "sha512-Ps0CnmHR+XZBfUk8hre7r2vu9eU3Nr8xFj4EWsG1Olia31uBCKlO1pwnbpl5WvkrK/pv7iPpmNSq+5R/tNVPTw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -1999,9 +2005,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@napi-rs/simple-git-win32-ia32-msvc": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git-win32-ia32-msvc/-/simple-git-win32-ia32-msvc-1.1.0.tgz",
|
||||
"integrity": "sha512-FRVBqqizxUqEu/F5Ol7nfwzpp+AZc9+WILu0o0HPDIw6f/o1CmULdH2EocFaYWFzvttguouLMz38sHHtz2eeXg==",
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git-win32-ia32-msvc/-/simple-git-win32-ia32-msvc-1.2.0.tgz",
|
||||
"integrity": "sha512-6gwSlunF/5PTcZpQA5WzmuizXmD2inrB/SncktDHhWH/FnU0TP6qVnoGtpShZ2gDptABSaS8DoOouOFx0UaIfA==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
@@ -2015,9 +2021,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@napi-rs/simple-git-win32-x64-msvc": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git-win32-x64-msvc/-/simple-git-win32-x64-msvc-1.1.0.tgz",
|
||||
"integrity": "sha512-fN0Ihi8jkdjjHZi4PXaHtVB11RYxBS4ReUICKosNTeA0ROBvOiMsCQW9yWkWtRudNf+mN9Y9OGJHSKbduw2EZQ==",
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/simple-git-win32-x64-msvc/-/simple-git-win32-x64-msvc-1.2.0.tgz",
|
||||
"integrity": "sha512-eEj9P8mXyRKzug+7ENehPXnaYAFU7w7CwCRrMPIH0DKoXbm/timiTtdNAOhfLnNp/ZMJVa3gXcl9hfLy3kFPDw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -2354,9 +2360,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/alias-redirects": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/alias-redirects/-/alias-redirects-1.0.3.tgz",
|
||||
"integrity": "sha512-kA3MiAneoHlC09uQJxF1ex1GktkUf9Rm53b0ybeJrtNEcteRoqBCELHB+pf6hUj9i/k2Epx0J8RyTSe/zwTg2A==",
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/alias-redirects/-/alias-redirects-1.0.4.tgz",
|
||||
"integrity": "sha512-DGlkfTtpG8TBI8zyibUq5XCK00gqEyG+nK8YfhNgnvIgUUKtO5Cdx5HSpI+K2a8bb0uT0zpeAUy/uwUp30EmLQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -2376,9 +2382,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/article-title": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/article-title/-/article-title-1.0.2.tgz",
|
||||
"integrity": "sha512-WQISg0GyglaRx4HsfUu43ny7PVe1lGk0fVohVOQu46JWKAk+UJCqP09BigRwzRJuqcUOzawjxueire1agfUwVA==",
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/article-title/-/article-title-1.1.0.tgz",
|
||||
"integrity": "sha512-AJMzWVQAjue+EgybnfR5Dx8geBMRpkX9YVc1/qVYCP1YTk3UIPk5p2bTnIs5oZ3DrxbTesyN+FH07divwpTacw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -2420,11 +2426,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/bases-page": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/bases-page/-/bases-page-1.2.1.tgz",
|
||||
"integrity": "sha512-mONeRLsZTNPT5fOJfdlM1Uq97V7aGnxSRZaT0X4PsR5bbEAIjnBoVEdsYrYZWypm/c6go58/59fXbpeexKFsFw==",
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/bases-page/-/bases-page-1.5.1.tgz",
|
||||
"integrity": "sha512-rdZZlrUM8Lj15mQf0EB8oYfFmwVH4N4Br68bI3tZLyfwwErfpJbRtc7sGHxxH+e9H+15dS8N0g+INcyNWRp9ag==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@lucide/icons": "^1.70.0",
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
"@quartz-community/utils": "^1.1.0"
|
||||
},
|
||||
@@ -2671,9 +2678,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/encrypted-pages": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/encrypted-pages/-/encrypted-pages-1.1.1.tgz",
|
||||
"integrity": "sha512-x+fFfXiurYn2BWgKuzwiZGTVq6osVbaUyIVoYXvNakwwIQQeuSGVyqWdA25bCK1nxYVRGXPS/d1emHrCLRgv9w==",
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/encrypted-pages/-/encrypted-pages-1.3.0.tgz",
|
||||
"integrity": "sha512-V04420LqG90y+LsZ7e9cOhRdHg/uVKKq0trWxjACnBQaHD9pAw/ODBh2FuXvjvj8ZuzzelRD6sIVeS9vq2isLg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -2697,9 +2704,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/explicit-publish": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/explicit-publish/-/explicit-publish-1.1.0.tgz",
|
||||
"integrity": "sha512-Xdo69D2x/VufWQviPOuQp/OkLQ8XVGwyt3KO+DN9/ablMvWAXSlYIA11pcP1Y4UgxBMzMhpZ4+BLZqTGlz1SRg==",
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/explicit-publish/-/explicit-publish-1.2.0.tgz",
|
||||
"integrity": "sha512-L9Cb7YtBLMdByBVKSz18ontTir2fx70GRXTLpBeu7+d+pjO7Rp3OlW/KYefuDAZvpPX7qKHKpT4j9ThjKyfT3w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0"
|
||||
@@ -2710,9 +2717,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/explorer": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/explorer/-/explorer-1.0.3.tgz",
|
||||
"integrity": "sha512-NksQMrCmOL7xWfH7CCA9kXaQboLWgJfZ5wsDnFaIoZEvg8BzC6x2hipMi5dj/4dkitiZhDY3kjnGsGtc0oZUIw==",
|
||||
"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",
|
||||
@@ -2753,9 +2760,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/folder-page": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/folder-page/-/folder-page-1.0.3.tgz",
|
||||
"integrity": "sha512-d2XN0NOSNXL9cwJqsllWXN7ugCAyCgx7AQl9ByJa3Qe/xvhqsyO84WPiS/BQOFBFlbRcozPHBN6tFZhiWrR5SQ==",
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/folder-page/-/folder-page-1.1.0.tgz",
|
||||
"integrity": "sha512-Pwd0yIIhE3A+PGiSzQ7jpBFA7LrPxSPYNQBV1KSMrEor875rcOgloOCeesZtRDs+UppjQWovJkoUwIVFljQ/qg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -2866,9 +2873,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/latex": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/latex/-/latex-1.0.1.tgz",
|
||||
"integrity": "sha512-u1bgG335fkp7fCVmJ4bdCzz6CIZFrxSEzP6SRkDV9fiEux8aErPNE+lCR+Kb7eQNniHLpIZcjYejz5Z/0LHD8A==",
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/latex/-/latex-1.0.2.tgz",
|
||||
"integrity": "sha512-DbWcGH9PZu7UP7VpxB3kMVReY1bK1/6SsILB+mK3pTqqt7kH+xTOUtiDRgHwRtdUskOAiDb+ZFcQixCKUxTVBg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0"
|
||||
@@ -2891,9 +2898,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/note-properties": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/note-properties/-/note-properties-1.1.4.tgz",
|
||||
"integrity": "sha512-MTj7D4+CzmuYzZ8UwF8T5uzFf+JHoA2NzRCniuhug4h6KVxf3IRePqn5uVupjm/0Uzz2oeB7UX8Nr0hH0SNAdg==",
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/note-properties/-/note-properties-1.1.5.tgz",
|
||||
"integrity": "sha512-C8sKIhjaD479SozfzmU/r6IMG7Jc279qPTTxpCuJthrTBW7oYcSn/iEieplhojIXbUo7GTWY23g0iL/jUfuL/g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -2917,12 +2924,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/obsidian-flavored-markdown": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/obsidian-flavored-markdown/-/obsidian-flavored-markdown-2.1.3.tgz",
|
||||
"integrity": "sha512-p5fls4M7ocUKrlF8MmfrlnNPEvBFZ5diVNVVkLsgTwCvzf19MrnczeKb3Q2yI2S1G2Xb0rXsq8kmF8faj+Q79A==",
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/obsidian-flavored-markdown/-/obsidian-flavored-markdown-2.3.1.tgz",
|
||||
"integrity": "sha512-lQucQG1Cm0KrjRQJfaSf0Ud5ugpnLC8ZG5e5cTFrysu2DVkLeS6ks0c0gXXtc6iK1OyZ49Bzug4HkNKZb6AwHQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/rehype-obsidian": "^1.3.0",
|
||||
"@quartz-community/rehype-obsidian": "^1.4.0",
|
||||
"@quartz-community/remark-obsidian": "^2.2.1",
|
||||
"@quartz-community/types": "^1.1.0",
|
||||
"@quartz-community/utils": "^1.2.0",
|
||||
@@ -3014,36 +3021,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/quartz-fonts": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/quartz-fonts/-/quartz-fonts-1.0.2.tgz",
|
||||
"integrity": "sha512-Q0iPRAlTXNNnvCutYpF1FAPFvNlwfeXPipg1SIgD9M1vxHSyUzfAGHkLngafR/HgNMf9qREbvqQaCTjtp7grEQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
"@quartz-community/utils": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=22",
|
||||
"npm": ">=10.9.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"google-font-metadata": "^6.0.0",
|
||||
"preact": "^10.0.0",
|
||||
"vfile": "^6.0.3"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"google-font-metadata": {
|
||||
"optional": true
|
||||
},
|
||||
"preact": {
|
||||
"optional": false
|
||||
},
|
||||
"vfile": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/reader-mode": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/reader-mode/-/reader-mode-1.0.2.tgz",
|
||||
@@ -3089,9 +3066,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/rehype-obsidian": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/rehype-obsidian/-/rehype-obsidian-1.3.0.tgz",
|
||||
"integrity": "sha512-62YFEr3NR/Z2G/wcq30/VVKTlT4RUKezWfwGTQkNC+9mAXcUb3gAwjgiUJwylXZQyZmBf+SZsCNmdhIb7CPh/g==",
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/rehype-obsidian/-/rehype-obsidian-1.4.0.tgz",
|
||||
"integrity": "sha512-o7kiFfMNsPOuV0s56gSqN+Syam0W5Sbd1taZsK9W5IpbXaFw6RiMY9aD/hIVGtKm5G2sB21v7Z0Lda76qENyKw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=22"
|
||||
@@ -3269,9 +3246,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/tag-page": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/tag-page/-/tag-page-1.0.4.tgz",
|
||||
"integrity": "sha512-57SBbZGfdckzVtwGtnoFSzxIJbeFEtgATMCMrnfql+5o+kZENnCRP9m2BCl/W3i1u3ygpLQ9DPxSQn97rsqzaw==",
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/tag-page/-/tag-page-1.0.5.tgz",
|
||||
"integrity": "sha512-HfRkwQs+iAIb2FKd6+ZgaHwIfdEk+LAZ8mwreD9iB8xUhmmRVjvjxKPUl8stDSI9gSD1Gaa0Pxgwh/sU0/rYgQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -3295,9 +3272,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/types": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/types/-/types-1.3.1.tgz",
|
||||
"integrity": "sha512-8tgpi+4EqLWZyCCA2CE3RC9hIUMc1vvzq4lHyhUpwao8v+Ij/CcLQQMh51jlnGFhbItSuFw1NH26TMjJ2cXgzA==",
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/types/-/types-1.5.0.tgz",
|
||||
"integrity": "sha512-gOP+EgjEy687/pHtJenLdPHomstlDQ8mUsP3a62CDyMLH02uPaxw0zmZLLzOx9+VE47TOlMc05cUsIxq5f7U5A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"unified": "^11.0.5",
|
||||
@@ -3321,9 +3298,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/unlisted-pages": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/unlisted-pages/-/unlisted-pages-1.1.0.tgz",
|
||||
"integrity": "sha512-Gi67xF7AIC860/Glwbi+Ewbbnvox3A3MPsTi2Dz25xuaepZLfnQAwCT4ZgAsy55y4wyxxZG8DBHjkOgRyd9PXQ==",
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/unlisted-pages/-/unlisted-pages-1.2.0.tgz",
|
||||
"integrity": "sha512-QsBQIurXnT4kx3r32JJLrH6NWMVBEsQKIFQQmIGRPxkcyzPmBLVzVD7j/MDDIKp39IIosK27DVOrmggZq69p2w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0"
|
||||
@@ -3358,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"
|
||||
@@ -3369,6 +3346,7 @@
|
||||
"node": ">=22"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"lightningcss": "^1.31.1",
|
||||
"preact": "^10.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
@@ -5046,9 +5024,9 @@
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/isomorphic-git": {
|
||||
"version": "1.44.11",
|
||||
"resolved": "https://registry.npmjs.org/isomorphic-git/-/isomorphic-git-1.44.11.tgz",
|
||||
"integrity": "sha512-Y1BohMJU12rnkEMwpiBklgQ+ZQo9PtQencCKQz/zsziilL9+Tn1Bip45cJ51czB8abrf/9oHLDGQE+4IlOVxbA==",
|
||||
"version": "1.44.18",
|
||||
"resolved": "https://registry.npmjs.org/isomorphic-git/-/isomorphic-git-1.44.18.tgz",
|
||||
"integrity": "sha512-+VgjSGkpuLHG/R8oYcPsRUCcr0ppbCfm3Eiws94I69Xzq8tc1Ar40ahngU52niIYejuTtWrbs/o0padH4SxKqQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"async-lock": "^1.4.1",
|
||||
@@ -6121,9 +6099,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/minimatch": {
|
||||
"version": "11.0.5",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-11.0.5.tgz",
|
||||
"integrity": "sha512-snPlVppFcYWfLLFQGhDxUyBcHNtMlWmn3jtj7pEaO+DP8pqL0IvAzXhMYmn1z9ASNtgmwLBdFxSf4tMUB0OTKA==",
|
||||
"version": "11.0.9",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-11.0.9.tgz",
|
||||
"integrity": "sha512-KCFkfyjqerNlSstjlhIGNXIKZGA/6O4V4RlhZ+Dsr621SPPw0mzlypE9D9ZOoPiVefHID+j7/XuMMlqfD/F60Q==",
|
||||
"license": "BlueOak-1.0.0",
|
||||
"dependencies": {
|
||||
"@isaacs/nonrecursive-glob-match": "^1.1.0",
|
||||
@@ -6421,18 +6399,18 @@
|
||||
}
|
||||
},
|
||||
"node_modules/preact-render-to-string": {
|
||||
"version": "6.8.2",
|
||||
"resolved": "https://registry.npmjs.org/preact-render-to-string/-/preact-render-to-string-6.8.2.tgz",
|
||||
"integrity": "sha512-Hdx7cKD3AMYgt795TdddBpUbuGEFoL/VeA6s7VrBt9Gjt0r6rCy5wMp5xkDjQ9cbKj62frHsEx1x8yV6EjoOpg==",
|
||||
"version": "6.8.3",
|
||||
"resolved": "https://registry.npmjs.org/preact-render-to-string/-/preact-render-to-string-6.8.3.tgz",
|
||||
"integrity": "sha512-yg04edGH7f5yfBUV4uyL2brzPB3e26AimLO5WNfUtwoCv8LBJ7Z+dElG8P5v+o8UqMUM6kZhnn4I/HEXNyP0ZQ==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"preact": ">=10 || >= 11.0.0-0"
|
||||
}
|
||||
},
|
||||
"node_modules/prettier": {
|
||||
"version": "3.9.10",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.9.10.tgz",
|
||||
"integrity": "sha512-skGHTH1Yb9QvaTC4hWnRTzEYtCpApF0UMBPz+t/0ZPzP8ihefo/btKd+QA7pUE0fEwA1SbS/NmhyEcstdXOIdA==",
|
||||
"version": "3.10.1",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.10.1.tgz",
|
||||
"integrity": "sha512-70vp3ZUYoPlFbF9uiTdXHUUCGEIp7d4+6p+8DYbkm2jP7x/3i/paXVF6dopSI3zd/CEitrZN1rc4i85xWmmXlg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
@@ -6977,10 +6955,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/sisteransi": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz",
|
||||
"integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==",
|
||||
"license": "MIT"
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-2.0.0.tgz",
|
||||
"integrity": "sha512-2WCqLdt12eN6ehLI50S2/ZxoowXU3DD1KVPRyVP0WEsFahrGZZmCdq1K59qjJljMRIDTwx1D9YaRK+hDneBUMg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
}
|
||||
},
|
||||
"node_modules/slash": {
|
||||
"version": "5.1.0",
|
||||
|
||||
+11
-12
@@ -2,7 +2,7 @@
|
||||
"name": "@jackyzha0/quartz",
|
||||
"description": "🌱 publish your digital garden and notes as a website",
|
||||
"private": true,
|
||||
"version": "5.0.0",
|
||||
"version": "5.2.2",
|
||||
"type": "module",
|
||||
"author": "jackyzha0 <j.zhao2k19@gmail.com>",
|
||||
"license": "MIT",
|
||||
@@ -42,11 +42,11 @@
|
||||
"@clack/prompts": "^1.8.0",
|
||||
"@floating-ui/dom": "^1.7.4",
|
||||
"@myriaddreamin/rehype-typst": "^0.7.0",
|
||||
"@napi-rs/simple-git": "1.1.0",
|
||||
"@napi-rs/simple-git": "1.2.0",
|
||||
"@quartz-community/alias-redirects": "^1.0.3",
|
||||
"@quartz-community/article-title": "^1.0.2",
|
||||
"@quartz-community/backlinks": "^1.0.3",
|
||||
"@quartz-community/bases-page": "^1.2.1",
|
||||
"@quartz-community/bases-page": "^1.3.0",
|
||||
"@quartz-community/breadcrumbs": "^1.0.3",
|
||||
"@quartz-community/canvas-page": "^1.0.3",
|
||||
"@quartz-community/citations": "^1.0.1",
|
||||
@@ -57,22 +57,21 @@
|
||||
"@quartz-community/created-modified-date": "^1.0.3",
|
||||
"@quartz-community/darkmode": "^1.0.2",
|
||||
"@quartz-community/description": "^1.0.2",
|
||||
"@quartz-community/encrypted-pages": "^1.1.1",
|
||||
"@quartz-community/explicit-publish": "^1.1.0",
|
||||
"@quartz-community/encrypted-pages": "^1.2.0",
|
||||
"@quartz-community/explicit-publish": "^1.2.0",
|
||||
"@quartz-community/explorer": "^1.0.3",
|
||||
"@quartz-community/favicon": "^1.0.1",
|
||||
"@quartz-community/folder-page": "^1.0.3",
|
||||
"@quartz-community/folder-page": "^1.1.0",
|
||||
"@quartz-community/footer": "^1.1.1",
|
||||
"@quartz-community/github-flavored-markdown": "^2.1.1",
|
||||
"@quartz-community/graph": "^1.0.3",
|
||||
"@quartz-community/hard-line-breaks": "^1.1.0",
|
||||
"@quartz-community/latex": "^1.0.1",
|
||||
"@quartz-community/latex": "^1.0.2",
|
||||
"@quartz-community/note-properties": "^1.1.4",
|
||||
"@quartz-community/obsidian-flavored-markdown": "^2.1.3",
|
||||
"@quartz-community/obsidian-flavored-markdown": "^2.2.0",
|
||||
"@quartz-community/og-image": "^1.1.1",
|
||||
"@quartz-community/ox-hugo": "^1.0.1",
|
||||
"@quartz-community/page-title": "^1.0.2",
|
||||
"@quartz-community/quartz-fonts": "^1.0.2",
|
||||
"@quartz-community/reader-mode": "^1.0.2",
|
||||
"@quartz-community/recent-notes": "^1.0.3",
|
||||
"@quartz-community/roam": "^1.1.0",
|
||||
@@ -82,9 +81,9 @@
|
||||
"@quartz-community/syntax-highlighting": "^1.0.3",
|
||||
"@quartz-community/table-of-contents": "^1.0.3",
|
||||
"@quartz-community/tag-list": "^1.0.3",
|
||||
"@quartz-community/tag-page": "^1.0.4",
|
||||
"@quartz-community/unlisted-pages": "^1.1.0",
|
||||
"@quartz-themes/core": "^2.0.1",
|
||||
"@quartz-community/tag-page": "^1.0.5",
|
||||
"@quartz-community/unlisted-pages": "^1.2.0",
|
||||
"@quartz-themes/core": "^3.1.0",
|
||||
"ansi-truncate": "^1.4.0",
|
||||
"async-mutex": "^0.5.0",
|
||||
"chokidar": "^5.0.0",
|
||||
|
||||
@@ -96,12 +96,10 @@ plugins:
|
||||
- source: "@quartz-community/roam"
|
||||
enabled: false
|
||||
order: 92
|
||||
- source: "@quartz-community/quartz-fonts"
|
||||
enabled: true
|
||||
- source: "@quartz-themes/core"
|
||||
enabled: false
|
||||
options:
|
||||
theme: tokyo-night
|
||||
theme: Tokyo Night
|
||||
mode: both
|
||||
- source: "@quartz-community/explicit-publish"
|
||||
enabled: false
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { FontSpecification } from "./util/theme"
|
||||
import { QuartzComponent } from "./components/types"
|
||||
import { ValidLocale } from "./i18n"
|
||||
import { PluginSpecifier } from "./plugins/loader/types"
|
||||
@@ -100,6 +101,8 @@ export interface GlobalConfiguration {
|
||||
drafts?: DraftsConfig | boolean
|
||||
/** Built-in content index: `static/contentIndex.json`, sitemap and RSS. */
|
||||
contentIndex?: ContentIndexConfig | boolean
|
||||
/** Built-in font loading (Google Fonts, self-hosted or local) and per-heading fonts. */
|
||||
fonts?: FontsConfig | boolean
|
||||
/**
|
||||
* Controls which assets are copied to public/
|
||||
* - "all": Copy all non-markdown files (backwards compatible, default)
|
||||
@@ -142,6 +145,31 @@ export interface DraftsConfig extends BuiltinToggle {
|
||||
publish?: boolean
|
||||
}
|
||||
|
||||
export type { FontSpecification }
|
||||
|
||||
export interface FontsConfig extends BuiltinToggle {
|
||||
/** Override `theme.typography.title`. */
|
||||
title?: FontSpecification
|
||||
/** Override `theme.typography.body`. */
|
||||
body?: FontSpecification
|
||||
/** Override `theme.typography.header`. */
|
||||
header?: FontSpecification
|
||||
/** Override `theme.typography.code`. */
|
||||
code?: FontSpecification
|
||||
/** Font for interface elements (Obsidian's `--font-interface`). */
|
||||
interface?: FontSpecification
|
||||
h1?: FontSpecification
|
||||
h2?: FontSpecification
|
||||
h3?: FontSpecification
|
||||
h4?: FontSpecification
|
||||
h5?: FontSpecification
|
||||
h6?: FontSpecification
|
||||
/** Use fonts registered by a theme plugin (e.g. @quartz-themes/core). Default `true`. */
|
||||
useThemeFonts?: boolean
|
||||
/** Where fonts load from. Default `"googleFonts"`. */
|
||||
fontOrigin?: "googleFonts" | "local" | "selfHosted"
|
||||
}
|
||||
|
||||
export interface ContentIndexConfig extends BuiltinToggle {
|
||||
/** Emit `sitemap.xml`. Default `true`. */
|
||||
enableSiteMap?: boolean
|
||||
|
||||
@@ -76,6 +76,11 @@ export const SyncArgv = {
|
||||
|
||||
export const BuildArgv = {
|
||||
...CommonArgv,
|
||||
config: {
|
||||
string: true,
|
||||
alias: ["C"],
|
||||
describe: "path to the config file (default: ./quartz.config.yaml)",
|
||||
},
|
||||
output: {
|
||||
string: true,
|
||||
alias: ["o"],
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* @quartz-community/crawl-links → configuration.links
|
||||
* @quartz-community/remove-draft → configuration.drafts
|
||||
* @quartz-community/content-index → configuration.contentIndex
|
||||
* @quartz-community/quartz-fonts → configuration.fonts
|
||||
* note-properties `delimiters` / `language` options → configuration.frontmatter
|
||||
*
|
||||
* Pure: takes the parsed config, returns a migrated copy and a list of human-readable changes.
|
||||
@@ -21,6 +22,8 @@ const ABSORBED = {
|
||||
},
|
||||
"remove-draft": { key: "drafts", defaultOrder: 50, legacyDefaults: {} },
|
||||
"content-index": { key: "contentIndex", defaultOrder: 50, legacyDefaults: {} },
|
||||
"quartz-fonts": { key: "fonts", defaultOrder: 60, legacyDefaults: {} },
|
||||
fonts: { key: "fonts", defaultOrder: 60, legacyDefaults: {} },
|
||||
}
|
||||
|
||||
const FRONTMATTER_DEFAULTS = { delimiters: "---", language: "yaml" }
|
||||
@@ -167,6 +170,7 @@ export function describeBuiltins(configuration = {}) {
|
||||
["links", "link resolution, backlinks/graph data (was crawl-links)"],
|
||||
["drafts", "hides `draft: true` pages (was remove-draft)"],
|
||||
["contentIndex", "contentIndex.json, sitemap, RSS (was content-index)"],
|
||||
["fonts", "font loading, per-heading fonts (was quartz-fonts)"],
|
||||
]
|
||||
return rows.map(([key, description]) => {
|
||||
const value = configuration?.[key]
|
||||
|
||||
@@ -127,6 +127,7 @@ describe("built-in helpers", () => {
|
||||
test("builtinKeyFor / builtinMessage recognise names and official sources", () => {
|
||||
assert.strictEqual(builtinKeyFor("crawl-links"), "links")
|
||||
assert.strictEqual(builtinKeyFor("@quartz-community/content-index"), "contentIndex")
|
||||
assert.strictEqual(builtinKeyFor("@quartz-community/quartz-fonts"), "fonts")
|
||||
assert.strictEqual(builtinKeyFor("graph"), undefined)
|
||||
assert.match(builtinMessage("remove-draft"), /configuration\.drafts.*publish: true/)
|
||||
assert.strictEqual(builtinKeyFor({ repo: "github:quartz-community/crawl-links" }), "links")
|
||||
@@ -146,6 +147,7 @@ describe("built-in helpers", () => {
|
||||
["links", false],
|
||||
["drafts", false],
|
||||
["contentIndex", true],
|
||||
["fonts", true],
|
||||
],
|
||||
)
|
||||
})
|
||||
|
||||
+13
-1
@@ -334,6 +334,17 @@ export async function handleBuild(argv) {
|
||||
argv.watch = true
|
||||
}
|
||||
|
||||
// Let `--config <path>` override the default ./quartz.config.yaml. Passed down
|
||||
// via env so it reaches the esbuild-bundled build code and worker threads.
|
||||
if (argv.config) {
|
||||
const resolved = path.resolve(argv.config)
|
||||
if (!fs.existsSync(resolved)) {
|
||||
console.error(`Config file not found: ${resolved}`)
|
||||
process.exit(1)
|
||||
}
|
||||
process.env.QUARTZ_CONFIG_PATH = resolved
|
||||
}
|
||||
|
||||
// " Quartz v5.1.0 " for a release checkout, plus `git describe` (e.g. v5.1.0-3-g1a2b3c4-dirty) otherwise
|
||||
const checkout = describeQuartzCheckout()
|
||||
const describe = checkout.describe && checkout.describe !== `v${version}` ? checkout.describe : ""
|
||||
@@ -607,8 +618,9 @@ export async function handleBuild(argv) {
|
||||
"quartz.config.yaml",
|
||||
"quartz.config.default.yaml",
|
||||
])
|
||||
const extraWatch = process.env.QUARTZ_CONFIG_PATH ? [process.env.QUARTZ_CONFIG_PATH] : []
|
||||
chokidar
|
||||
.watch(paths, { ignoreInitial: true })
|
||||
.watch([...paths, ...extraWatch], { ignoreInitial: true })
|
||||
.on("add", () => build(clientRefresh))
|
||||
.on("change", () => build(clientRefresh))
|
||||
.on("unlink", () => build(clientRefresh))
|
||||
|
||||
@@ -13,6 +13,7 @@ const LEGACY_PLUGINS_JSON_PATH = path.join(process.cwd(), "quartz.plugins.json")
|
||||
const LEGACY_DEFAULT_PLUGINS_JSON_PATH = path.join(process.cwd(), "quartz.plugins.default.json")
|
||||
|
||||
function resolveConfigPath() {
|
||||
if (process.env.QUARTZ_CONFIG_PATH) return path.resolve(process.env.QUARTZ_CONFIG_PATH)
|
||||
if (fs.existsSync(CONFIG_YAML_PATH)) return CONFIG_YAML_PATH
|
||||
if (fs.existsSync(LEGACY_PLUGINS_JSON_PATH)) return LEGACY_PLUGINS_JSON_PATH
|
||||
if (fs.existsSync(DEFAULT_CONFIG_YAML_PATH)) return DEFAULT_CONFIG_YAML_PATH
|
||||
|
||||
@@ -176,11 +176,13 @@ async function cloneAtCommitAsync({ url, ref, commit, dir }) {
|
||||
/**
|
||||
* Move a shallow clone to a pinned commit. The commit is fetched by SHA (GitHub and most hosts
|
||||
* allow fetching reachable commits), so a pin that is no longer the branch tip works (#2559).
|
||||
* The checkout is forced: the plugin directory is Quartz's clone, and its build (npm install)
|
||||
* rewrites tracked files such as package-lock.json, which a restored CI cache keeps (#2639).
|
||||
*/
|
||||
async function checkoutPinnedCommitAsync(dir, commit) {
|
||||
export async function checkoutPinnedCommitAsync(dir, commit) {
|
||||
assertCommit(commit)
|
||||
await gitAsync(["fetch", "--depth", "1", "origin", commit], { cwd: dir })
|
||||
await gitAsync(["checkout", "--quiet", commit], { cwd: dir })
|
||||
await gitAsync(["checkout", "--quiet", "--force", commit], { cwd: dir })
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,7 +4,13 @@ import { execSync } from "child_process"
|
||||
import fs from "fs"
|
||||
import os from "os"
|
||||
import path from "path"
|
||||
import { buildPluginAsync, linkPeerPlugins, pluginSourceChanged } from "./plugin-git-handlers.js"
|
||||
import { pathToFileURL } from "url"
|
||||
import {
|
||||
buildPluginAsync,
|
||||
checkoutPinnedCommitAsync,
|
||||
linkPeerPlugins,
|
||||
pluginSourceChanged,
|
||||
} from "./plugin-git-handlers.js"
|
||||
|
||||
let root
|
||||
let hostPreact
|
||||
@@ -161,3 +167,48 @@ describe("pluginSourceChanged", () => {
|
||||
assert.strictEqual(pluginSourceChanged(priorEntry, "github:owner/new-repo"), true)
|
||||
})
|
||||
})
|
||||
|
||||
describe("checkoutPinnedCommitAsync", () => {
|
||||
const git = (cwd, cmd) =>
|
||||
execSync(`git -c user.name=t -c user.email=t@t -c commit.gpgsign=false ${cmd}`, {
|
||||
cwd,
|
||||
stdio: "pipe",
|
||||
timeout: 30000,
|
||||
})
|
||||
.toString()
|
||||
.trim()
|
||||
|
||||
function makeRemote() {
|
||||
const remote = path.join(root, "remote")
|
||||
fs.mkdirSync(remote)
|
||||
git(remote, "init -q -b main")
|
||||
git(remote, "config uploadpack.allowAnySHA1InWant true")
|
||||
fs.writeFileSync(path.join(remote, "package-lock.json"), `{ "v": 1 }`)
|
||||
git(remote, "add -A")
|
||||
git(remote, "commit -q -m one")
|
||||
const first = git(remote, "rev-parse HEAD")
|
||||
fs.writeFileSync(path.join(remote, "package-lock.json"), `{ "v": 2 }`)
|
||||
git(remote, "commit -q -am two")
|
||||
return { remote, first }
|
||||
}
|
||||
|
||||
test("moves to a pinned commit that is not the branch tip", async () => {
|
||||
const { remote, first } = makeRemote()
|
||||
const dir = path.join(root, "plugin")
|
||||
git(root, `clone -q --depth 1 ${pathToFileURL(remote).href} "${dir}"`)
|
||||
await checkoutPinnedCommitAsync(dir, first)
|
||||
assert.strictEqual(git(dir, "rev-parse HEAD"), first)
|
||||
})
|
||||
|
||||
// a plugin's build (npm install) rewrites its tracked package-lock.json; a restored CI cache
|
||||
// keeps that change, and the checkout refused to move ("commit your changes or stash them")
|
||||
test("moves even when the plugin's build left tracked files changed (#2639)", async () => {
|
||||
const { remote, first } = makeRemote()
|
||||
const dir = path.join(root, "plugin")
|
||||
git(root, `clone -q --depth 1 ${pathToFileURL(remote).href} "${dir}"`)
|
||||
fs.writeFileSync(path.join(dir, "package-lock.json"), `{ "v": "rewritten by npm" }`)
|
||||
await checkoutPinnedCommitAsync(dir, first)
|
||||
assert.strictEqual(git(dir, "rev-parse HEAD"), first)
|
||||
assert.strictEqual(fs.readFileSync(path.join(dir, "package-lock.json"), "utf-8"), `{ "v": 1 }`)
|
||||
})
|
||||
})
|
||||
@@ -97,8 +97,6 @@ plugins:
|
||||
- source: "@quartz-community/roam"
|
||||
enabled: false
|
||||
order: 92
|
||||
- source: "@quartz-community/quartz-fonts"
|
||||
enabled: true
|
||||
- source: "@quartz-themes/core"
|
||||
enabled: false
|
||||
options:
|
||||
|
||||
@@ -97,8 +97,6 @@ plugins:
|
||||
- source: "@quartz-community/roam"
|
||||
enabled: false
|
||||
order: 92
|
||||
- source: "@quartz-community/quartz-fonts"
|
||||
enabled: true
|
||||
- source: "@quartz-themes/core"
|
||||
enabled: false
|
||||
options:
|
||||
|
||||
@@ -98,8 +98,6 @@ plugins:
|
||||
- source: "@quartz-community/roam"
|
||||
enabled: false
|
||||
order: 92
|
||||
- source: "@quartz-community/quartz-fonts"
|
||||
enabled: true
|
||||
- source: "@quartz-themes/core"
|
||||
enabled: false
|
||||
options:
|
||||
|
||||
@@ -107,8 +107,6 @@ plugins:
|
||||
- source: "@quartz-community/roam"
|
||||
enabled: false
|
||||
order: 92
|
||||
- source: "@quartz-community/quartz-fonts"
|
||||
enabled: true
|
||||
- source: "@quartz-themes/core"
|
||||
enabled: true
|
||||
options:
|
||||
|
||||
@@ -107,8 +107,6 @@ plugins:
|
||||
- source: "@quartz-community/roam"
|
||||
enabled: false
|
||||
order: 92
|
||||
- source: "@quartz-community/quartz-fonts"
|
||||
enabled: true
|
||||
- source: "@quartz-themes/core"
|
||||
enabled: true
|
||||
options:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import test, { describe } from "node:test"
|
||||
import { toHtml } from "hast-util-to-html"
|
||||
import assert from "node:assert"
|
||||
import { renderTranscludes, pageResources } from "./renderPage"
|
||||
import { renderTranscludes, pageResources, transformPageContent } from "./renderPage"
|
||||
import { Root, Element } from "hast"
|
||||
import { FullSlug } from "../util/path"
|
||||
import { GlobalConfiguration } from "../cfg"
|
||||
@@ -308,6 +309,62 @@ describe("renderTranscludes", () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe("transformPageContent (render-time transforms)", () => {
|
||||
const text = (root: Root) => toHtml(root)
|
||||
const target: Root = {
|
||||
type: "root",
|
||||
children: [
|
||||
{
|
||||
type: "element",
|
||||
tagName: "p",
|
||||
properties: {},
|
||||
children: [{ type: "text", value: "Target content" }],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
test("runs before, then transclusions, then treeTransforms, then after, on a copy", () => {
|
||||
const page: Root = { type: "root", children: [makeTranscludeBlockquote("target")] }
|
||||
const data = makeComponentData([makePageData("target", target)]) as QuartzComponentProps
|
||||
data.tree = page
|
||||
const seen: string[] = []
|
||||
const root = transformPageContent(cfg, "current" as FullSlug, data, {
|
||||
before: [(r) => seen.push(`before:${text(r).includes("Target content")}`)],
|
||||
treeTransforms: [(r) => seen.push(`tree:${text(r).includes("Target content")}`)],
|
||||
after: [
|
||||
(r) => {
|
||||
seen.push(`after:${text(r).includes("Target content")}`)
|
||||
r.children = [{ type: "text", value: "replaced" }]
|
||||
},
|
||||
],
|
||||
})
|
||||
assert.deepStrictEqual(seen, ["before:false", "tree:true", "after:true"])
|
||||
assert.strictEqual(text(root), "replaced")
|
||||
// the page's own tree is untouched
|
||||
assert.ok(text(page).includes("transclude"))
|
||||
})
|
||||
|
||||
test("a before transform can swap in content that then gets transclusions inlined", () => {
|
||||
const data = makeComponentData([makePageData("target", target)]) as QuartzComponentProps
|
||||
data.tree = { type: "root", children: [{ type: "text", value: "placeholder" }] } as Root
|
||||
const root = transformPageContent(cfg, "current" as FullSlug, data, {
|
||||
before: [(r) => (r.children = [makeTranscludeBlockquote("target")])],
|
||||
treeTransforms: [],
|
||||
after: [],
|
||||
})
|
||||
assert.ok(text(root).includes("Target content"))
|
||||
})
|
||||
|
||||
test("a plain list is the page types' treeTransforms", () => {
|
||||
const data = makeComponentData([]) as QuartzComponentProps
|
||||
data.tree = { type: "root", children: [] } as Root
|
||||
const root = transformPageContent(cfg, "current" as FullSlug, data, [
|
||||
(r) => r.children.push({ type: "text", value: "x" }),
|
||||
])
|
||||
assert.strictEqual(text(root), "x")
|
||||
})
|
||||
})
|
||||
|
||||
describe("pageResources", () => {
|
||||
const emptyResources: StaticResources = {
|
||||
css: [],
|
||||
|
||||
@@ -14,7 +14,8 @@ import { GlobalConfiguration, SidebarModes } from "../cfg"
|
||||
import { i18n } from "../i18n"
|
||||
import { styleText } from "util"
|
||||
import { resolveFrame } from "./frames"
|
||||
import type { TreeTransform } from "../plugins/types"
|
||||
import type { PageTreeTransforms, TreeTransform } from "../plugins/types"
|
||||
import { createIdScopes, scopeTranscludedIds, sliceWithFootnotes } from "./transcludeScope"
|
||||
import type { BuildCtx } from "../util/ctx"
|
||||
|
||||
interface RenderComponents {
|
||||
@@ -146,6 +147,9 @@ export function renderTranscludes(
|
||||
componentData: QuartzComponentProps,
|
||||
visited: Set<FullSlug>,
|
||||
) {
|
||||
// a prefix per transclusion, unique on the page, for the ids inside it
|
||||
const scopeFor = createIdScopes()
|
||||
|
||||
// Walk the tree manually instead of using visit() so we can track the
|
||||
// ancestor chain for cycle detection. visit() runs the callback before
|
||||
// descending into replaced children, so a Set-based guard there falsely
|
||||
@@ -157,13 +161,12 @@ export function renderTranscludes(
|
||||
if (child?.type !== "element") continue
|
||||
const el = child as Element
|
||||
|
||||
if (el.tagName !== "blockquote") {
|
||||
walk(el)
|
||||
continue
|
||||
}
|
||||
|
||||
// Transclusions are <div class="transclude"> (Quartz 5.2+; <blockquote> before).
|
||||
const classNames = (el.properties?.className ?? []) as string[]
|
||||
if (!classNames.includes("transclude")) {
|
||||
if (
|
||||
(el.tagName !== "div" && el.tagName !== "blockquote") ||
|
||||
!classNames.includes("transclude")
|
||||
) {
|
||||
walk(el)
|
||||
continue
|
||||
}
|
||||
@@ -266,8 +269,8 @@ export function renderTranscludes(
|
||||
}
|
||||
|
||||
el.children = [
|
||||
...(page.htmlAst.children.slice(startIdx, endIdx) as ElementContent[]).map((c) =>
|
||||
normalizeHastElement(c as Element, slug, transcludeTarget),
|
||||
...sliceWithFootnotes(page.htmlAst.children as ElementContent[], startIdx, endIdx).map(
|
||||
(c) => normalizeHastElement(c as Element, slug, transcludeTarget),
|
||||
),
|
||||
{
|
||||
type: "element",
|
||||
@@ -319,6 +322,8 @@ export function renderTranscludes(
|
||||
// Recurse into the replaced children to resolve nested transclusions,
|
||||
// then remove from visited so sibling embeds of the same target work.
|
||||
walk(el)
|
||||
// its ids (headings, footnotes) are unique on the page, and links inside it go to them
|
||||
scopeTranscludedIds(el, scopeFor(transcludeTarget), inner.properties?.href as string)
|
||||
visited.delete(transcludeTarget)
|
||||
}
|
||||
}
|
||||
@@ -326,26 +331,48 @@ export function renderTranscludes(
|
||||
walk(root)
|
||||
}
|
||||
|
||||
/**
|
||||
* A page's content as it is rendered: a copy of its tree with the transformers' `before`
|
||||
* transforms applied, transclusions inlined, then the page types' `treeTransforms` and the
|
||||
* transformers' `after` transforms applied.
|
||||
*/
|
||||
export function transformPageContent(
|
||||
cfg: GlobalConfiguration,
|
||||
slug: FullSlug,
|
||||
componentData: QuartzComponentProps,
|
||||
transforms?: TreeTransform[] | PageTreeTransforms,
|
||||
): Root {
|
||||
const { before, treeTransforms, after } = Array.isArray(transforms)
|
||||
? { before: [], treeTransforms: transforms, after: [] }
|
||||
: (transforms ?? { before: [], treeTransforms: [], after: [] })
|
||||
|
||||
// make a deep copy of the tree so we don't remove the transclusion references
|
||||
// for the file cached in contentMap in build.ts
|
||||
const root = clone(componentData.tree) as Root
|
||||
|
||||
// transformers' render-time transforms that need the content before it is filled in
|
||||
for (const transform of before) transform(root, slug, componentData)
|
||||
|
||||
const visited = new Set<FullSlug>([slug])
|
||||
renderTranscludes(root, cfg, slug, componentData, visited)
|
||||
|
||||
// Run plugin-provided tree transforms (e.g. resolving inline bases codeblocks)
|
||||
for (const transform of treeTransforms) transform(root, slug, componentData)
|
||||
|
||||
// transformers' render-time transforms of the finished content (e.g. encrypting it)
|
||||
for (const transform of after) transform(root, slug, componentData)
|
||||
return root
|
||||
}
|
||||
|
||||
export function renderPage(
|
||||
cfg: GlobalConfiguration,
|
||||
slug: FullSlug,
|
||||
componentData: QuartzComponentProps,
|
||||
components: RenderComponents,
|
||||
pageResources: StaticResources,
|
||||
treeTransforms?: TreeTransform[],
|
||||
transforms?: TreeTransform[] | PageTreeTransforms,
|
||||
): string {
|
||||
// make a deep copy of the tree so we don't remove the transclusion references
|
||||
// for the file cached in contentMap in build.ts
|
||||
const root = clone(componentData.tree) as Root
|
||||
const visited = new Set<FullSlug>([slug])
|
||||
renderTranscludes(root, cfg, slug, componentData, visited)
|
||||
|
||||
// Run plugin-provided tree transforms (e.g. resolving inline bases codeblocks)
|
||||
if (treeTransforms) {
|
||||
for (const transform of treeTransforms) {
|
||||
transform(root, slug, componentData)
|
||||
}
|
||||
}
|
||||
const root = transformPageContent(cfg, slug, componentData, transforms)
|
||||
|
||||
// set componentData.tree to the edited html that has transclusions rendered
|
||||
componentData.tree = root
|
||||
|
||||
@@ -71,9 +71,10 @@ async function mouseEnterHandler(
|
||||
|
||||
const popoverElement = document.createElement("div")
|
||||
popoverElement.id = popoverId
|
||||
popoverElement.classList.add("popover")
|
||||
// `hover-popover` / `markdown-embed` mirror Obsidian's popover markup so Obsidian themes apply.
|
||||
popoverElement.classList.add("popover", "hover-popover")
|
||||
const popoverInner = document.createElement("div")
|
||||
popoverInner.classList.add("popover-inner")
|
||||
popoverInner.classList.add("popover-inner", "markdown-embed")
|
||||
popoverInner.dataset.contentType = contentType ?? undefined
|
||||
popoverElement.appendChild(popoverInner)
|
||||
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
import test, { describe } from "node:test"
|
||||
import assert from "node:assert"
|
||||
import type { Element, ElementContent } from "hast"
|
||||
import { createIdScopes, scopeTranscludedIds, sliceWithFootnotes } from "./transcludeScope"
|
||||
|
||||
const h = (
|
||||
tagName: string,
|
||||
properties: Element["properties"] = {},
|
||||
children: ElementContent[] = [],
|
||||
): Element => ({ type: "element", tagName, properties, children })
|
||||
const text = (value: string): ElementContent => ({ type: "text", value })
|
||||
|
||||
describe("createIdScopes", () => {
|
||||
test("a prefix per transclusion, unique on the page", () => {
|
||||
const scope = createIdScopes()
|
||||
assert.strictEqual(scope("notes/Source"), "source--")
|
||||
assert.strictEqual(scope("notes/source"), "source-2--")
|
||||
assert.strictEqual(scope("other"), "other--")
|
||||
})
|
||||
})
|
||||
|
||||
describe("scopeTranscludedIds", () => {
|
||||
test("prefixes ids and the references to them inside the transclusion", () => {
|
||||
const el = h("div", { className: ["transclude"] }, [
|
||||
h("h2", { id: "details" }, [text("Details")]),
|
||||
h("p", {}, [
|
||||
h("a", { href: "#details" }, [text("jump")]),
|
||||
h("sup", {}, [
|
||||
h(
|
||||
"a",
|
||||
{
|
||||
href: "#user-content-fn-1",
|
||||
id: "user-content-fnref-1",
|
||||
dataFootnoteRef: "",
|
||||
ariaDescribedBy: ["footnote-label"],
|
||||
},
|
||||
[text("1")],
|
||||
),
|
||||
]),
|
||||
]),
|
||||
h("section", { dataFootnotes: "" }, [
|
||||
h("h2", { id: "footnote-label" }, [text("Footnotes")]),
|
||||
h("ol", {}, [
|
||||
h("li", { id: "user-content-fn-1" }, [
|
||||
h("a", { href: "#user-content-fnref-1" }, [text("↩")]),
|
||||
]),
|
||||
]),
|
||||
]),
|
||||
])
|
||||
scopeTranscludedIds(el, "source--", "./source")
|
||||
const [heading, para, section] = el.children as Element[]
|
||||
assert.strictEqual(heading!.properties.id, "source--details")
|
||||
const [jump, sup] = para!.children as Element[]
|
||||
assert.strictEqual(jump!.properties.href, "#source--details")
|
||||
const ref = (sup!.children[0] as Element).properties
|
||||
assert.strictEqual(ref.href, "#source--user-content-fn-1")
|
||||
assert.strictEqual(ref.id, "source--user-content-fnref-1")
|
||||
assert.deepStrictEqual(ref.ariaDescribedBy, ["source--footnote-label"])
|
||||
const li = (section!.children[1] as Element).children[0] as Element
|
||||
assert.strictEqual(li.properties.id, "source--user-content-fn-1")
|
||||
assert.strictEqual((li.children[0] as Element).properties.href, "#source--user-content-fnref-1")
|
||||
})
|
||||
|
||||
test("a same-page link whose target isn't in the transclusion goes to the transcluded page", () => {
|
||||
const el = h("div", {}, [h("a", { href: "#elsewhere" }, [text("x")])])
|
||||
scopeTranscludedIds(el, "source--", "./source#overview")
|
||||
assert.strictEqual((el.children[0] as Element).properties.href, "./source#elsewhere")
|
||||
})
|
||||
|
||||
test("leaves inline svg and math alone, and other links", () => {
|
||||
const el = h("div", {}, [
|
||||
h("svg", {}, [h("linearGradient", { id: "grad" }), h("rect", { fill: "url(#grad)" })]),
|
||||
h("a", { href: "./other#x" }, [text("x")]),
|
||||
])
|
||||
scopeTranscludedIds(el, "source--", "./source")
|
||||
const svg = el.children[0] as Element
|
||||
assert.strictEqual((svg.children[0] as Element).properties.id, "grad")
|
||||
assert.strictEqual((el.children[1] as Element).properties.href, "./other#x")
|
||||
})
|
||||
})
|
||||
|
||||
describe("sliceWithFootnotes", () => {
|
||||
const page: ElementContent[] = [
|
||||
h("h2", { id: "a" }, [text("A")]),
|
||||
h("p", {}, [h("a", { href: "#user-content-fn-2", dataFootnoteRef: "" }, [text("2")])]),
|
||||
h("h2", { id: "b" }, [text("B")]),
|
||||
h("p", {}, [h("a", { href: "#user-content-fn-1", dataFootnoteRef: "" }, [text("1")])]),
|
||||
h("section", { dataFootnotes: "", className: ["footnotes"] }, [
|
||||
h("ol", {}, [h("li", { id: "user-content-fn-1" }), h("li", { id: "user-content-fn-2" })]),
|
||||
]),
|
||||
]
|
||||
const footnoteIds = (nodes: ElementContent[]) =>
|
||||
nodes
|
||||
.filter((n): n is Element => n.type === "element" && n.tagName === "section")
|
||||
.flatMap((s) =>
|
||||
((s.children[0] as Element).children as Element[]).map((li) => li.properties.id),
|
||||
)
|
||||
|
||||
test("the last section gets only its own footnotes, not the whole footnotes section", () => {
|
||||
assert.deepStrictEqual(footnoteIds(sliceWithFootnotes(page, 2, undefined)), [
|
||||
"user-content-fn-1",
|
||||
])
|
||||
})
|
||||
|
||||
test("an earlier section gets its footnotes too", () => {
|
||||
const slice = sliceWithFootnotes(page, 0, 2)
|
||||
assert.strictEqual(slice.length, 3)
|
||||
assert.deepStrictEqual(footnoteIds(slice), ["user-content-fn-2"])
|
||||
})
|
||||
|
||||
test("a section without footnote references gets no footnotes section", () => {
|
||||
const plain = [h("h2", { id: "c" }), h("p"), page[4]!]
|
||||
assert.deepStrictEqual(footnoteIds(sliceWithFootnotes(plain, 0, undefined)), [])
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,138 @@
|
||||
import type { Element, ElementContent, Root } from "hast"
|
||||
|
||||
/**
|
||||
* Transcluded content is a copy of another page's HTML, ids included: two transclusions (or a
|
||||
* transclusion and its host) share heading ids and footnote ids (`user-content-fn-1`), so a
|
||||
* footnote reference or a `[[#Heading]]` link jumps to whichever element comes first on the page.
|
||||
* Obsidian resolves each embed on its own.
|
||||
*
|
||||
* {@link scopeTranscludedIds} gives the ids inside one transclusion a prefix, unique on the page,
|
||||
* and rewrites the references inside it to match. The host's ids stay as they are. A same-page
|
||||
* link (`#id`) whose target isn't in the transclusion (a heading slice that doesn't hold it) links
|
||||
* to the id on the transcluded page instead.
|
||||
*/
|
||||
|
||||
/** Space-separated id references (hast property names). */
|
||||
const ID_LIST_PROPERTIES = [
|
||||
"ariaDescribedBy",
|
||||
"ariaLabelledBy",
|
||||
"ariaControls",
|
||||
"ariaOwns",
|
||||
"ariaDetails",
|
||||
"ariaFlowTo",
|
||||
"htmlFor",
|
||||
"headers",
|
||||
] as const
|
||||
|
||||
/** Subtrees whose ids are referenced from inside them in ways we don't rewrite (`url(#id)`). */
|
||||
const OPAQUE = new Set(["svg", "math"])
|
||||
|
||||
function forEachElement(node: Element | Root, fn: (el: Element) => void) {
|
||||
for (const child of node.children) {
|
||||
if (child.type !== "element") continue
|
||||
fn(child)
|
||||
if (!OPAQUE.has(child.tagName)) forEachElement(child, fn)
|
||||
}
|
||||
}
|
||||
|
||||
/** Per page render: a prefix for each transclusion, unique on the page. */
|
||||
export function createIdScopes(): (target: string) => string {
|
||||
const used = new Map<string, number>()
|
||||
return (target) => {
|
||||
const base =
|
||||
(target.split("/").pop() ?? target)
|
||||
.toLowerCase()
|
||||
.replace(/[^a-z0-9-]+/g, "-")
|
||||
.replace(/^-+|-+$/g, "") || "transclude"
|
||||
const count = (used.get(base) ?? 0) + 1
|
||||
used.set(base, count)
|
||||
return count === 1 ? `${base}--` : `${base}-${count}--`
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prefixes the ids inside the transclusion `el` with `prefix` and rewrites references to them
|
||||
* inside it. `sourceHref` is the link to the transcluded page (relative to the host), for
|
||||
* same-page links whose target isn't in the transclusion.
|
||||
*/
|
||||
export function scopeTranscludedIds(el: Element, prefix: string, sourceHref?: string) {
|
||||
const ids = new Set<string>()
|
||||
forEachElement(el, (node) => {
|
||||
const id = node.properties?.id
|
||||
if (typeof id === "string" && id) ids.add(id)
|
||||
})
|
||||
|
||||
const pageHref = typeof sourceHref === "string" ? sourceHref.split("#")[0] : undefined
|
||||
const scoped = (id: string) => (ids.has(id) ? `${prefix}${id}` : id)
|
||||
|
||||
forEachElement(el, (node) => {
|
||||
const props = node.properties
|
||||
if (!props) return
|
||||
if (typeof props.id === "string" && ids.has(props.id)) props.id = `${prefix}${props.id}`
|
||||
|
||||
const href = props.href
|
||||
if (typeof href === "string" && href.startsWith("#") && href.length > 1) {
|
||||
let target = href.slice(1)
|
||||
try {
|
||||
target = decodeURIComponent(target)
|
||||
} catch {
|
||||
// keep as written
|
||||
}
|
||||
if (ids.has(target)) props.href = `#${prefix}${target}`
|
||||
else if (pageHref) props.href = `${pageHref}${href}`
|
||||
}
|
||||
|
||||
const record = props as Record<string, unknown>
|
||||
for (const name of ID_LIST_PROPERTIES) {
|
||||
const value = record[name]
|
||||
if (Array.isArray(value)) record[name] = value.map((token) => scoped(String(token)))
|
||||
else if (typeof value === "string") record[name] = value.split(/\s+/).map(scoped).join(" ")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function isFootnotesSection(node: ElementContent): node is Element {
|
||||
if (node.type !== "element" || node.tagName !== "section") return false
|
||||
const props = node.properties ?? {}
|
||||
const classes = (props.className ?? []) as string[]
|
||||
return props.dataFootnotes !== undefined || classes.includes("footnotes")
|
||||
}
|
||||
|
||||
/**
|
||||
* A heading transclusion: the slice of the page from the heading to the next one of the same or
|
||||
* a higher level. The page's footnotes section is not part of the section; the footnotes the
|
||||
* slice references are added after it (in a copy of the section holding only those).
|
||||
*/
|
||||
export function sliceWithFootnotes(
|
||||
pageChildren: ElementContent[],
|
||||
start: number,
|
||||
end: number | undefined,
|
||||
): ElementContent[] {
|
||||
const slice = pageChildren.slice(start, end).filter((node): boolean => !isFootnotesSection(node))
|
||||
const section = pageChildren.find(isFootnotesSection)
|
||||
if (!section) return slice
|
||||
|
||||
const referenced = new Set<string>()
|
||||
const collect = (node: Element | Root) =>
|
||||
forEachElement(node, (child) => {
|
||||
const href = child.properties?.href
|
||||
if (child.properties?.dataFootnoteRef !== undefined && typeof href === "string")
|
||||
referenced.add(href.replace(/^#/, ""))
|
||||
})
|
||||
for (const node of slice) if (node.type === "element") collect(node as Element)
|
||||
if (referenced.size === 0) return slice
|
||||
|
||||
const copy = structuredClone(section) as Element
|
||||
const keep = (list: Element) => {
|
||||
list.children = list.children.filter(
|
||||
(item) =>
|
||||
item.type !== "element" ||
|
||||
item.tagName !== "li" ||
|
||||
referenced.has(String(item.properties?.id ?? "")),
|
||||
)
|
||||
}
|
||||
forEachElement(copy, (node) => {
|
||||
if (node.tagName === "ol") keep(node)
|
||||
})
|
||||
return [...slice, copy]
|
||||
}
|
||||
@@ -14,6 +14,13 @@ import {
|
||||
readFrontmatterData,
|
||||
} from "./frontmatter"
|
||||
import { Links } from "./links"
|
||||
import {
|
||||
buildLayeredCSS,
|
||||
buildUnlayeredCSS,
|
||||
googleFontHref,
|
||||
resolveFontSpecs,
|
||||
resolveFonts,
|
||||
} from "./fonts"
|
||||
import { isContentError } from "../../util/pluginErrors"
|
||||
import { Drafts, isDraft } from "./drafts"
|
||||
import {
|
||||
@@ -407,6 +414,27 @@ describe("links built-in", () => {
|
||||
)
|
||||
})
|
||||
|
||||
test("pretty links shorten a link whose text is its percent-decoded href (#2643)", () => {
|
||||
const { els } = run(
|
||||
[
|
||||
a("Folder/Name%20With%20Space", "Folder/Name With Space"),
|
||||
a("Ordner/%C3%9Cbersicht", "Ordner/Übersicht"),
|
||||
a("Folder/Name%20With%20Space", "own text"),
|
||||
],
|
||||
"page",
|
||||
{ prettyLinks: true },
|
||||
)
|
||||
const links = els.filter((e) => e.tagName === "a")
|
||||
assert.deepStrictEqual(
|
||||
links.map((e) => (e.children[0] as Text).value),
|
||||
["Name With Space", "Übersicht", "own text"],
|
||||
)
|
||||
assert.deepStrictEqual(
|
||||
links.map((e) => (e.properties.className as string[]).includes("alias")),
|
||||
[false, false, true],
|
||||
)
|
||||
})
|
||||
|
||||
test("disableBrokenWikilinks adds a broken class to missing targets", () => {
|
||||
const { els } = run([a("missing")], "page", { disableBrokenWikilinks: true }, ["page"])
|
||||
assert.ok((els[0].properties.className as string[]).includes("broken"))
|
||||
@@ -576,3 +604,95 @@ describe("ctx.contentIndex", () => {
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe("fonts built-in", () => {
|
||||
test("absorbs a @quartz-community/quartz-fonts entry with its options", () => {
|
||||
const fonts = entry("@quartz-community/quartz-fonts", {
|
||||
options: { h1: "Lora", fontOrigin: "local" },
|
||||
})
|
||||
const p = plan([fonts])
|
||||
assert.strictEqual(byId(p, "fonts").enabled, true)
|
||||
assert.strictEqual(byId(p, "fonts").options.h1, "Lora")
|
||||
assert.strictEqual(byId(p, "fonts").options.fontOrigin, "local")
|
||||
assert.ok(p.absorbedEntries.has(fonts))
|
||||
})
|
||||
|
||||
test("a disabled plugin entry turns the built-in off", () => {
|
||||
const p = plan([entry("@quartz-community/quartz-fonts", { enabled: false })])
|
||||
assert.strictEqual(byId(p, "fonts").enabled, false)
|
||||
})
|
||||
|
||||
test("without a theme, configured heading fonts are forced and Obsidian's variables set", () => {
|
||||
delete (globalThis as Record<string, unknown>).__quartzFonts
|
||||
const opts = { header: "Lora" }
|
||||
const fonts = resolveFonts(opts, {})
|
||||
assert.match(buildLayeredCSS(fonts, opts, false), /--h1-font: Lora;/)
|
||||
assert.match(buildUnlayeredCSS(fonts, opts, false), /h1 \{ font-family: Lora; \}/)
|
||||
})
|
||||
|
||||
test("with a theme, its fonts are left alone unless configured explicitly", () => {
|
||||
;(globalThis as Record<string, unknown>).__quartzFonts = {
|
||||
themeName: "Minimal",
|
||||
fonts: { "--font-text": "Inter" },
|
||||
}
|
||||
try {
|
||||
const fonts = resolveFonts({}, {})
|
||||
assert.strictEqual(fonts.body, "Inter")
|
||||
assert.doesNotMatch(buildLayeredCSS(fonts, {}, true), /--h1-font|--font-text/)
|
||||
assert.strictEqual(buildUnlayeredCSS(fonts, {}, true), "")
|
||||
assert.match(
|
||||
buildUnlayeredCSS(resolveFonts({ h2: "Lora" }, {}), { h2: "Lora" }, true),
|
||||
/^h2 \{ font-family: Lora; \}$/,
|
||||
)
|
||||
} finally {
|
||||
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
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,430 @@
|
||||
import fs from "node:fs/promises"
|
||||
import path from "node:path"
|
||||
import { createRequire } from "node:module"
|
||||
import { h } from "preact"
|
||||
import { FontsConfig, FontSpecification } from "../../cfg"
|
||||
import { BuildCtx } from "../../util/ctx"
|
||||
import { FilePath, FullSlug, pathToRoot } from "../../util/path"
|
||||
import { CSSResource } from "../../util/resources"
|
||||
import { QuartzEmitterPlugin } from "../types"
|
||||
|
||||
/**
|
||||
* Built-in fonts (formerly `@quartz-community/quartz-fonts`).
|
||||
*
|
||||
* - Loads the configured fonts (`configuration.fonts`, falling back to
|
||||
* `configuration.theme.typography`) from Google Fonts, from the build output
|
||||
* (`fontOrigin: "selfHosted"`, downloaded at build time), or not at all (`"local"`).
|
||||
* - Sets Quartz's font variables, plus Obsidian's (`--font-text`, `--h1-font`, …) and
|
||||
* per-heading fonts.
|
||||
* - With a theme plugin that registers its fonts (`globalThis.__quartzFonts`, e.g.
|
||||
* @quartz-themes/core) the theme owns Obsidian's font variables and heading fonts: only roles
|
||||
* configured explicitly here override it.
|
||||
*/
|
||||
|
||||
const HEADING_LEVELS = ["h1", "h2", "h3", "h4", "h5", "h6"] as const
|
||||
type HeadingLevel = (typeof HEADING_LEVELS)[number]
|
||||
type FontRole = "title" | "header" | "body" | "code" | "interface"
|
||||
|
||||
export const SELF_HOSTED_STYLESHEET = "static/fonts/quartz-fonts.css"
|
||||
export const QUARTZ_DEFAULT_HEADER = "Schibsted Grotesk"
|
||||
export const QUARTZ_DEFAULT_BODY = "Source Sans Pro"
|
||||
export const QUARTZ_DEFAULT_CODE = "IBM Plex Mono"
|
||||
|
||||
const OBSIDIAN_SANS_STACK =
|
||||
'ui-sans-serif, -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, "Inter", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif'
|
||||
const OBSIDIAN_MONO_STACK =
|
||||
'ui-monospace, SFMono-Regular, "Cascadia Mono", "Roboto Mono", "DejaVu Sans Mono", "Liberation Mono", Menlo, Monaco, "Consolas", "Source Code Pro", monospace'
|
||||
|
||||
const DEFAULT_WEIGHTS: Record<FontRole, number[]> = {
|
||||
title: [400, 700],
|
||||
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. */
|
||||
export const fontsDefaults: Record<string, unknown> = {
|
||||
title: undefined,
|
||||
body: undefined,
|
||||
header: undefined,
|
||||
code: undefined,
|
||||
interface: undefined,
|
||||
h1: undefined,
|
||||
h2: undefined,
|
||||
h3: undefined,
|
||||
h4: undefined,
|
||||
h5: undefined,
|
||||
h6: undefined,
|
||||
useThemeFonts: true,
|
||||
fontOrigin: "googleFonts",
|
||||
}
|
||||
|
||||
// ---- font registry (theme plugins) -------------------------------------------
|
||||
|
||||
interface QuartzFontRegistry {
|
||||
themeName: string
|
||||
fonts: Record<string, string>
|
||||
}
|
||||
|
||||
function readFontRegistry(): QuartzFontRegistry | undefined {
|
||||
const registry = (globalThis as Record<string, unknown>).__quartzFonts
|
||||
if (registry && typeof registry === "object" && "themeName" in registry && "fonts" in registry) {
|
||||
return registry as QuartzFontRegistry
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
// ---- typography ----------------------------------------------------------------
|
||||
|
||||
interface ConfiguredTypography {
|
||||
title?: FontSpecification
|
||||
header?: FontSpecification
|
||||
body?: FontSpecification
|
||||
code?: FontSpecification
|
||||
}
|
||||
|
||||
const isFontSpecification = (value: unknown): value is FontSpecification =>
|
||||
(typeof value === "string" && value.trim().length > 0) ||
|
||||
(typeof value === "object" &&
|
||||
value !== null &&
|
||||
typeof (value as { name?: unknown }).name === "string")
|
||||
|
||||
export function readConfiguredTypography(ctx: BuildCtx | undefined): ConfiguredTypography {
|
||||
const typography = (ctx?.cfg?.configuration?.theme as { typography?: unknown } | undefined)
|
||||
?.typography
|
||||
if (typeof typography !== "object" || typography === null) return {}
|
||||
const result: ConfiguredTypography = {}
|
||||
for (const role of ["title", "header", "body", "code"] as const) {
|
||||
const spec = (typography as Record<string, unknown>)[role]
|
||||
if (isFontSpecification(spec)) result[role] = spec
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* 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,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
const fontName = (spec: FontSpecification) => (typeof spec === "string" ? spec : spec.name)
|
||||
|
||||
// ---- Google Fonts --------------------------------------------------------------
|
||||
|
||||
interface MergedFont {
|
||||
name: string
|
||||
weights: Set<number>
|
||||
italic: boolean
|
||||
}
|
||||
|
||||
function mergeInto(map: Map<string, MergedFont>, role: FontRole, spec: FontSpecification) {
|
||||
const { name, weights, includeItalic } = typeof spec === "string" ? { name: spec } : spec
|
||||
const resolvedWeights = weights ?? DEFAULT_WEIGHTS[role]
|
||||
const italic = includeItalic ?? DEFAULT_ITALIC[role]
|
||||
const existing = map.get(name)
|
||||
if (existing) {
|
||||
for (const w of resolvedWeights) existing.weights.add(w)
|
||||
if (italic) existing.italic = true
|
||||
} else {
|
||||
map.set(name, { name, weights: new Set(resolvedWeights), italic })
|
||||
}
|
||||
}
|
||||
|
||||
/** 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 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 defaultWeight ? entry.name : `${entry.name}:wght@${weights.join(";")}`
|
||||
}
|
||||
|
||||
export function googleFontHref(fonts: ReturnType<typeof resolveFontSpecs>): string {
|
||||
const merged = new Map<string, MergedFont>()
|
||||
mergeInto(merged, "header", fonts.header)
|
||||
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)}`)
|
||||
.join("&")
|
||||
return `https://fonts.googleapis.com/css2?${params}&display=swap`
|
||||
}
|
||||
|
||||
const fontMime: Record<string, string> = {
|
||||
truetype: "ttf",
|
||||
woff: "woff",
|
||||
woff2: "woff2",
|
||||
opentype: "otf",
|
||||
}
|
||||
const fontUrlPattern =
|
||||
/url\((https:\/\/fonts.gstatic.com\/.+(?:\/|(?:kit=))(.+?)[.&].+?)\)\sformat\('(\w+?)'\);/g
|
||||
|
||||
/** Rewrite Google Fonts URLs to files next to the stylesheet (works under any base path). */
|
||||
export function processGoogleFonts(stylesheet: string) {
|
||||
const fontFiles: { url: string; filename: string; extension: string }[] = []
|
||||
const processedStylesheet = stylesheet.replace(
|
||||
fontUrlPattern,
|
||||
(match, url: string, filename: string, format: string) => {
|
||||
const extension = fontMime[format] ?? format
|
||||
fontFiles.push({ url, filename, extension })
|
||||
return match.replace(url, `${filename}.${extension}`)
|
||||
},
|
||||
)
|
||||
return { processedStylesheet, fontFiles }
|
||||
}
|
||||
|
||||
/** Warn about fonts Google Fonts doesn't have, when `google-font-metadata` is installed. */
|
||||
function validate(options: FontsConfig) {
|
||||
let metadata: Record<string, { weights: number[]; styles: string[] }> | undefined
|
||||
try {
|
||||
metadata = createRequire(import.meta.url)("google-font-metadata").APIv1
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
const check = (role: string, spec: FontSpecification | undefined, fontRole: FontRole) => {
|
||||
if (!spec || !metadata) return
|
||||
const name = fontName(spec)
|
||||
const entry = metadata[name.toLowerCase().replace(/\s+/g, "-")]
|
||||
if (!entry) {
|
||||
console.warn(`[fonts] ${role}: "${name}" is not a recognized Google Font.`)
|
||||
return
|
||||
}
|
||||
const weights =
|
||||
typeof spec === "object" && spec.weights ? spec.weights : DEFAULT_WEIGHTS[fontRole]
|
||||
for (const w of weights)
|
||||
if (!entry.weights.includes(w))
|
||||
console.warn(`[fonts] ${role}: "${name}" does not support weight ${w}.`)
|
||||
}
|
||||
check("title", options.title, "title")
|
||||
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")
|
||||
}
|
||||
|
||||
// ---- CSS -------------------------------------------------------------------------
|
||||
|
||||
type ResolvedFonts = Record<
|
||||
"title" | "body" | "header" | "code" | "interface" | HeadingLevel,
|
||||
string
|
||||
>
|
||||
|
||||
export function resolveFonts(
|
||||
options: FontsConfig,
|
||||
typography: ConfiguredTypography,
|
||||
): ResolvedFonts {
|
||||
const registry = options.useThemeFonts !== false ? readFontRegistry() : undefined
|
||||
const theme = registry?.fonts ?? {}
|
||||
const pick = (spec: FontSpecification | undefined, ...fallbacks: (string | undefined)[]) =>
|
||||
spec !== undefined
|
||||
? fontName(spec)
|
||||
: (fallbacks.find((f) => f !== undefined) ?? OBSIDIAN_SANS_STACK)
|
||||
|
||||
const body = pick(
|
||||
options.body,
|
||||
theme["--font-text"],
|
||||
typography.body && fontName(typography.body),
|
||||
QUARTZ_DEFAULT_BODY,
|
||||
)
|
||||
const header = pick(
|
||||
options.header,
|
||||
theme["--font-text"],
|
||||
typography.header && fontName(typography.header),
|
||||
QUARTZ_DEFAULT_HEADER,
|
||||
)
|
||||
const code = pick(
|
||||
options.code,
|
||||
theme["--font-monospace"],
|
||||
typography.code && fontName(typography.code),
|
||||
QUARTZ_DEFAULT_CODE,
|
||||
OBSIDIAN_MONO_STACK,
|
||||
)
|
||||
const iface = pick(options.interface, theme["--font-interface"], OBSIDIAN_SANS_STACK)
|
||||
const title = pick(options.title, typography.title && fontName(typography.title), header)
|
||||
const heading = (level: HeadingLevel) =>
|
||||
options[level] !== undefined
|
||||
? fontName(options[level]!)
|
||||
: (theme[`--${level}-font`] ??
|
||||
(options.header !== undefined
|
||||
? fontName(options.header)
|
||||
: (theme["--font-text"] ?? header)))
|
||||
return {
|
||||
title,
|
||||
body,
|
||||
header,
|
||||
code,
|
||||
interface: iface,
|
||||
h1: heading("h1"),
|
||||
h2: heading("h2"),
|
||||
h3: heading("h3"),
|
||||
h4: heading("h4"),
|
||||
h5: heading("h5"),
|
||||
h6: heading("h6"),
|
||||
}
|
||||
}
|
||||
|
||||
const isExplicit = (options: FontsConfig, key: keyof FontsConfig) =>
|
||||
options[key] !== undefined ||
|
||||
((HEADING_LEVELS as readonly string[]).includes(key) && options.header !== undefined)
|
||||
|
||||
export function buildLayeredCSS(fonts: ResolvedFonts, options: FontsConfig, themeActive: boolean) {
|
||||
const obsidianVars: [string, string, keyof FontsConfig][] = [
|
||||
["--font-text", fonts.body, "body"],
|
||||
["--font-interface", fonts.interface, "interface"],
|
||||
["--font-monospace", fonts.code, "code"],
|
||||
...HEADING_LEVELS.map(
|
||||
(l) => [`--${l}-font`, fonts[l], l] as [string, string, keyof FontsConfig],
|
||||
),
|
||||
]
|
||||
return [
|
||||
"@layer quartz-fonts {",
|
||||
" :root {",
|
||||
` --titleFont: ${fonts.title};`,
|
||||
` --bodyFont: ${fonts.body};`,
|
||||
` --headerFont: ${fonts.header};`,
|
||||
` --codeFont: ${fonts.code};`,
|
||||
...obsidianVars
|
||||
.filter(([, , key]) => !themeActive || isExplicit(options, key))
|
||||
.map(([name, value]) => ` ${name}: ${value};`),
|
||||
" }",
|
||||
"}",
|
||||
].join("\n")
|
||||
}
|
||||
|
||||
/** 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,
|
||||
) {
|
||||
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 ------------------------------------------------------------------------
|
||||
|
||||
export const Fonts: QuartzEmitterPlugin<FontsConfig> = (userOpts) => {
|
||||
const options: FontsConfig = { ...fontsDefaults, ...userOpts }
|
||||
if (options.fontOrigin === "googleFonts") validate(options)
|
||||
|
||||
return {
|
||||
name: "Fonts",
|
||||
externalResources(ctx) {
|
||||
const typography = readConfiguredTypography(ctx)
|
||||
const fonts = resolveFonts(options, typography)
|
||||
const themeActive = options.useThemeFonts !== false && readFontRegistry() !== undefined
|
||||
const css: CSSResource[] = [
|
||||
{ content: buildLayeredCSS(fonts, options, themeActive), inline: true },
|
||||
]
|
||||
const unlayered = buildUnlayeredCSS(fonts, options, themeActive)
|
||||
if (unlayered) css.push({ content: unlayered, inline: true })
|
||||
|
||||
let additionalHead: unknown[] = []
|
||||
// Quartz's <Head> already links configuration.theme.typography from Google Fonts when
|
||||
// theme.cdnCaching is on; only add a link for fonts configured here on top of that.
|
||||
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", "interface", ...HEADING_LEVELS] as const
|
||||
).some((k) => options[k] !== undefined)
|
||||
if (options.fontOrigin === "googleFonts" && (!headLinksTypography || overridesTypography)) {
|
||||
const href = googleFontHref(resolveFontSpecs(options, typography))
|
||||
additionalHead = [
|
||||
h("link", { rel: "preconnect", href: "https://fonts.googleapis.com" }),
|
||||
h("link", {
|
||||
rel: "preconnect",
|
||||
href: "https://fonts.gstatic.com",
|
||||
crossOrigin: "anonymous",
|
||||
}),
|
||||
h("link", { rel: "stylesheet", href }),
|
||||
]
|
||||
} else if (options.fontOrigin === "selfHosted") {
|
||||
// Relative to the page so it works on localhost and under a base path (#2547).
|
||||
additionalHead = [
|
||||
(fileData: { slug?: string }) =>
|
||||
h("link", {
|
||||
rel: "stylesheet",
|
||||
href: `${pathToRoot((fileData?.slug ?? "index") as FullSlug)}/${SELF_HOSTED_STYLESHEET}`,
|
||||
}),
|
||||
]
|
||||
}
|
||||
return { css, js: [], additionalHead: additionalHead as never }
|
||||
},
|
||||
async emit(ctx) {
|
||||
if (options.fontOrigin !== "selfHosted") return []
|
||||
const href = googleFontHref(resolveFontSpecs(options, readConfiguredTypography(ctx)))
|
||||
const res = await fetch(href)
|
||||
if (!res.ok)
|
||||
throw new Error(`[fonts] Failed to fetch Google Fonts CSS: ${res.status} ${res.statusText}`)
|
||||
const { processedStylesheet, fontFiles } = processGoogleFonts(await res.text())
|
||||
const fontsDir = path.join(ctx.argv.output, "static", "fonts")
|
||||
await fs.mkdir(fontsDir, { recursive: true })
|
||||
const written: FilePath[] = []
|
||||
for (const file of fontFiles) {
|
||||
const r = await fetch(file.url)
|
||||
if (!r.ok)
|
||||
throw new Error(
|
||||
`[fonts] Failed to fetch font file: ${file.url} (${r.status} ${r.statusText})`,
|
||||
)
|
||||
const out = path.join(fontsDir, `${file.filename}.${file.extension}`)
|
||||
await fs.writeFile(out, Buffer.from(await r.arrayBuffer()))
|
||||
written.push(out as FilePath)
|
||||
}
|
||||
const cssPath = path.join(fontsDir, "quartz-fonts.css")
|
||||
await fs.writeFile(cssPath, processedStylesheet)
|
||||
written.push(cssPath as FilePath)
|
||||
return written
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
* | links | `configuration.links` | crawl-links |
|
||||
* | drafts | `configuration.drafts` | remove-draft |
|
||||
* | contentIndex | `configuration.contentIndex` | content-index |
|
||||
* | fonts | `configuration.fonts` | quartz-fonts |
|
||||
*
|
||||
* Each built-in:
|
||||
* - is configured under `configuration.<key>` and can be turned off with `enabled: false`;
|
||||
@@ -32,9 +33,10 @@ import { ContentIndex, contentIndexDefaults } from "./contentIndex"
|
||||
import { Drafts } from "./drafts"
|
||||
import { Frontmatter, frontmatterDefaults } from "./frontmatter"
|
||||
import { Links, legacyCrawlLinksDefaults, linksDefaults } from "./links"
|
||||
import { Fonts, fontsDefaults } from "./fonts"
|
||||
import { registerPluginOrigin } from "../../util/diagnostics"
|
||||
|
||||
export { ContentIndex, Drafts, Frontmatter, Links }
|
||||
export { ContentIndex, Drafts, Fonts, Frontmatter, Links }
|
||||
export {
|
||||
buildContentIndex,
|
||||
applyContentIndexExtensions,
|
||||
@@ -42,14 +44,14 @@ export {
|
||||
serializeContentIndex,
|
||||
} from "./contentIndex"
|
||||
|
||||
export type BuiltinId = "frontmatter" | "links" | "drafts" | "contentIndex"
|
||||
export type BuiltinId = "frontmatter" | "links" | "drafts" | "contentIndex" | "fonts"
|
||||
type BuiltinCategory = "transformer" | "filter" | "emitter"
|
||||
type BuiltinInstance =
|
||||
QuartzTransformerPluginInstance | QuartzFilterPluginInstance | QuartzEmitterPluginInstance
|
||||
|
||||
export interface BuiltinSpec {
|
||||
id: BuiltinId
|
||||
configKey: "frontmatter" | "links" | "drafts" | "contentIndex"
|
||||
configKey: "frontmatter" | "links" | "drafts" | "contentIndex" | "fonts"
|
||||
category: BuiltinCategory
|
||||
/** Position among plugins of the same category (same scale as plugin `defaultOrder`). */
|
||||
order: number
|
||||
@@ -129,6 +131,19 @@ export const BUILTINS: BuiltinSpec[] = [
|
||||
},
|
||||
create: (o) => ContentIndex(o),
|
||||
},
|
||||
{
|
||||
id: "fonts",
|
||||
configKey: "fonts",
|
||||
// An emitter: it provides the CSS/head links (externalResources) and, for
|
||||
// `fontOrigin: "selfHosted"`, writes the downloaded font files.
|
||||
category: "emitter",
|
||||
order: 60,
|
||||
defaults: fontsDefaults,
|
||||
absorbs: ["quartz-fonts", "fonts"],
|
||||
replacedBy: { files: ["static/fonts/quartz-fonts.css"] },
|
||||
capabilities: { provides: { files: ["static/fonts/quartz-fonts.css"] } },
|
||||
create: (o) => Fonts(o),
|
||||
},
|
||||
]
|
||||
|
||||
/** Short name of an official `quartz-community` plugin source, or undefined for anything else. */
|
||||
|
||||
@@ -50,6 +50,14 @@ const isAbsolute = isAbsoluteUrl as (url: string, options?: { httpOnly?: 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)
|
||||
// An href percent-decoded, to compare with link text; left as it is when it does not decode
|
||||
const decodedHref = (href: string) => {
|
||||
try {
|
||||
return decodeURI(href)
|
||||
} catch {
|
||||
return href
|
||||
}
|
||||
}
|
||||
|
||||
const EXTERNAL_ICON_PATH =
|
||||
"M320 0H288V64h32 82.7L201.4 265.4 178.7 288 224 333.3l22.6-22.6L448 109.3V192v32h64V192 32 0H480 320zM32 32H0V64 480v32H32 456h32V480 352 320H424v32 96H64V96h96 32V32H160 32z"
|
||||
@@ -131,12 +139,14 @@ export const Links: QuartzTransformerPlugin<LinksConfig> = (userOpts) => {
|
||||
})
|
||||
}
|
||||
|
||||
// link text differs from the href → it's an alias ("[[note|text]]")
|
||||
// link text differs from the href → it's an alias ("[[note|text]]"). The href is
|
||||
// percent-encoded by now ("a%20b" for "a b"), so it is compared decoded too (#2643)
|
||||
const firstChild = node.children[0]
|
||||
if (
|
||||
node.children.length === 1 &&
|
||||
firstChild?.type === "text" &&
|
||||
firstChild.value !== dest
|
||||
firstChild.value !== dest &&
|
||||
firstChild.value !== decodedHref(dest)
|
||||
) {
|
||||
classes.push("alias")
|
||||
}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import test, { describe, afterEach } from "node:test"
|
||||
import assert from "node:assert"
|
||||
import path from "path"
|
||||
import {
|
||||
buildLayoutForEntries,
|
||||
isExcluded,
|
||||
resolveConfigPath,
|
||||
resolveGroups,
|
||||
validateDependencies,
|
||||
detectCategoryFromModule,
|
||||
} from "./config-loader"
|
||||
import { planBuiltins } from "../builtins"
|
||||
import type { PluginManifest } from "./types"
|
||||
@@ -12,6 +15,23 @@ import { componentRegistry } from "../../components/registry"
|
||||
import type { QuartzComponent, QuartzComponentConstructor } from "../../components/types"
|
||||
import { PluginJsonEntry, LayoutPosition } from "./types"
|
||||
|
||||
describe("resolveConfigPath", () => {
|
||||
afterEach(() => {
|
||||
delete process.env.QUARTZ_CONFIG_PATH
|
||||
})
|
||||
|
||||
test("QUARTZ_CONFIG_PATH overrides the default lookup", () => {
|
||||
const custom = path.join("some", "dir", "quartz.config.yaml")
|
||||
process.env.QUARTZ_CONFIG_PATH = custom
|
||||
assert.strictEqual(resolveConfigPath(), path.resolve(custom))
|
||||
})
|
||||
|
||||
test("falls back to the cwd default when QUARTZ_CONFIG_PATH is unset", () => {
|
||||
delete process.env.QUARTZ_CONFIG_PATH
|
||||
assert.notStrictEqual(resolveConfigPath(), path.resolve("some", "dir", "quartz.config.yaml"))
|
||||
})
|
||||
})
|
||||
|
||||
const makeComponent = (name: string): QuartzComponent => {
|
||||
const c = (() => null) as unknown as QuartzComponent
|
||||
c.displayName = name
|
||||
@@ -389,3 +409,26 @@ describe("a dependency that is configured but disabled", () => {
|
||||
assert.match(warnings[0], /depends on "@quartz-community\/explorer" which is disabled/)
|
||||
})
|
||||
})
|
||||
|
||||
describe("async plugin factories", () => {
|
||||
test("category detection gives up on an async factory without an unhandled rejection", async () => {
|
||||
let rejected = false
|
||||
const factory = () =>
|
||||
Promise.reject(new Error("network")).catch((e) => {
|
||||
rejected = true
|
||||
throw e
|
||||
})
|
||||
// No manifest category and no static marker: detection must give up, not throw
|
||||
// or leave an unhandled rejection.
|
||||
assert.strictEqual(detectCategoryFromModule({ default: factory }), null)
|
||||
await new Promise((r) => setTimeout(r, 0))
|
||||
assert.strictEqual(rejected, true)
|
||||
})
|
||||
|
||||
test("a static category marker still wins for async factories", () => {
|
||||
const factory = Object.assign(async () => ({ name: "x", markdownPlugins: () => [] }), {
|
||||
quartzCategory: "transformer",
|
||||
})
|
||||
assert.strictEqual(detectCategoryFromModule({ default: factory }), "transformer")
|
||||
})
|
||||
})
|
||||
@@ -83,7 +83,9 @@ const DEFAULT_CONFIG_YAML_PATH = path.join(process.cwd(), "quartz.config.default
|
||||
const LEGACY_PLUGINS_JSON_PATH = path.join(process.cwd(), "quartz.plugins.json")
|
||||
const LEGACY_DEFAULT_PLUGINS_JSON_PATH = path.join(process.cwd(), "quartz.plugins.default.json")
|
||||
|
||||
function resolveConfigPath(): string {
|
||||
/** @internal Exported for testing only. Honors QUARTZ_CONFIG_PATH, else falls back to cwd. */
|
||||
export function resolveConfigPath(): string {
|
||||
if (process.env.QUARTZ_CONFIG_PATH) return path.resolve(process.env.QUARTZ_CONFIG_PATH)
|
||||
if (fs.existsSync(CONFIG_YAML_PATH)) return CONFIG_YAML_PATH
|
||||
if (fs.existsSync(LEGACY_PLUGINS_JSON_PATH)) return LEGACY_PLUGINS_JSON_PATH
|
||||
if (fs.existsSync(DEFAULT_CONFIG_YAML_PATH)) return DEFAULT_CONFIG_YAML_PATH
|
||||
@@ -678,7 +680,8 @@ export async function loadQuartzConfig(
|
||||
}
|
||||
const pluginOverrides = componentRegistry.getOptionOverrides(spec.name)
|
||||
const options = { ...manifest?.defaultOptions, ...entry.options, ...pluginOverrides }
|
||||
const instance = factory(Object.keys(options).length > 0 ? options : undefined)
|
||||
// Factories may be async (e.g. a plugin that fetches remote data before the build).
|
||||
const instance = await factory(Object.keys(options).length > 0 ? options : undefined)
|
||||
if (!instance || typeof instance !== "object") {
|
||||
pluginLoadFailed(
|
||||
entry,
|
||||
@@ -844,7 +847,11 @@ function validateCategory(
|
||||
return "shouldPublish" in instance
|
||||
case "transformer":
|
||||
return (
|
||||
"textTransform" in instance || "markdownPlugins" in instance || "htmlPlugins" in instance
|
||||
"textTransform" in instance ||
|
||||
"markdownPlugins" in instance ||
|
||||
"htmlPlugins" in instance ||
|
||||
"virtualPageHtmlPlugins" in instance ||
|
||||
"renderTransforms" in instance
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -897,7 +904,7 @@ function findFactory(
|
||||
return null
|
||||
}
|
||||
|
||||
function detectCategoryFromModule(module: unknown): ProcessingCategory | null {
|
||||
export function detectCategoryFromModule(module: unknown): ProcessingCategory | null {
|
||||
if (!module || typeof module !== "object") return null
|
||||
const mod = module as Record<string, unknown>
|
||||
|
||||
@@ -915,6 +922,12 @@ function detectCategoryFromModule(module: unknown): ProcessingCategory | null {
|
||||
if (typeof factory === "function") {
|
||||
try {
|
||||
const instance = factory()
|
||||
// An async factory can't be inspected without running it; such plugins must declare
|
||||
// their category in the manifest. Swallow its rejection so discovery has no side effects.
|
||||
if (instance instanceof Promise) {
|
||||
instance.catch(() => {})
|
||||
return null
|
||||
}
|
||||
if (instance && typeof instance === "object") {
|
||||
if ("match" in instance && "body" in instance && "layout" in instance) return "pageType"
|
||||
if ("emit" in instance) return "emitter"
|
||||
@@ -922,7 +935,9 @@ function detectCategoryFromModule(module: unknown): ProcessingCategory | null {
|
||||
if (
|
||||
"textTransform" in instance ||
|
||||
"markdownPlugins" in instance ||
|
||||
"htmlPlugins" in instance
|
||||
"htmlPlugins" in instance ||
|
||||
"virtualPageHtmlPlugins" in instance ||
|
||||
"renderTransforms" in instance
|
||||
)
|
||||
return "transformer"
|
||||
}
|
||||
|
||||
@@ -62,9 +62,13 @@ function detectPluginType(
|
||||
|
||||
const hasPageTypeProps = ["match", "body", "layout"].every((key) => key in mod)
|
||||
|
||||
const hasTransformerProps = ["textTransform", "markdownPlugins", "htmlPlugins"].some(
|
||||
(key) => key in mod && (typeof mod[key] === "function" || mod[key] === undefined),
|
||||
)
|
||||
const hasTransformerProps = [
|
||||
"textTransform",
|
||||
"markdownPlugins",
|
||||
"htmlPlugins",
|
||||
"virtualPageHtmlPlugins",
|
||||
"renderTransforms",
|
||||
].some((key) => key in mod && (typeof mod[key] === "function" || mod[key] === undefined))
|
||||
|
||||
const hasFilterProps = ["shouldPublish"].some(
|
||||
(key) => key in mod && typeof mod[key] === "function",
|
||||
|
||||
@@ -7,6 +7,7 @@ import type { PluginSource, QuartzPluginsJson } from "./types.js"
|
||||
import { absorbingBuiltin } from "../builtins/index.js"
|
||||
|
||||
function resolveConfigPath(): string {
|
||||
if (process.env.QUARTZ_CONFIG_PATH) return path.resolve(process.env.QUARTZ_CONFIG_PATH)
|
||||
const configYamlPath = path.join(process.cwd(), "quartz.config.yaml")
|
||||
const defaultConfigYamlPath = path.join(process.cwd(), "quartz.config.default.yaml")
|
||||
const legacyPluginsJsonPath = path.join(process.cwd(), "quartz.plugins.json")
|
||||
|
||||
@@ -5,6 +5,7 @@ import os from "os"
|
||||
import path from "path"
|
||||
import {
|
||||
collectComponents,
|
||||
collectTreeTransforms,
|
||||
folderTrie,
|
||||
generateVirtualPages,
|
||||
pageOutputPath,
|
||||
@@ -133,6 +134,33 @@ describe("resolveLayout frame resolution", () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe("collectTreeTransforms", () => {
|
||||
test("transformers' renderTransforms wrap the page types' treeTransforms, in plugin order", () => {
|
||||
const t = (name: string) => Object.assign(() => {}, { tname: name })
|
||||
const ctx = {
|
||||
cfg: {
|
||||
plugins: {
|
||||
transformers: [
|
||||
{
|
||||
name: "a",
|
||||
renderTransforms: () => ({ before: [t("a-before")], after: [t("a-after")] }),
|
||||
},
|
||||
{ name: "b", htmlPlugins: () => [] },
|
||||
{ name: "c", renderTransforms: () => ({ after: [t("c-after")] }) },
|
||||
],
|
||||
},
|
||||
},
|
||||
} as unknown as BuildCtx
|
||||
const result = collectTreeTransforms(ctx, [
|
||||
makePageType({ treeTransforms: () => [t("page") as never] }),
|
||||
])
|
||||
const names = (list: unknown[]) => list.map((f) => (f as { tname: string }).tname)
|
||||
assert.deepStrictEqual(names(result.before), ["a-before"])
|
||||
assert.deepStrictEqual(names(result.treeTransforms), ["page"])
|
||||
assert.deepStrictEqual(names(result.after), ["a-after", "c-after"])
|
||||
})
|
||||
})
|
||||
|
||||
describe("collectComponents", () => {
|
||||
test("collects all unique components across page types", () => {
|
||||
const pageTypes = [makePageType(), makePageType({ layout: "landing" })]
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import { QuartzEmitterPlugin, QuartzPageTypePluginInstance, TreeTransform } from "../types"
|
||||
import {
|
||||
PageTreeTransforms,
|
||||
QuartzEmitterPlugin,
|
||||
QuartzPageTypePluginInstance,
|
||||
TreeTransform,
|
||||
} from "../types"
|
||||
import { QuartzComponent, QuartzComponentProps } from "../../components/types"
|
||||
import { pageResources, renderPage } from "../../components/renderPage"
|
||||
import { FullPageLayout } from "../../cfg"
|
||||
@@ -86,6 +91,26 @@ interface DispatcherOptions {
|
||||
byPageType: Record<string, Partial<FullPageLayout>>
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal Exported for testing only.
|
||||
*
|
||||
* The render-time transforms of every page: the transformers' `renderTransforms` (`before` and
|
||||
* `after`, in plugin order) around the page types' `treeTransforms`.
|
||||
*/
|
||||
export function collectTreeTransforms(
|
||||
ctx: BuildCtx,
|
||||
pageTypes: { treeTransforms?: (ctx: BuildCtx) => TreeTransform[] }[],
|
||||
): PageTreeTransforms {
|
||||
const render = (ctx.cfg.plugins?.transformers ?? []).flatMap((transformer) =>
|
||||
transformer.renderTransforms ? [transformer.renderTransforms(ctx)] : [],
|
||||
)
|
||||
return {
|
||||
before: render.flatMap((transforms) => transforms.before ?? []),
|
||||
treeTransforms: pageTypes.flatMap((pt) => pt.treeTransforms?.(ctx) ?? []),
|
||||
after: render.flatMap((transforms) => transforms.after ?? []),
|
||||
}
|
||||
}
|
||||
|
||||
async function emitPage(
|
||||
ctx: BuildCtx,
|
||||
slug: FullSlug,
|
||||
@@ -94,7 +119,7 @@ async function emitPage(
|
||||
allFiles: ProcessedContent[1]["data"][],
|
||||
layout: FullPageLayout,
|
||||
resources: StaticResources,
|
||||
treeTransforms?: TreeTransform[],
|
||||
treeTransforms?: PageTreeTransforms,
|
||||
) {
|
||||
const cfg = ctx.cfg.configuration
|
||||
// For the 404 page, use an absolute base path so assets resolve correctly
|
||||
@@ -369,10 +394,8 @@ export const PageTypeDispatcher: QuartzEmitterPlugin<Partial<DispatcherOptions>>
|
||||
const cfg = ctx.cfg.configuration
|
||||
const allFiles = content.map((c) => c[1].data)
|
||||
|
||||
// Collect tree transforms from all page type plugins
|
||||
const treeTransforms: TreeTransform[] = pageTypes.flatMap(
|
||||
(pt) => pt.treeTransforms?.(ctx) ?? [],
|
||||
)
|
||||
// Collect render-time transforms: transformers' renderTransforms and page types' treeTransforms
|
||||
const treeTransforms = collectTreeTransforms(ctx, pageTypes)
|
||||
|
||||
// Ensure trie is available for components that need folder hierarchy (e.g. FolderContent)
|
||||
ctx.trie ??= trieFromAllFiles(allFiles)
|
||||
@@ -448,10 +471,8 @@ export const PageTypeDispatcher: QuartzEmitterPlugin<Partial<DispatcherOptions>>
|
||||
const cfg = ctx.cfg.configuration
|
||||
const allFiles = content.map((c) => c[1].data)
|
||||
|
||||
// Collect tree transforms from all page type plugins
|
||||
const treeTransforms: TreeTransform[] = pageTypes.flatMap(
|
||||
(pt) => pt.treeTransforms?.(ctx) ?? [],
|
||||
)
|
||||
// Collect render-time transforms: transformers' renderTransforms and page types' treeTransforms
|
||||
const treeTransforms = collectTreeTransforms(ctx, pageTypes)
|
||||
|
||||
// Rebuild trie on partial emit to reflect file changes
|
||||
ctx.trie = trieFromAllFiles(allFiles)
|
||||
|
||||
@@ -69,9 +69,35 @@ export type QuartzTransformerPluginInstance = PluginHooks & {
|
||||
* shows the resulting tree. `content` is the published content. Quartz 5.1+.
|
||||
*/
|
||||
virtualPageHtmlPlugins?: (ctx: BuildCtx, content: ProcessedContent[]) => PluggableList
|
||||
/**
|
||||
* Transforms of a page's content tree when the page is rendered, when the content of other
|
||||
* pages (and allFiles) is available. `before` runs before transclusions are inlined and page
|
||||
* types' `treeTransforms` run (e.g. bases are filled in), `after` runs on the finished content.
|
||||
* E.g. encrypted-pages swaps its page's content in `before` and encrypts the finished content in
|
||||
* `after`. Each transform gets the page's own tree (a copy), slug and component data.
|
||||
* Quartz 5.2+.
|
||||
*/
|
||||
renderTransforms?: (ctx: BuildCtx) => RenderTransforms
|
||||
externalResources?: ExternalResourcesFn
|
||||
}
|
||||
|
||||
/** A transformer's render-time transforms (see `renderTransforms`). */
|
||||
export interface RenderTransforms {
|
||||
before?: TreeTransform[]
|
||||
after?: TreeTransform[]
|
||||
}
|
||||
|
||||
/**
|
||||
* The transforms renderPage runs on a page's content, in order: the transformers' `before`, then
|
||||
* (after transclusions are inlined) the page types' `treeTransforms`, then the transformers'
|
||||
* `after`.
|
||||
*/
|
||||
export interface PageTreeTransforms {
|
||||
before: TreeTransform[]
|
||||
treeTransforms: TreeTransform[]
|
||||
after: TreeTransform[]
|
||||
}
|
||||
|
||||
export type QuartzFilterPlugin<Options extends OptionType = undefined> = (
|
||||
opts?: Options,
|
||||
) => QuartzFilterPluginInstance
|
||||
|
||||
@@ -13,7 +13,7 @@ import path from "path"
|
||||
import workerpool, { Promise as WorkerPromise } from "workerpool"
|
||||
import { QuartzLogger } from "../util/log"
|
||||
import { trace } from "../util/trace"
|
||||
import { BuildCtx, WorkerSerializableBuildCtx } from "../util/ctx"
|
||||
import { BuildCtx, workerCtx } from "../util/ctx"
|
||||
import { styleText } from "util"
|
||||
import {
|
||||
attributeError,
|
||||
@@ -206,14 +206,7 @@ export async function parseMarkdown(ctx: BuildCtx, fps: FilePath[]): Promise<Pro
|
||||
maxWorkers: concurrency,
|
||||
workerType: "thread",
|
||||
})
|
||||
const serializableCtx: WorkerSerializableBuildCtx = {
|
||||
buildId: ctx.buildId,
|
||||
argv: ctx.argv,
|
||||
allSlugs: ctx.allSlugs,
|
||||
allFiles: ctx.allFiles,
|
||||
incremental: ctx.incremental,
|
||||
virtualPages: [],
|
||||
}
|
||||
const serializableCtx = workerCtx(ctx)
|
||||
|
||||
try {
|
||||
const textToMarkdownPromises: WorkerPromise<MarkdownContent[]>[] = []
|
||||
|
||||
+15
-7
@@ -85,15 +85,16 @@ path[class~="typst-shape"] {
|
||||
}
|
||||
|
||||
article {
|
||||
// callouts are <div class="callout"> since obsidian-flavored-markdown 2.3, <blockquote> before
|
||||
> mjx-container.MathJax,
|
||||
blockquote > div > mjx-container.MathJax {
|
||||
:is(blockquote, .callout) > div > mjx-container.MathJax {
|
||||
display: flex;
|
||||
> svg {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
}
|
||||
blockquote > div > mjx-container.MathJax > svg {
|
||||
:is(blockquote, .callout) > div > mjx-container.MathJax > svg {
|
||||
margin-top: 1rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
@@ -263,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -354,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"
|
||||
@@ -362,7 +369,7 @@ a {
|
||||
"grid-footer";
|
||||
|
||||
@media all and ($tablet) {
|
||||
grid-template-columns: auto;
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
|
||||
& .center.full-width {
|
||||
@@ -373,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 {
|
||||
@@ -427,7 +434,8 @@ input[type="checkbox"] {
|
||||
}
|
||||
}
|
||||
|
||||
blockquote {
|
||||
blockquote,
|
||||
.transclude {
|
||||
margin: 1rem 0;
|
||||
border-left: 3px solid var(--secondary);
|
||||
padding-left: 1rem;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
@use "sass:color";
|
||||
|
||||
.callout {
|
||||
margin: 1rem 0;
|
||||
transition: border-color 0.2s ease;
|
||||
border: 1px solid var(--border);
|
||||
background-color: var(--bg);
|
||||
border-radius: 5px;
|
||||
@@ -159,6 +161,9 @@
|
||||
--callout-icon: var(--callout-icon-fold);
|
||||
}
|
||||
|
||||
// The title's text sits in .callout-title-inner, as in Obsidian; obsidian-flavored-markdown
|
||||
// before 2.3.1 wrapped it in a <p>
|
||||
& > .callout-title-inner,
|
||||
& > .callout-title-inner > p {
|
||||
color: var(--color);
|
||||
margin: 0;
|
||||
@@ -183,5 +188,7 @@
|
||||
|
||||
.callout-title-inner {
|
||||
font-weight: $semiBoldWeight;
|
||||
// the line height the title had as a <p>
|
||||
line-height: 1.6rem;
|
||||
}
|
||||
}
|
||||
@@ -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:
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
import { describe, test } from "node:test"
|
||||
import assert from "node:assert"
|
||||
import { BuildCtx, workerCtx } from "./ctx"
|
||||
import { FullSlug, FilePath } from "./path"
|
||||
|
||||
describe("workerCtx", () => {
|
||||
const ctx = {
|
||||
buildId: "b",
|
||||
argv: { directory: "content" },
|
||||
cfg: { configuration: {} },
|
||||
allSlugs: ["index", "elsewhere/moved"] as FullSlug[],
|
||||
allFiles: ["index.md", "Moved.md"] as FilePath[],
|
||||
permalinks: { "Moved.md": "elsewhere/moved" as FullSlug },
|
||||
incremental: false,
|
||||
virtualPages: [],
|
||||
trie: {},
|
||||
} as unknown as BuildCtx
|
||||
|
||||
test("carries permalinks to worker threads (#2644)", () => {
|
||||
assert.deepStrictEqual(workerCtx(ctx).permalinks, { "Moved.md": "elsewhere/moved" })
|
||||
})
|
||||
|
||||
test("holds plain data only, and survives structured cloning", () => {
|
||||
const worker = workerCtx(ctx)
|
||||
assert.ok(!("cfg" in worker) && !("trie" in worker))
|
||||
assert.deepStrictEqual(structuredClone(worker), worker)
|
||||
assert.deepStrictEqual(worker.virtualPages, [])
|
||||
})
|
||||
})
|
||||
@@ -86,3 +86,26 @@ export function trieFromAllFiles(allFiles: QuartzPluginData[]): FileTrieNode<Bui
|
||||
}
|
||||
|
||||
export type WorkerSerializableBuildCtx = Omit<BuildCtx, "cfg" | "trie">
|
||||
|
||||
/** The plain-data fields of {@link BuildCtx} that worker threads need, each one required. */
|
||||
type WorkerCtxFields = {
|
||||
[K in "buildId" | "argv" | "allSlugs" | "allFiles" | "permalinks" | "incremental"]-?: BuildCtx[K]
|
||||
}
|
||||
|
||||
/**
|
||||
* The build context passed to worker threads (structured-cloned): every plain-data field the
|
||||
* parse needs. Listing each field as required means a new one can't be forgotten here: worker
|
||||
* threads run for sites of 192 or more files, so a missing field (permalinks, #2644) only broke
|
||||
* large sites.
|
||||
*/
|
||||
export function workerCtx(ctx: BuildCtx): WorkerSerializableBuildCtx {
|
||||
const fields: WorkerCtxFields = {
|
||||
buildId: ctx.buildId,
|
||||
argv: ctx.argv,
|
||||
allSlugs: ctx.allSlugs,
|
||||
allFiles: ctx.allFiles,
|
||||
permalinks: ctx.permalinks ?? {},
|
||||
incremental: ctx.incremental,
|
||||
}
|
||||
return { ...fields, virtualPages: [] }
|
||||
}
|
||||
@@ -19,6 +19,25 @@ describe("permalinks (Obsidian Publish semantics)", () => {
|
||||
assert.strictEqual(normalizePermalink(2024), "2024")
|
||||
})
|
||||
|
||||
test("collectPermalinks ignores permalinks with a . or .. segment", () => {
|
||||
const fm: Record<string, unknown> = {
|
||||
"a.md": "../escaped",
|
||||
"b.md": "x/../../escaped",
|
||||
"c.md": "./c",
|
||||
"d.md": "/../../d/",
|
||||
"e.md": "..\\..\\e",
|
||||
"f.md": "fine..name/ok",
|
||||
}
|
||||
const warnings: string[] = []
|
||||
const permalinks = collectPermalinks({
|
||||
files: Object.keys(fm),
|
||||
permalinkOf: (f) => fm[f],
|
||||
warn: (m) => warnings.push(m),
|
||||
})
|
||||
assert.deepStrictEqual(permalinks, { "f.md": "fine..name/ok" })
|
||||
assert.strictEqual(warnings.length, 5)
|
||||
})
|
||||
|
||||
test("collectPermalinks maps files to their permalink; the address can't be taken twice", () => {
|
||||
const fm: Record<string, unknown> = {
|
||||
"folder/note.md": "page",
|
||||
|
||||
@@ -46,6 +46,11 @@ export function collectPermalinks({
|
||||
for (const file of files) {
|
||||
const slug = normalizePermalink(permalinkOf(file))
|
||||
if (!slug) continue
|
||||
if (slug.split("/").some((segment) => segment === "." || segment === "..")) {
|
||||
// a "." or ".." segment would be written outside the output directory (../x.html)
|
||||
warn(`${file}: permalink "${slug}" contains a "." or ".." segment and is ignored.`)
|
||||
continue
|
||||
}
|
||||
const own = slugifyFilePath(file as FilePath)
|
||||
if (slug === own) continue // the note's own path: nothing to do
|
||||
const owner = pathSlugs.get(slug) ?? taken.get(slug)
|
||||
|
||||
Reference in new issue
Block a user