mirror of
https://github.com/jackyzha0/quartz
synced 2026-11-27 22:14:40 +01:00
docs: Quartz 5.1 — upgrade notes, what's new, plugin manifest reference, plugin development, CLI, configuration, features and plugin pages
Audit of the docs against 5.1 (release notes, core source, plugins) and fixes: - getting-started: 5.0 → 5.1 upgrade section (plugin doctor --fix, line breaks, heading ids, Bases 1.2, permalinks, frontmatter, CI, GFM before OFM), New in 5.1, git pull upstream v5, no redundant install steps - advanced: new plugin manifest reference (dependencies, defaultOrder, configSchema/optionSchema, deprecated, components…), making plugins (BuildCtx, emitters, page types, peer dependencies, imports), creating components (./components subpath, script loading, render/prefetch contract), capabilities, architecture, paths - cli: --directory is the content folder; build/sync flags and behaviour (sync force-pushes); plugin add from npm - configuration, layout, features and plugin pages: nested colors, built-ins, wikilinks/heading anchors, Obsidian compatibility (OFM 2.0), correct defaults and options, Bases 1.2, stacked pages, og-image v5 API; new pages for Excalidraw, TTRPG maps and themes
This commit is contained in:
103 files changed
+1781
-873
No files matched your search
@@ -21,30 +21,34 @@ This question is best answered by tracing what happens when a user (you!) runs `
|
||||
4. In `build.ts`, we start by installing source map support manually to account for the query string cache busting hack we introduced earlier. Then, we start processing content:
|
||||
1. Clean the output directory.
|
||||
2. Recursively glob all files in the `content` folder, respecting the `.gitignore`.
|
||||
3. Parse the Markdown files.
|
||||
3. Collect every page's slug (`ctx.allSlugs`), taking frontmatter `permalink`s into account, so links can be resolved while parsing.
|
||||
4. Parse the Markdown files.
|
||||
1. Quartz detects the number of threads available and chooses to spawn worker threads if there are >128 pieces of content to parse (rough heuristic). If it needs to spawn workers, it will invoke esbuild again to transpile the worker script `quartz/worker.ts`. Then, a work-stealing [workerpool](https://www.npmjs.com/package/workerpool) is then created and batches of 128 files are assigned to workers.
|
||||
2. Each worker (or just the main thread if there is no concurrency) creates a [unified](https://github.com/unifiedjs/unified) parser based off of the plugins defined in the [[configuration]].
|
||||
3. Parsing has three steps:
|
||||
3. Parsing has these steps:
|
||||
1. Read the file into a [vfile](https://github.com/vfile/vfile).
|
||||
2. Applied plugin-defined text transformations over the content.
|
||||
3. Slugify the file path and store it in the data for the file. See the page on [[paths]] for more details about how path logic works in Quartz (spoiler: its complicated).
|
||||
3. Slugify the file path (or use its `permalink`) and store it in the data for the file. See the page on [[paths]] for more details about how path logic works in Quartz (spoiler: its complicated).
|
||||
4. Markdown parsing using [remark-parse](https://www.npmjs.com/package/remark-parse) (text to [mdast](https://github.com/syntax-tree/mdast)).
|
||||
5. Apply plugin-defined Markdown-to-Markdown transformations.
|
||||
5. Apply the transformers' Markdown-to-Markdown transformations, in plugin order. The [[built-in processing|built-in]] frontmatter parsing runs among them at order 0 and sets `file.data.frontmatter`.
|
||||
6. Convert Markdown into HTML using [remark-rehype](https://github.com/remarkjs/remark-rehype) ([mdast](https://github.com/syntax-tree/mdast) to [hast](https://github.com/syntax-tree/hast)).
|
||||
7. Apply plugin-defined HTML-to-HTML transformations.
|
||||
4. Filter out unwanted content using plugins.
|
||||
5. Emit files using plugins.
|
||||
1. Gather all the static resources (e.g. external CSS, JS modules, etc.) each emitter plugin declares.
|
||||
2. Emitters that emit HTML files do a bit of extra work here as they need to transform the [hast](https://github.com/syntax-tree/hast) produced in the parse step to JSX. This is done using [hast-util-to-jsx-runtime](https://github.com/syntax-tree/hast-util-to-jsx-runtime) with the [Preact](https://preactjs.com/) runtime. Finally, the JSX is rendered to HTML using [preact-render-to-string](https://github.com/preactjs/preact-render-to-string) which statically renders the JSX to HTML (i.e. doesn't care about `useState`, `useEffect`, or any other React/Preact interactive bits). Here, we also do a bunch of fun stuff like assemble the page [[layout]] from `quartz.config.yaml`, assemble all the inline scripts that actually get shipped to the client, and all the transpiled styles. The bulk of this logic can be found in `quartz/components/renderPage.tsx`. Other fun things of note:
|
||||
1. CSS is minified and transformed using [Lightning CSS](https://github.com/parcel-bundler/lightningcss) to add vendor prefixes and do syntax lowering.
|
||||
7. Apply the transformers' HTML-to-HTML transformations, in plugin order. The built-in link processing runs among them at order 60: it rewrites internal links and records `file.data.links`.
|
||||
5. Filter out unwanted content using filter plugins and the built-in drafts filter.
|
||||
6. Emit files using emitters, in three phases (`quartz/processors/emit.ts`):
|
||||
1. Gather all the static resources (e.g. external CSS, JS modules, etc.) that transformers and emitters declare. The `ComponentResources` emitter runs first and writes the site's CSS and scripts:
|
||||
1. CSS is minified and transformed using [Lightning CSS](https://github.com/parcel-bundler/lightningcss) to add vendor prefixes and do syntax lowering. Quartz's and the components' styles are put in the `quartz-base` cascade layer.
|
||||
2. Scripts are split into `beforeDOMLoaded` and `afterDOMLoaded` and are inserted in the `<head>` and `<body>` respectively.
|
||||
3. Finally, each emitter plugin is responsible for emitting and writing it's own emitted files to disk.
|
||||
6. 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.
|
||||
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. 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.
|
||||
|
||||
## On the client
|
||||
|
||||
1. The browser opens a Quartz page and loads the HTML. The `<head>` also links to page styles (emitted to `public/index.css`) and page-critical JS (emitted to `public/prescript.js`)
|
||||
2. Then, once the body is loaded, the browser loads the non-critical JS (emitted to `public/postscript.js`)
|
||||
1. The browser opens a Quartz page and loads the HTML. The `<head>` also links to page styles (emitted to `public/index-<hash>.css`, plus a file per component stylesheet) and page-critical JS (emitted to `public/prescript-<hash>.js`). With `--serve`, the names have no hash.
|
||||
2. Then, once the body is loaded, the browser loads the non-critical JS (`public/postscript-<hash>.js`). In a production build it imports each component's `afterDOMLoaded` script (`static/scripts/`) in parallel, then the SPA router; with `--serve` it holds all of them.
|
||||
3. Once the page is done loading, the page will then dispatch a custom synthetic browser event `"nav"`. This is used so client-side scripts declared by components can 'setup' anything that requires access to the page DOM.
|
||||
1. If the [[SPA Routing|enableSPA option]] is enabled in the [[configuration]], this `"nav"` event is also fired on any client-navigation to allow for components to unregister and reregister any event handlers and state.
|
||||
2. If it's not, we wire up the `"nav"` event to just be fired a single time after page load to allow for consistency across how state is setup across both SPA and non-SPA contexts.
|
||||
@@ -72,36 +76,38 @@ Plugins should import types from `@quartz-community/types`, utility functions fr
|
||||
|
||||
## Plugin System
|
||||
|
||||
Page types define how a category of pages is rendered. They are configured in the `pageTypes` array in `quartz.config.yaml`.
|
||||
|
||||
Quartz v5 introduces a community plugin system. Plugins are standalone Git repositories that are cloned into `.quartz/plugins/` and re-exported through an auto-generated index file at `.quartz/plugins/index.ts`.
|
||||
Quartz v5 introduces a community plugin system. Plugins are standalone packages: the default plugins are npm packages (dependencies of Quartz, installed in `node_modules`), other plugins can also be Git repositories or local folders, which are installed into `.quartz/plugins/`. Their named exports are re-exported through an auto-generated index file at `.quartz/plugins/index.ts`, which you import in a `quartz.ts` override as `ExternalPlugin`.
|
||||
|
||||
### Plugin Types
|
||||
|
||||
There are now four plugin categories:
|
||||
There are four processing plugin categories, plus Bases views:
|
||||
|
||||
- **Transformers**: Map over content (parse frontmatter, generate descriptions, syntax highlighting)
|
||||
- **Filters**: Filter content (remove drafts, explicit publish)
|
||||
- **Transformers**: Map over content (generate descriptions, syntax highlighting, Obsidian syntax)
|
||||
- **Filters**: Filter content (explicit publish, unlisted pages)
|
||||
- **Emitters**: Reduce over content (generate RSS, sitemaps, alias redirects, OG images)
|
||||
- **Page Types**: Define how pages are rendered. Each page type handles a specific kind of page (content notes, folder listings, tag listings, 404). The `PageTypeDispatcher` emitter routes pages to the appropriate page type plugin based on the content.
|
||||
- **Page Types**: Define how pages are rendered. Each page type handles a specific kind of page (content notes, folder listings, tag listings, 404). Page types are ordinary entries in the `plugins` list of `quartz.config.yaml` whose manifest has the category `pageType`. The `PageTypeDispatcher` emitter routes pages to the appropriate page type plugin based on the content.
|
||||
- **Bases Views**: Custom view renderers for the `bases-page` plugin's database-like view system. Plugins can register new view types (e.g., timeline, kanban) via the `ViewRegistry`. See [[making plugins#Bases Views]] for details.
|
||||
|
||||
Note that plugin types are **not mutually exclusive** — a single plugin can be a transformer AND provide components (e.g., `obsidian-flavored-markdown`), or be a page type AND provide custom frames (e.g., `canvas-page`).
|
||||
Frontmatter parsing, link processing, drafts and the content index are not plugins but [[built-in processing]].
|
||||
|
||||
Plugins can also provide components and frames. These roles are **not mutually exclusive** — a single plugin can be a transformer AND provide components (e.g., `table-of-contents`), or be a page type AND provide custom frames (e.g., `canvas-page`).
|
||||
|
||||
### Plugin Resolution
|
||||
|
||||
When `npx quartz plugin add github:quartz-community/explorer` is run:
|
||||
When a Git plugin is installed, e.g. with `npx quartz plugin add github:your-name/my-plugin`:
|
||||
|
||||
1. The repository is cloned into `.quartz/plugins/explorer/`
|
||||
2. The plugin is built using `tsup` (defined in each plugin's `tsup.config.ts`)
|
||||
1. The repository is cloned into `.quartz/plugins/my-plugin/`
|
||||
2. If it ships a pre-built `dist/` (not gitignored), that is used as is and only its peer dependencies are linked to the site's `node_modules`. Otherwise its dependencies are installed and it is built using `tsup` (defined in the plugin's `tsup.config.ts`)
|
||||
3. An auto-generated `.quartz/plugins/index.ts` re-exports all installed plugins
|
||||
4. The plugin's commit hash is recorded in `quartz.lock.json`
|
||||
|
||||
npm plugins (such as the default `@quartz-community/explorer`) are imported from `node_modules` and are not cloned or built.
|
||||
|
||||
### Plugin CLI Commands
|
||||
|
||||
- `npx quartz plugin add github:quartz-community/<name>` — Install a community plugin
|
||||
- `npx quartz plugin install --latest` — Update all plugins to latest commits
|
||||
- `npx quartz plugin install --clean` — Restore plugins from locked commits in `quartz.lock.json` (used in CI/CD)
|
||||
- `npx quartz plugin install` — Install plugins at the commits locked in `quartz.lock.json` (used in CI/CD); `--clean` only restores plugins whose directory is missing
|
||||
- `npx quartz plugin remove <name>` — Remove an installed plugin
|
||||
|
||||
### Plugin Structure
|
||||
@@ -110,7 +116,7 @@ Each community plugin repository contains:
|
||||
|
||||
- `src/index.ts` — Plugin entry point exporting the plugin function
|
||||
- `tsup.config.ts` — Build configuration using tsup
|
||||
- `package.json` — Declares dependencies on `@quartz-community/types` and `@quartz-community/utils`
|
||||
- `package.json` — Declares dependencies on `@quartz-community/types` and `@quartz-community/utils`, and the [[plugin manifest]] in its `quartz` field
|
||||
|
||||
The architecture and design of the plugin system was intentionally left pretty vague here as this is described in much more depth in the guide on [[making plugins|creating plugins]].
|
||||
|
||||
|
||||
@@ -36,35 +36,67 @@ npm install
|
||||
|
||||
### Plugin Structure
|
||||
|
||||
A component plugin's `src/index.ts` typically exports a function (a constructor) that returns a `QuartzComponent`. This allows users to pass configuration options to your component.
|
||||
A component is a constructor: a function that takes the user's options and returns a `QuartzComponent`. Put it in `src/components/`:
|
||||
|
||||
```tsx title="src/index.ts"
|
||||
import {
|
||||
QuartzComponent,
|
||||
QuartzComponentConstructor,
|
||||
QuartzComponentProps,
|
||||
} from "@quartz-community/types"
|
||||
```tsx title="src/components/MyComponent.tsx"
|
||||
import type { QuartzComponent, QuartzComponentConstructor } from "@quartz-community/types"
|
||||
|
||||
interface Options {
|
||||
export interface MyComponentOptions {
|
||||
favouriteNumber: number
|
||||
}
|
||||
|
||||
const defaultOptions: Options = {
|
||||
const defaultOptions: MyComponentOptions = {
|
||||
favouriteNumber: 42,
|
||||
}
|
||||
|
||||
const MyComponent: QuartzComponentConstructor<Options> = (userOpts?: Options) => {
|
||||
export default ((userOpts?: Partial<MyComponentOptions>) => {
|
||||
const opts = { ...defaultOptions, ...userOpts }
|
||||
|
||||
const Component: QuartzComponent = (props: QuartzComponentProps) => {
|
||||
const Component: QuartzComponent = () => {
|
||||
if (opts.favouriteNumber < 0) return null
|
||||
return <p>My favourite number is {opts.favouriteNumber}</p>
|
||||
return <p class="my-component">My favourite number is {opts.favouriteNumber}</p>
|
||||
}
|
||||
|
||||
return Component
|
||||
}
|
||||
}) satisfies QuartzComponentConstructor<Partial<MyComponentOptions>>
|
||||
```
|
||||
|
||||
export default MyComponent
|
||||
Quartz loads components from the package's **`./components`** export, by the names listed in the manifest — not from the entry module, and not from a `default` export:
|
||||
|
||||
```ts title="src/components/index.ts"
|
||||
export { default as MyComponent } from "./MyComponent"
|
||||
export type { MyComponentOptions } from "./MyComponent"
|
||||
```
|
||||
|
||||
```json title="package.json"
|
||||
{
|
||||
"exports": {
|
||||
".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" },
|
||||
"./components": {
|
||||
"types": "./dist/components/index.d.ts",
|
||||
"import": "./dist/components/index.js"
|
||||
}
|
||||
},
|
||||
"quartz": {
|
||||
"category": "component",
|
||||
"components": {
|
||||
"MyComponent": {
|
||||
"displayName": "My Component",
|
||||
"defaultPosition": "right",
|
||||
"defaultPriority": 50
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The key in `quartz.components` must match the export name in `src/components/index.ts`; `defaultPosition` and `defaultPriority` place the component when the user's config doesn't (see [[plugin manifest#components]]). The plugin template's `tsup.config.ts` already builds the `components/index` entry.
|
||||
|
||||
Also re-export the constructor by name from the entry module, so users can call it in `quartz.ts` overrides (`ExternalPlugin.MyComponent(…)`, see [[#Installing Your Component]]). The generated `.quartz/plugins/index.ts` re-exports your entry module's named exports; `default` exports are left out.
|
||||
|
||||
```ts title="src/index.ts"
|
||||
export { MyComponent } from "./components"
|
||||
export type { MyComponentOptions } from "./components"
|
||||
```
|
||||
|
||||
### Props
|
||||
@@ -73,20 +105,27 @@ All Quartz components accept the same set of props:
|
||||
|
||||
```tsx
|
||||
export type QuartzComponentProps = {
|
||||
fileData: QuartzPluginData
|
||||
ctx: unknown
|
||||
externalResources: StaticResources
|
||||
fileData: QuartzPluginData & Record<string, unknown>
|
||||
cfg: GlobalConfiguration
|
||||
tree: Node<QuartzPluginData>
|
||||
allFiles: QuartzPluginData[]
|
||||
children: unknown
|
||||
tree: unknown
|
||||
allFiles: (QuartzPluginData & Record<string, unknown>)[]
|
||||
displayClass?: "mobile-only" | "desktop-only"
|
||||
[key: string]: unknown
|
||||
}
|
||||
```
|
||||
|
||||
- `ctx`: the [[making plugins|`BuildCtx`]] of the build (typed `unknown`; cast it to `BuildCtx` to read it).
|
||||
- `externalResources`: the page's CSS, scripts and head elements.
|
||||
- `fileData`: Any metadata plugins may have added to the current page.
|
||||
- `fileData.slug`: slug of the current page.
|
||||
- `fileData.frontmatter`: any frontmatter parsed.
|
||||
- `cfg`: The `configuration` field in `quartz.config.yaml`.
|
||||
- `tree`: the resulting [HTML AST](https://github.com/syntax-tree/hast) after processing and transforming the file.
|
||||
- `allFiles`: Metadata for all files that have been parsed. Useful for doing page listings or figuring out the overall site structure.
|
||||
- `children`: child components, for components that wrap others (e.g. `Flex`).
|
||||
- `tree`: the resulting [HTML AST](https://github.com/syntax-tree/hast) (a hast `Root`) after processing and transforming the file.
|
||||
- `allFiles`: Metadata for all published pages, virtual pages included. Useful for doing page listings or figuring out the overall site structure.
|
||||
- `displayClass`: a utility class that indicates a preference from the user about how to render it in a mobile or desktop setting.
|
||||
|
||||
### Styling
|
||||
@@ -109,6 +148,8 @@ Component.css = styles
|
||||
> [!warning]
|
||||
> Quartz does not use CSS modules so any styles you declare here apply _globally_. If you only want it to apply to your component, make sure you use specific class names and selectors.
|
||||
|
||||
Quartz puts component CSS in the `quartz-base` [cascade layer](https://developer.mozilla.org/en-US/docs/Web/CSS/@layer), like its own base styles, so a site's `custom.scss` (unlayered) overrides it without needing more specific selectors.
|
||||
|
||||
#### Source attributes
|
||||
|
||||
When Quartz renders a component provided by a plugin, it adds two attributes to the component's root element:
|
||||
@@ -140,9 +181,16 @@ Always provide at least an `en-US` locale as the fallback. Additional locales ar
|
||||
|
||||
For interactivity, you can declare `.beforeDOMLoaded` and `.afterDOMLoaded` properties on the component. These should be strings containing the JavaScript to be executed in the browser.
|
||||
|
||||
- `.beforeDOMLoaded`: Executed _before_ the page is done loading. Used for prefetching or early initialization.
|
||||
- `.beforeDOMLoaded`: Executed _before_ the page is done loading (from `<head>`), for early initialization such as applying a saved theme before the page is painted.
|
||||
- `.afterDOMLoaded`: Executed once the page has been completely loaded.
|
||||
|
||||
Each script runs once per full page load, not on every SPA navigation. Don't rely on scripts sharing a scope or running in a particular order:
|
||||
|
||||
- In a production build, each `afterDOMLoaded` script is a separate ES module, and all of them are imported in parallel; only the SPA router (which dispatches the first `nav`) is imported after them.
|
||||
- In `quartz build --serve`, all `afterDOMLoaded` scripts are bundled into one file, each wrapped in its own function.
|
||||
|
||||
Share state between components through `window` or DOM attributes, and do page setup in a `nav` listener rather than at the top level.
|
||||
|
||||
If you need to create an `afterDOMLoaded` script that depends on page-specific elements that may change when navigating, listen for the `"nav"` event:
|
||||
|
||||
```ts
|
||||
@@ -175,6 +223,42 @@ document.addEventListener("render", setupMyComponent)
|
||||
|
||||
It is best practice to track any event handlers via `window.addCleanup` to prevent memory leaks during SPA navigation.
|
||||
|
||||
Quartz itself never dispatches `"render"`; plugins that change the page do (e.g. encrypted pages after decryption). Since other components re-run their setup on it, make your `render` handler safe to run more than once.
|
||||
|
||||
#### Links your script adds
|
||||
|
||||
[[prefetching|Prefetching]] and [[popover previews]] look for links on `nav`, and again on `render`. If your script inserts links after `nav` (lists built from `contentIndex.json`, content fetched later), dispatch `render` once they are in the page so they are prefetched and get popovers. Mark links with
|
||||
|
||||
- `data-no-prefetch` to keep them from being prefetched,
|
||||
- `data-router-ignore` to make them full page loads instead of SPA navigations (they aren't prefetched either),
|
||||
- `data-no-popover="true"` to give them no popover.
|
||||
|
||||
When your script needs another page's HTML, get it through the prefetch cache with `window.quartzPrefetch?.load(url)` (set unless prefetching is off; declared in the globals of `@quartz-community/types` 1.3.1+), so a page the reader is about to open is fetched once:
|
||||
|
||||
```ts title="related.inline.ts"
|
||||
import { normalizeRelativeURLs } from "@quartz-community/utils/dom"
|
||||
|
||||
async function pageHtml(url: URL): Promise<string | undefined> {
|
||||
// with prefetching on, use its cache (or fetch through it, so the page is fetched once)
|
||||
if (window.quartzPrefetch) return (await window.quartzPrefetch.load(url))?.text
|
||||
const res = await fetch(url)
|
||||
return res.ok ? await res.text() : undefined
|
||||
}
|
||||
|
||||
document.addEventListener("nav", async () => {
|
||||
const container = document.querySelector<HTMLElement>(".my-related")
|
||||
if (!container?.dataset.src) return
|
||||
const url = new URL(container.dataset.src, window.location.href)
|
||||
const html = await pageHtml(url)
|
||||
if (!html) return
|
||||
const doc = new DOMParser().parseFromString(html, "text/html")
|
||||
normalizeRelativeURLs(doc, url.toString()) // its links are relative to that page
|
||||
container.replaceChildren(...doc.querySelectorAll("article a.internal"))
|
||||
// the links were added after `nav`: let prefetching and popovers pick them up
|
||||
document.dispatchEvent(new CustomEvent("render", { detail: {} }))
|
||||
})
|
||||
```
|
||||
|
||||
#### Importing Code
|
||||
|
||||
In community plugins, TypeScript scripts should be transpiled at build time. The plugin template includes an `inlineScriptPlugin` in `tsup.config.ts` that automatically transpiles `.inline.ts` files imported as text:
|
||||
@@ -215,14 +299,14 @@ For advanced usage via the TS override in `quartz.ts`:
|
||||
|
||||
```ts title="quartz.ts (override)"
|
||||
import { loadQuartzConfig, loadQuartzLayout } from "./quartz/plugins/loader/config-loader"
|
||||
import Plugin from "./.quartz/plugins"
|
||||
import * as ExternalPlugin from "./.quartz/plugins"
|
||||
|
||||
const config = await loadQuartzConfig()
|
||||
export default config
|
||||
export const layout = await loadQuartzLayout({
|
||||
byPageType: {
|
||||
content: {
|
||||
left: [Plugin.MyComponent({ favouriteNumber: 42 })],
|
||||
left: [ExternalPlugin.MyComponent({ favouriteNumber: 42 })],
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
@@ -5,7 +5,9 @@ title: "Advanced"
|
||||
This section covers advanced topics for users who want to extend or deeply customize Quartz.
|
||||
|
||||
- **[[architecture]]** — How Quartz works under the hood: the parse, filter, and emit pipeline
|
||||
- **[[making plugins]]** — Build your own transformer, filter, emitter, or component plugin
|
||||
- **[[making plugins]]** — Build your own transformer, filter, emitter, page type, or component plugin
|
||||
- **[[plugin manifest]]** — Reference for the `quartz` field of a plugin's `package.json`
|
||||
- **[[plugin capabilities]]** — Declare what a plugin provides to and needs from other plugins
|
||||
- **[[creating components]]** — Create custom layout components with JSX
|
||||
- **[[paths]]** — How Quartz resolves and transforms file paths
|
||||
- **[[versioning]]** — Version numbers, plugin compatibility (`quartzVersion`) and releases
|
||||
+248
-146
@@ -24,13 +24,19 @@ type QuartzPluginInstance =
|
||||
The following sections will go into detail for what methods can be implemented for each plugin type. Before we do that, let's clarify a few more ambiguous types:
|
||||
|
||||
- `BuildCtx` is defined in `@quartz-community/types`. It consists of
|
||||
- `argv`: The command line arguments passed to the Quartz [[build]] command
|
||||
- `cfg`: The full Quartz [[configuration]]
|
||||
- `buildId`: a random id for this build
|
||||
- `argv`: The command line arguments passed to the Quartz [[build]] command (`argv.output` is the output folder)
|
||||
- `cfg`: The full Quartz [[configuration]]; `cfg.configuration` holds the `configuration` section of `quartz.config.yaml`
|
||||
- `allSlugs`: a list of all the valid content slugs (see [[paths]] for more information on what a slug is)
|
||||
- `allFiles`: the paths of all files in the content folder, relative to it
|
||||
- `incremental`: `true` while `quartz build --serve` rebuilds after a change
|
||||
- `contentIndex` (Quartz 5.1+): the site's content index, see [[#Reusing the content index in emitters]]
|
||||
- Quartz's own `BuildCtx` has more fields that `@quartz-community/types` doesn't declare: `virtualPages` (the pages page types generated, see [[#Page Types]]), `trie` (the folder tree, set by the page-type dispatcher) and `permalinks` (content file → slug for notes with a `permalink` in their frontmatter). Read them through a cast and expect them to be missing.
|
||||
- `StaticResources` is defined in `@quartz-community/types`. It consists of
|
||||
- `css`: a list of CSS style definitions that should be loaded. A CSS style is described with the `CSSResource` type. It accepts either a source URL or the inline content of the stylesheet.
|
||||
- `js`: a list of scripts that should be loaded. A script is described with the `JSResource` type. It allows you to define a load time (either before or after the DOM has been loaded), whether it should be a module, and either the source URL or the inline content of the script.
|
||||
- `additionalHead`: a list of JSX elements or functions that return JSX elements to be added to the `<head>` tag of the page. Functions receive the page's data as an argument and can conditionally render elements.
|
||||
- `assets` (Quartz 5.1+): files and directories to copy into the site, see [[#Shipping Files with Your Plugin]].
|
||||
|
||||
## Getting Started
|
||||
|
||||
@@ -44,7 +50,7 @@ cd my-plugin
|
||||
npm install
|
||||
```
|
||||
|
||||
The template provides the build configuration (`tsup.config.ts`), TypeScript setup, and correct package structure.
|
||||
The template provides the build configuration (`tsup.config.ts`), TypeScript setup, and correct package structure. It depends on `@quartz-community/types` and `@quartz-community/utils`; the examples on this page need types 1.3.0 and utils 1.2.0 or later.
|
||||
|
||||
## Plugin Structure
|
||||
|
||||
@@ -59,17 +65,21 @@ my-plugin/
|
||||
└── tsconfig.json # TypeScript configuration
|
||||
```
|
||||
|
||||
Component plugins also have `src/components/index.ts` (built to the `./components` export) and plugins with frames `src/frames/index.ts` (`./frames`).
|
||||
|
||||
The plugin's `package.json` should declare dependencies on `@quartz-community/types` (for type definitions) and optionally `@quartz-community/utils` (for shared utilities).
|
||||
|
||||
If your plugin reads data, DOM elements, globals or files produced by another plugin (or provides them), declare that in `quartz.capabilities` so Quartz can warn when the provider is disabled. See [[plugin capabilities]].
|
||||
Its `quartz` field — the **manifest** — tells Quartz what the plugin is: its category, where it runs (`defaultOrder`), its default options and option schema, the components and frames it ships, the plugins it depends on, and the Quartz versions it works with. Every field is described in the [[plugin manifest]] reference. In particular:
|
||||
|
||||
Declare the oldest Quartz version your plugin works with in `quartz.quartzVersion` (a semver range such as `">=5.1.0"`). Quartz checks it when loading the config and in `plugin add` / `plugin doctor`, and mentions it when your plugin throws. See [[versioning#For plugin authors]].
|
||||
- Declare the oldest Quartz version your plugin works with in `quartz.quartzVersion` (a semver range such as `">=5.1.0"`). Quartz checks it when loading the config and in `plugin add` / `plugin doctor`, and mentions it when your plugin throws. See [[versioning#For plugin authors]].
|
||||
- If your plugin reads data, DOM elements, globals or files produced by another plugin (or provides them), declare that in `quartz.capabilities` so Quartz can warn when the provider is disabled. See [[plugin capabilities]].
|
||||
- If your plugin must run after another one, set `defaultOrder` (and `dependencies` for a plugin that must be installed); see [[plugin manifest#defaultOrder|the order table]].
|
||||
|
||||
## Plugin Types
|
||||
A plugin that fails to load (can't be installed, throws on import, exports no plugin) is reported as an error naming the plugin and where it failed. Locally the build continues without it; in CI the build fails unless `QUARTZ_ALLOW_BROKEN_PLUGINS=1` is set. To retire a plugin, set `quartz.deprecated` (see [[plugin manifest#deprecated]]).
|
||||
|
||||
## Choosing a Plugin Type
|
||||
|
||||
Quartz supports six plugin capabilities. A single plugin can combine multiple types.
|
||||
Quartz has four processing plugin types — transformers, filters, emitters and page types — and plugins can also provide components, frames and Bases views. A single plugin can combine several of them.
|
||||
|
||||
| I want to... | Plugin Type |
|
||||
| ------------------------------------------------ | ----------- |
|
||||
@@ -82,7 +92,7 @@ Quartz supports six plugin capabilities. A single plugin can combine multiple ty
|
||||
|
||||
These are **not mutually exclusive**. For example:
|
||||
|
||||
- `obsidian-flavored-markdown` is both a **transformer** (processes OFM syntax) and provides **components** (mermaid rendering)
|
||||
- `table-of-contents` is both a **transformer** (collects the headings) and provides a **component** (renders them)
|
||||
- `canvas-page` is a **page type** that also provides a custom **frame**
|
||||
- A plugin could be a **transformer** that adds metadata AND a **component** that displays it
|
||||
|
||||
@@ -97,7 +107,8 @@ export type QuartzTransformerPluginInstance = {
|
||||
markdownPlugins?: (ctx: BuildCtx) => PluggableList
|
||||
htmlPlugins?: (ctx: BuildCtx) => PluggableList
|
||||
virtualPageHtmlPlugins?: (ctx: BuildCtx, content: ProcessedContent[]) => PluggableList
|
||||
externalResources?: (ctx: BuildCtx) => Partial<StaticResources>
|
||||
externalResources?: (ctx: BuildCtx) => Partial<StaticResources> | undefined
|
||||
extendContentIndex?: ContentIndexExtension // any plugin type, see below
|
||||
}
|
||||
```
|
||||
|
||||
@@ -109,15 +120,17 @@ All transformer plugins must define at least a `name` field to register the plug
|
||||
- `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.
|
||||
- `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.
|
||||
|
||||
Normally for both `remark` and `rehype`, you can find existing plugins that you can use. If you'd like to create your own `remark` or `rehype` plugin, checkout the [guide to creating a plugin](https://unifiedjs.com/learn/guide/create-a-plugin/) using `unified` (the underlying AST parser and transformer library).
|
||||
|
||||
A good example of a transformer plugin that borrows from the `remark` and `rehype` ecosystems is the [[plugins/Latex|Latex]] plugin:
|
||||
A good example of a transformer plugin that borrows from the `remark` and `rehype` ecosystems is the [[plugins/Latex|Latex]] plugin (simplified):
|
||||
|
||||
```ts
|
||||
import remarkMath from "remark-math"
|
||||
import rehypeKatex from "rehype-katex"
|
||||
import rehypeMathjax from "rehype-mathjax/svg"
|
||||
import { QuartzTransformerPlugin } from "@quartz-community/types"
|
||||
import type { QuartzTransformerPlugin } from "@quartz-community/types"
|
||||
|
||||
interface Options {
|
||||
renderEngine: "katex" | "mathjax"
|
||||
@@ -145,13 +158,13 @@ export const Latex: QuartzTransformerPlugin<Options> = (opts?: Options) => {
|
||||
css: [
|
||||
{
|
||||
// base css
|
||||
content: "https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/katex.min.css",
|
||||
content: "https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css",
|
||||
},
|
||||
],
|
||||
js: [
|
||||
{
|
||||
// fix copy behaviour: https://github.com/KaTeX/KaTeX/blob/main/contrib/copy-tex/README.md
|
||||
src: "https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/contrib/copy-tex.min.js",
|
||||
src: "https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/copy-tex.min.js",
|
||||
loadTime: "afterDOMReady",
|
||||
contentType: "external",
|
||||
},
|
||||
@@ -166,7 +179,7 @@ export const Latex: QuartzTransformerPlugin<Options> = (opts?: Options) => {
|
||||
Another common thing that transformer plugins will do is parse a file and add extra data for that file:
|
||||
|
||||
```ts
|
||||
import { QuartzTransformerPlugin } from "@quartz-community/types"
|
||||
import type { QuartzTransformerPlugin } from "@quartz-community/types"
|
||||
|
||||
export const AddWordCount: QuartzTransformerPlugin = () => {
|
||||
return {
|
||||
@@ -174,11 +187,11 @@ export const AddWordCount: QuartzTransformerPlugin = () => {
|
||||
markdownPlugins() {
|
||||
return [
|
||||
() => {
|
||||
return (tree, file) => {
|
||||
// tree is an `mdast` root element
|
||||
// file is a `vfile`
|
||||
const text = file.value
|
||||
const words = text.split(" ").length
|
||||
return (_tree, file) => {
|
||||
// _tree is an `mdast` root element
|
||||
// file is a `vfile`; its value is a string or a Uint8Array
|
||||
const text = file.toString()
|
||||
const words = text.split(/\s+/).filter(Boolean).length
|
||||
file.data.wordcount = words
|
||||
}
|
||||
},
|
||||
@@ -199,10 +212,10 @@ declare module "vfile" {
|
||||
Finally, you can also perform transformations over Markdown or HTML ASTs using the `visit` function from the `unist-util-visit` package or the `findAndReplace` function from the `mdast-util-find-and-replace` package.
|
||||
|
||||
```ts
|
||||
import { visit } from "unist-util-visit"
|
||||
import { SKIP, visit } from "unist-util-visit"
|
||||
import { findAndReplace } from "mdast-util-find-and-replace"
|
||||
import { QuartzTransformerPlugin } from "@quartz-community/types"
|
||||
import { Link } from "mdast"
|
||||
import type { QuartzTransformerPlugin } from "@quartz-community/types"
|
||||
import type { Root } from "mdast"
|
||||
|
||||
export const TextTransforms: QuartzTransformerPlugin = () => {
|
||||
return {
|
||||
@@ -210,27 +223,30 @@ export const TextTransforms: QuartzTransformerPlugin = () => {
|
||||
markdownPlugins() {
|
||||
return [
|
||||
() => {
|
||||
return (tree, file) => {
|
||||
return (tree: Root) => {
|
||||
// replace _text_ with the italics version
|
||||
findAndReplace(tree, /_(.+)_/, (_value: string, ...capture: string[]) => {
|
||||
// inner is the text inside of the () of the regex
|
||||
const [inner] = capture
|
||||
// return an mdast node
|
||||
// https://github.com/syntax-tree/mdast
|
||||
return {
|
||||
type: "emphasis",
|
||||
children: [{ type: "text", value: inner }],
|
||||
}
|
||||
})
|
||||
findAndReplace(tree, [
|
||||
/_(.+?)_/g,
|
||||
(_value: string, inner: string) => {
|
||||
// inner is the text inside of the () of the regex
|
||||
// return an mdast node
|
||||
// https://github.com/syntax-tree/mdast
|
||||
return {
|
||||
type: "emphasis",
|
||||
children: [{ type: "text", value: inner }],
|
||||
}
|
||||
},
|
||||
])
|
||||
|
||||
// remove all links (replace with just the link content)
|
||||
// remove all links (replace each with its content)
|
||||
// match by 'type' field on an mdast node
|
||||
// https://github.com/syntax-tree/mdast#link in this example
|
||||
visit(tree, "link", (link: Link) => {
|
||||
return {
|
||||
type: "paragraph",
|
||||
children: [{ type: "text", value: link.title }],
|
||||
}
|
||||
visit(tree, "link", (link, index, parent) => {
|
||||
if (parent === undefined || index === undefined) return
|
||||
// the visitor's return value controls traversal; to change the
|
||||
// tree, mutate the parent
|
||||
parent.children.splice(index, 1, ...link.children)
|
||||
return [SKIP, index]
|
||||
})
|
||||
}
|
||||
},
|
||||
@@ -257,21 +273,21 @@ export type QuartzFilterPluginInstance = {
|
||||
}
|
||||
```
|
||||
|
||||
A filter plugin must define a `name` field and a `shouldPublish` function that takes in a piece of content that has been processed by all the transformers and returns a `true` or `false` depending on whether it should be passed to the emitter plugins or not.
|
||||
A filter plugin must define a `name` field and a `shouldPublish` function that takes in a piece of content that has been processed by all the transformers and returns a `true` or `false` depending on whether it should be passed to the emitter plugins or not. A page is published only if every filter returns `true`.
|
||||
|
||||
Filters also see the pages that page types render from files (Quartz 5.1+; page types that declare `fileExtensions`, e.g. `.base` and `.canvas` pages), with the frontmatter the page type gives them and `file.data.referencedBy`: the published pages that link to them. A page a filter rejects is not emitted, listed or embeddable. Such files may have no frontmatter (`.base`, `.canvas`): [[ExplicitPublish]] publishes them when a published page links to them.
|
||||
|
||||
For example, here is a filter that removes drafts (Quartz has this [[RemoveDrafts|built in]]):
|
||||
For example, here is a filter that removes drafts. Quartz has this [[RemoveDrafts|built in]], and a plugin can't replace it (it would run in addition); the built-in is configured under `configuration.drafts`.
|
||||
|
||||
```ts
|
||||
import { QuartzFilterPlugin } from "@quartz-community/types"
|
||||
import type { QuartzFilterPlugin } from "@quartz-community/types"
|
||||
|
||||
export const RemoveDrafts: QuartzFilterPlugin<{}> = () => ({
|
||||
export const RemoveDrafts: QuartzFilterPlugin = () => ({
|
||||
name: "RemoveDrafts",
|
||||
shouldPublish(_ctx, [_tree, vfile]) {
|
||||
// uses frontmatter parsed from transformers
|
||||
const draftFlag: boolean = vfile.data?.frontmatter?.draft ?? false
|
||||
return !draftFlag
|
||||
// uses frontmatter parsed by Quartz; `draft` may be a boolean or a string
|
||||
const draft = vfile.data.frontmatter?.draft
|
||||
return !(draft === true || draft === "true")
|
||||
},
|
||||
})
|
||||
```
|
||||
@@ -298,84 +314,74 @@ export type QuartzEmitterPluginInstance = {
|
||||
resources: StaticResources,
|
||||
changeEvents: ChangeEvent[],
|
||||
): Promise<FilePath[]> | AsyncGenerator<FilePath> | null
|
||||
getQuartzComponents(ctx: BuildCtx): QuartzComponent[]
|
||||
getQuartzComponents?(ctx: BuildCtx): QuartzComponent[]
|
||||
externalResources?(ctx: BuildCtx): Partial<StaticResources> | undefined
|
||||
extendContentIndex?: ContentIndexExtension // see below
|
||||
}
|
||||
```
|
||||
|
||||
An emitter plugin must define a `name` field, an `emit` function, and a `getQuartzComponents` function. It can optionally implement a `partialEmit` function for incremental builds.
|
||||
An emitter plugin must define a `name` field and an `emit` function. Everything else is optional.
|
||||
|
||||
- `emit` is responsible for looking at all the parsed and filtered content and then appropriately creating files and returning a list of paths to files the plugin created.
|
||||
- `partialEmit` is an optional function that enables incremental builds. It receives information about which files have changed (`changeEvents`) and can selectively rebuild only the necessary files. This is useful for optimizing build times in development mode. If `partialEmit` is undefined, it will default to the `emit` function.
|
||||
- `getQuartzComponents` declares which Quartz components the emitter uses to construct its pages.
|
||||
- `emit` is responsible for looking at all the parsed and filtered content and then appropriately creating files and returning a list of paths to files the plugin created (or yielding them one by one from an async generator).
|
||||
- `partialEmit` enables incremental rebuilds in `quartz build --serve`. It receives information about which files have changed (`changeEvents`) and can selectively rebuild only the necessary files. If `partialEmit` is undefined, Quartz calls `emit` again.
|
||||
- `getQuartzComponents` declares Quartz components the emitter uses, so their CSS and scripts are included in the site.
|
||||
- `externalResources` adds CSS, scripts or [[#Shipping Files with Your Plugin|assets]] to every page, like a transformer's.
|
||||
|
||||
Creating new files can be done via regular Node [fs module](https://nodejs.org/api/fs.html) (i.e. `fs.cp` or `fs.writeFile`) or via the `write` function in `@quartz-community/utils` if you are creating files that contain text. `write` has the following signature:
|
||||
`content` holds the published pages, including the virtual pages that [[#Page Types|page types]] generated (folder and tag pages, `.base` and `.canvas` pages, …). Emitters run after the page types have rendered their pages, **in parallel**, so don't rely on another emitter's output, and treat `ctx` and `content` as read-only. `ctx.contentIndex` is ready by then ([[#Reusing the content index in emitters|see below]]).
|
||||
|
||||
Create files with Node's [fs module](https://nodejs.org/api/fs.html) and write them below `ctx.argv.output`. `@quartz-community/utils` has no `write` helper, so plugins define a small one, as in this emitter that writes a JSON list of all pages:
|
||||
|
||||
```ts
|
||||
export type WriteOptions = (data: {
|
||||
// the build context
|
||||
ctx: BuildCtx
|
||||
// the name of the file to emit (not including the file extension)
|
||||
slug: FullSlug
|
||||
// the file extension
|
||||
ext: `.${string}` | ""
|
||||
// the file content to add
|
||||
content: string
|
||||
}) => Promise<FilePath>
|
||||
```
|
||||
import path from "node:path"
|
||||
import fs from "node:fs/promises"
|
||||
import type {
|
||||
BuildCtx,
|
||||
FilePath,
|
||||
FullSlug,
|
||||
ProcessedContent,
|
||||
QuartzEmitterPlugin,
|
||||
} from "@quartz-community/types"
|
||||
import { joinSegments } from "@quartz-community/types"
|
||||
|
||||
This is a thin wrapper around writing to the appropriate output folder and ensuring that intermediate directories exist. If you choose to use the native Node `fs` APIs, ensure you emit to the `argv.output` folder as well.
|
||||
// write a text file below the output folder, creating directories as needed
|
||||
const write = async (
|
||||
ctx: BuildCtx,
|
||||
slug: FullSlug,
|
||||
ext: `.${string}` | "",
|
||||
content: string,
|
||||
): Promise<FilePath> => {
|
||||
const fp = joinSegments(ctx.argv.output, slug + ext)
|
||||
await fs.mkdir(path.dirname(fp), { recursive: true })
|
||||
await fs.writeFile(fp, content)
|
||||
return fp
|
||||
}
|
||||
|
||||
If you are creating an emitter plugin that needs to render components, there are three more things to be aware of:
|
||||
interface Options {
|
||||
slug: string
|
||||
}
|
||||
|
||||
- Your component should use `getQuartzComponents` to declare a list of `QuartzComponents` that it uses to construct the page. See the page on [[creating components]] for more information.
|
||||
- You can use the `renderPage` function defined in `@quartz-community/utils` to render Quartz components into HTML.
|
||||
- If you need to render an HTML AST to JSX, you can use the `htmlToJsx` function from `@quartz-community/utils`.
|
||||
|
||||
For example, the following is a simplified version of the content page plugin that renders every single page.
|
||||
|
||||
```tsx
|
||||
import { QuartzEmitterPlugin, FullPageLayout, QuartzComponentProps } from "@quartz-community/types"
|
||||
import { renderPage, canonicalizeServer, pageResources, write } from "@quartz-community/utils"
|
||||
|
||||
export const ContentPage: QuartzEmitterPlugin = () => {
|
||||
export const PageList: QuartzEmitterPlugin<Partial<Options>> = (opts) => {
|
||||
const slug = (opts?.slug ?? "pages") as FullSlug
|
||||
const emitList = async (ctx: BuildCtx, content: ProcessedContent[]) => {
|
||||
const pages = content.map(([_tree, file]) => ({
|
||||
slug: file.data.slug,
|
||||
title: file.data.frontmatter?.title,
|
||||
}))
|
||||
return [await write(ctx, slug, ".json", JSON.stringify(pages))]
|
||||
}
|
||||
return {
|
||||
name: "ContentPage",
|
||||
getQuartzComponents(ctx) {
|
||||
const { head, header, beforeBody, pageBody, afterBody, left, right, footer } = ctx.cfg.layout
|
||||
return [head, ...header, ...beforeBody, pageBody, ...afterBody, ...left, ...right, footer]
|
||||
},
|
||||
async emit(ctx, content, resources): Promise<FilePath[]> {
|
||||
const cfg = ctx.cfg.configuration
|
||||
const fps: FilePath[] = []
|
||||
const allFiles = content.map((c) => c[1].data)
|
||||
for (const [tree, file] of content) {
|
||||
const slug = canonicalizeServer(file.data.slug!)
|
||||
const externalResources = pageResources(slug, file.data, resources)
|
||||
const componentData: QuartzComponentProps = {
|
||||
fileData: file.data,
|
||||
externalResources,
|
||||
cfg,
|
||||
children: [],
|
||||
tree,
|
||||
allFiles,
|
||||
}
|
||||
|
||||
const content = renderPage(cfg, slug, componentData, {}, externalResources)
|
||||
const fp = await write({
|
||||
ctx,
|
||||
content,
|
||||
slug: file.data.slug!,
|
||||
ext: ".html",
|
||||
})
|
||||
|
||||
fps.push(fp)
|
||||
}
|
||||
return fps
|
||||
},
|
||||
name: "PageList",
|
||||
emit: (ctx, content) => emitList(ctx, content),
|
||||
// rebuild the whole file on every change in `quartz build --serve`
|
||||
partialEmit: (ctx, content) => emitList(ctx, content),
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
An emitter that wants to render HTML pages with the site's layout should be a [[#Page Types|page type]] instead: Quartz's page renderer isn't exported to plugins. To turn an HTML AST into JSX (e.g. inside a component), use `htmlToJsx` from `@quartz-community/utils`.
|
||||
|
||||
### Page Types
|
||||
|
||||
Page types define how a category of pages is rendered. They are the primary way to add support for new file types or virtual pages in Quartz.
|
||||
|
||||
```ts
|
||||
@@ -388,6 +394,7 @@ export interface QuartzPageTypePluginInstance {
|
||||
layout: string
|
||||
frame?: string
|
||||
body: QuartzComponentConstructor
|
||||
treeTransforms?: (ctx: BuildCtx) => TreeTransform[]
|
||||
}
|
||||
```
|
||||
|
||||
@@ -395,26 +402,83 @@ export interface QuartzPageTypePluginInstance {
|
||||
- `priority`: Controls matching order when multiple page types could match a slug. Higher priority page types are checked first. Default: `0`.
|
||||
- `fileExtensions`: Array of file extensions this page type handles (e.g. `[".canvas"]`, `[".base"]`). Content files (`.md`) are handled by the default content page type. The pages of such a page type stand for files: Quartz runs the site's filters on them (Quartz 5.1+), so give each page the file's `filePath` / `relativePath` and, if the file has frontmatter, that frontmatter.
|
||||
- `match`: A function that determines whether a given slug/file should be rendered by this page type.
|
||||
- `generate`: An optional function that produces virtual pages (pages not backed by files on disk, such as folder listings or tag indices). It receives `{ content, cfg, ctx }` and returns the pages, or (Quartz 5.1+) a promise of them, so it can do async work such as running content through the site's transformers or bundling with esbuild. Page types generate one after another, in priority order. A plugin with an async `generate` should declare `"quartzVersion": ">=5.1.0"`, since older versions don't wait for it.
|
||||
- `generate`: An optional function that produces virtual pages (pages not backed by files on disk, such as folder listings or tag indices). It receives `{ content, cfg, ctx }` and returns the pages, or (Quartz 5.1+) a promise of them, so it can do async work such as running content through the site's transformers or bundling with esbuild. Page types generate one after another, in priority order, and while one generates, `ctx.virtualPages` (a Quartz field not declared in `@quartz-community/types`) holds the virtual pages of the page types before it. A plugin with an async `generate` should declare `"quartzVersion": ">=5.1.0"`, since older versions don't wait for it.
|
||||
- `layout`: The layout configuration key (e.g. `"content"`, `"folder"`, `"tag"`). This determines which `byPageType` entry in `quartz.config.yaml` provides the layout overrides for this page type.
|
||||
- `frame`: The [[layout#Page Frames|page frame]] to use for this page type. Controls the overall HTML structure (e.g. `"default"`, `"full-width"`, `"minimal"`, or a custom frame provided by your plugin). If not set, defaults to `"default"`. Can be overridden per-page-type via `layout.byPageType.<name>.template` in `quartz.config.yaml`.
|
||||
- `body`: The Quartz component constructor that renders the page body content.
|
||||
- `treeTransforms`: Optional functions `(root, slug, componentData) => void` that change a page's HTML tree when it is rendered, when all pages (`componentData.allFiles`) are known — e.g. to resolve embeds. Quartz applies the transforms of every page type to every page it renders, so check that a node is yours before changing it.
|
||||
|
||||
`match` is only asked about content files; a virtual page is rendered by the page type that generated it. All page types run inside one built-in emitter, the page-type dispatcher, which runs before the plugins' emitters. A minimal page type that adds one page per author:
|
||||
|
||||
```tsx
|
||||
import type {
|
||||
FullSlug,
|
||||
QuartzComponent,
|
||||
QuartzComponentConstructor,
|
||||
QuartzPageTypePlugin,
|
||||
VirtualPage,
|
||||
} from "@quartz-community/types"
|
||||
import { slugifyPath } from "@quartz-community/utils"
|
||||
|
||||
const AuthorBody: QuartzComponentConstructor = () => {
|
||||
const Body: QuartzComponent = ({ fileData, allFiles }) => {
|
||||
const author = fileData.author as string
|
||||
const pages = allFiles.filter((f) => f.frontmatter?.author === author)
|
||||
return (
|
||||
<ul>
|
||||
{pages.map((f) => (
|
||||
<li>{f.frontmatter?.title}</li>
|
||||
))}
|
||||
</ul>
|
||||
)
|
||||
}
|
||||
return Body
|
||||
}
|
||||
|
||||
export const AuthorPage: QuartzPageTypePlugin = () => ({
|
||||
name: "AuthorPage",
|
||||
// checked before the content page type (priority 0)
|
||||
priority: 10,
|
||||
// notes you write under authors/ are rendered by this page type too
|
||||
match: ({ slug }) => slug.startsWith("authors/"),
|
||||
generate({ content }) {
|
||||
const authors = new Set<string>()
|
||||
for (const [, file] of content) {
|
||||
const author = file.data.frontmatter?.author
|
||||
if (typeof author === "string") authors.add(author)
|
||||
}
|
||||
return [...authors].map((author): VirtualPage => ({
|
||||
slug: `authors/${slugifyPath(author)}` as FullSlug,
|
||||
title: author,
|
||||
data: { author },
|
||||
}))
|
||||
},
|
||||
layout: "author", // layout.byPageType.author in quartz.config.yaml
|
||||
body: AuthorBody,
|
||||
})
|
||||
```
|
||||
|
||||
### Extending the content index
|
||||
|
||||
Quartz [[ContentIndex|builds `static/contentIndex.json`]] itself — the file search, the explorer, the graph and other client-side components read. Any plugin (transformer, filter, emitter or page type) can add fields to every page's entry by defining `extendContentIndex` on its plugin instance:
|
||||
|
||||
```ts
|
||||
import { QuartzTransformerPlugin } from "@quartz-community/types"
|
||||
import type { QuartzTransformerPlugin } from "@quartz-community/types"
|
||||
|
||||
export const ReadingTime: QuartzTransformerPlugin = () => ({
|
||||
name: "ReadingTime",
|
||||
markdownPlugins: () => [/* … sets file.data.readingTime … */],
|
||||
// called once per page when contentIndex.json is written
|
||||
extendContentIndex({ fileData, entry }) {
|
||||
return { readingTime: fileData.readingTime as number | undefined }
|
||||
extendContentIndex({ fileData }) {
|
||||
return { readingTime: fileData.readingTime }
|
||||
},
|
||||
})
|
||||
|
||||
declare module "vfile" {
|
||||
interface DataMap {
|
||||
readingTime: number
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Client-side code then finds the field next to the core ones:
|
||||
@@ -449,7 +513,15 @@ emit: async (ctx, content) => {
|
||||
}
|
||||
```
|
||||
|
||||
Built-in settings are available too, with defaults and migrated options applied: `ctx.cfg.configuration.links.markdownLinkResolution`, `ctx.cfg.configuration.contentIndex.enableRSS`, … Both need Quartz 5.1+ — declare `"quartzVersion": ">=5.1.0"` (see [[versioning#For plugin authors]]).
|
||||
Built-in settings are available too, with defaults and migrated options applied: Quartz 5.1 sets `ctx.cfg.configuration.links`, `.frontmatter`, `.drafts` and `.contentIndex` to objects with every option (`enabled`, `order`, `markdownLinkResolution`, `enableRSS`, …). Their type also allows `boolean` (what a user may write in YAML) and `undefined` (older Quartz), so narrow before reading an option:
|
||||
|
||||
```ts
|
||||
const links = ctx.cfg.configuration.links
|
||||
const resolution =
|
||||
(typeof links === "object" ? links.markdownLinkResolution : undefined) ?? "shortest"
|
||||
```
|
||||
|
||||
Both need Quartz 5.1+ — declare `"quartzVersion": ">=5.1.0"` (see [[versioning#For plugin authors]]).
|
||||
|
||||
### Components in sidebars
|
||||
|
||||
@@ -481,12 +553,10 @@ export const MyFrame: PageFrame = {
|
||||
}
|
||||
`,
|
||||
render({ componentData, pageBody: Content, footer: Footers }: PageFrameProps): unknown {
|
||||
const renderSlot = (C: (props: typeof componentData) => unknown): ComponentChildren =>
|
||||
C(componentData) as ComponentChildren
|
||||
return (
|
||||
<div class="center">
|
||||
{(Content as any)(componentData)}
|
||||
{Footers.map((Footer) => (Footer as any)(componentData))}
|
||||
{Content(componentData) as ComponentChildren}
|
||||
{Footers.map((Footer) => Footer(componentData) as ComponentChildren)}
|
||||
</div>
|
||||
)
|
||||
},
|
||||
@@ -533,7 +603,10 @@ The `"frames"` field in the `"quartz"` manifest maps export names to frame metad
|
||||
|
||||
```ts title="tsup.config.ts"
|
||||
export default defineConfig({
|
||||
entry: ["src/index.ts", "src/frames/index.ts"],
|
||||
entry: {
|
||||
index: "src/index.ts",
|
||||
"frames/index": "src/frames/index.ts",
|
||||
},
|
||||
// ...
|
||||
})
|
||||
```
|
||||
@@ -557,22 +630,23 @@ When a user installs your plugin, Quartz automatically loads the frame from the
|
||||
|
||||
The `bases-page` plugin provides a database-like view system similar to Obsidian Bases. Other plugins can register custom view types via the `ViewRegistry`:
|
||||
|
||||
```ts
|
||||
import { viewRegistry } from "@quartz-community/bases-page";
|
||||
import type { ViewTypeRegistration } from "@quartz-community/bases-page";
|
||||
```tsx
|
||||
import { viewRegistry } from "@quartz-community/bases-page"
|
||||
|
||||
viewRegistry.register({
|
||||
id: "timeline",
|
||||
name: "Timeline",
|
||||
icon: "git-branch",
|
||||
render: ({ entries, view, slug, allSlugs }) => (
|
||||
render: ({ entries }) => (
|
||||
<div class="bases-timeline">
|
||||
{entries.map(entry => <div>{entry.properties.title}</div>)}
|
||||
{entries.map((entry) => (
|
||||
<div>{entry.title}</div>
|
||||
))}
|
||||
</div>
|
||||
),
|
||||
css: `.bases-timeline { display: flex; flex-direction: column; }`,
|
||||
afterDOMLoaded: `document.addEventListener("nav", () => { /* setup */ })`,
|
||||
});
|
||||
})
|
||||
```
|
||||
|
||||
Each view registration includes:
|
||||
@@ -621,13 +695,29 @@ const SINGLETON_EXTERNALS = [
|
||||
]
|
||||
|
||||
export default defineConfig({
|
||||
entry: {
|
||||
index: "src/index.ts",
|
||||
types: "src/types.ts",
|
||||
"components/index": "src/components/index.ts",
|
||||
},
|
||||
// ...
|
||||
noExternal: [/.*/], // Bundle everything
|
||||
external: SINGLETON_EXTERNALS, // Except singletons
|
||||
esbuildOptions(options) {
|
||||
options.jsx = "automatic"
|
||||
options.jsxImportSource = "preact"
|
||||
// noExternal: [/.*/] overrides `external`, so set it on esbuild directly
|
||||
options.external = SINGLETON_EXTERNALS
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
This means your plugin's `dist/index.js` is self-contained — no `npm install` needed at install time.
|
||||
This means your plugin's `dist/` is self-contained — no `npm install` needed at install time. The three entries build the `.`, `./types` and `./components` exports of the template's `package.json`; Quartz loads components from `./components` (see [[creating components]]).
|
||||
|
||||
The singletons are left out so that every plugin uses the same copy. List `preact` (and `vfile` if you use it) in `peerDependencies`, as the template does: Quartz links a plugin's peer dependencies to the site's own `node_modules`, so all plugins share Quartz's Preact and hooks and context work across components of different plugins.
|
||||
|
||||
> [!warning] Plugins made from an older template
|
||||
> Before Quartz 5.1, the template's `tsup.config.ts` set only `external`, which `noExternal: [/.*/]` overrides: those plugins bundle their own Preact, and a component using `preact/hooks` can crash next to other plugins' components. Copy the `esbuildOptions` above (`options.external = SINGLETON_EXTERNALS`) from the current [plugin template](https://github.com/quartz-community/plugin-template), move `preact` to `peerDependencies` and rebuild.
|
||||
|
||||
### Shipping Pre-built Output
|
||||
|
||||
@@ -635,7 +725,8 @@ Your plugin's `dist/` directory should be committed to the repository:
|
||||
|
||||
1. **Do NOT add `dist/` to `.gitignore`**
|
||||
2. Run `npm run build` before committing
|
||||
3. The CI workflow verifies `dist/` is up to date on every push
|
||||
|
||||
The template's CI workflow runs typecheck, lint, format check, tests and a build, then checks `dist/index.js` for imports of packages that are neither bundled, built into Node, shared singletons nor peer dependencies (they would fail at runtime). It does not check that the committed `dist/` matches the source, so rebuild before every commit.
|
||||
|
||||
If `dist/` is missing or gitignored, Quartz falls back to the full install/build cycle (useful during local development with symlinked plugins).
|
||||
|
||||
@@ -646,14 +737,16 @@ Since Quartz 5.1, `externalResources()` can return `assets`: files or directorie
|
||||
Use this for large or optional client code instead of an inline script: Quartz serves inline scripts to **every page**, while an asset is only downloaded where your script imports it.
|
||||
|
||||
```ts
|
||||
import path from "path"
|
||||
import { createRequire } from "module"
|
||||
import path from "node:path"
|
||||
import { createRequire } from "node:module"
|
||||
|
||||
externalResources() {
|
||||
// resolve a dependency's browser build at build time
|
||||
const pkg = createRequire(import.meta.url).resolve("my-renderer/package.json")
|
||||
return {
|
||||
js: [{ script: loaderScript, loadTime: "afterDOMReady", contentType: "inline", moduleType: "module" }],
|
||||
js: [
|
||||
{ script: loaderScript, loadTime: "afterDOMReady", contentType: "inline", moduleType: "module" },
|
||||
],
|
||||
assets: [{ from: path.join(path.dirname(pkg), "dist", "esm"), to: "my-plugin/renderer" }],
|
||||
}
|
||||
}
|
||||
@@ -661,7 +754,7 @@ externalResources() {
|
||||
|
||||
```ts title="loader.inline.ts"
|
||||
document.addEventListener("nav", async () => {
|
||||
const nodes = document.querySelectorAll(".my-widget")
|
||||
const nodes = document.querySelectorAll<HTMLElement>(".my-widget")
|
||||
if (nodes.length === 0 || !window.quartzStaticUrl) return // nothing to do on this page
|
||||
const url = new URL("plugins/my-plugin/renderer/index.js", window.quartzStaticUrl).href
|
||||
const { render } = await import(url)
|
||||
@@ -669,6 +762,8 @@ document.addEventListener("nav", async () => {
|
||||
})
|
||||
```
|
||||
|
||||
`window.quartzStaticUrl` is declared in the browser globals of `@quartz-community/types` from 1.3.1 on; the template's `types/globals.d.ts` references them (`/// <reference path="../node_modules/@quartz-community/types/globals.d.ts" />`).
|
||||
|
||||
- `to` is relative to `static/plugins/`; use your plugin's name as the first segment. Invalid or conflicting targets and missing sources are reported as build warnings.
|
||||
- An ES module build with relative `import()`s keeps working when served this way, so only the chunks a page needs are downloaded.
|
||||
- Older Quartz versions ignore `assets` and leave `quartzStaticUrl` undefined. Either require `"quartzVersion": ">=5.1.0"` or fall back (for example to a CDN), as [[ObsidianFlavoredMarkdown]] does for [[Mermaid diagrams|Pele]].
|
||||
@@ -679,7 +774,7 @@ Plugins that require native packages (e.g. `sharp` for image processing) cannot
|
||||
|
||||
1. Set `"requiresInstall": true` in your `package.json` quartz manifest
|
||||
2. Declare the native package as a `peerDependency`
|
||||
3. Quartz will install it into the host project at build time
|
||||
3. Quartz installs it into the site when it installs your plugin from Git
|
||||
|
||||
```shell
|
||||
# Build the plugin
|
||||
@@ -690,19 +785,26 @@ npx tsup
|
||||
|
||||
## What to Import from Where
|
||||
|
||||
| You need... | Import from |
|
||||
| ---------------------------------------------------------------------- | ----------------------------------------------------------------- |
|
||||
| Type definitions (`QuartzTransformerPlugin`, `QuartzComponent`, etc.) | `@quartz-community/types` |
|
||||
| Path utilities (`simplifySlug`, `resolveRelative`, `pathToRoot`) | `@quartz-community/utils/path` |
|
||||
| DOM utilities (`removeAllChildren`, `registerEscapeHandler`) | `@quartz-community/utils/dom` |
|
||||
| JSX conversion (`htmlToJsx`) | `@quartz-community/utils/jsx` |
|
||||
| Language utilities (`classNames`, `capitalize`) | `@quartz-community/utils/lang` |
|
||||
| Date/sort utilities (`formatDate`, `getDate`, `byDateAndAlphabetical`) | `@quartz-community/utils/date` and `@quartz-community/utils/sort` |
|
||||
| HTML escaping (`escapeHTML`, `unescapeHTML`) | `@quartz-community/utils/escape` |
|
||||
| Emoji utilities (`getIconCode`) | `@quartz-community/utils/emoji` |
|
||||
| Browser runtime (`onNav`, `onRender`, `fetchContentIndex`) | `@quartz-community/runtime` |
|
||||
| You need... | Import from |
|
||||
| ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
|
||||
| Type definitions (`QuartzTransformerPlugin`, `QuartzComponent`, `BuildCtx`, `FilePath`, etc.) | `@quartz-community/types` |
|
||||
| Browser globals (`fetchData`, `window.addCleanup`, `window.quartzStaticUrl`, the `nav` / `render` events, …) | `@quartz-community/types/globals.d.ts` (types only, see above) |
|
||||
| Path utilities (`simplifySlug`, `resolveRelative`, `pathToRoot`, `slugifyFilePath`, `joinSegments`) | `@quartz-community/utils/path` |
|
||||
| Links: `transformLink` (resolve a link like Quartz does), `splitAnchor`, `linkPathDecodes` | `@quartz-community/utils/path` |
|
||||
| Heading ids and anchors: `slugHeading`, `HeadingSlugger`, `obsidianHeadingAnchor`, `resolveAnchorHref`; tags: `slugTag` | `@quartz-community/utils/path` |
|
||||
| DOM utilities (`removeAllChildren`, `registerEscapeHandler`, `normalizeRelativeURLs`) | `@quartz-community/utils/dom` |
|
||||
| JSX conversion (`htmlToJsx`) | `@quartz-community/utils/jsx` |
|
||||
| Language utilities (`classNames`, `capitalize`) | `@quartz-community/utils/lang` |
|
||||
| Date/sort utilities (`formatDate`, `getDate`, `byDateAndAlphabetical`) | `@quartz-community/utils/date` and `@quartz-community/utils/sort` |
|
||||
| HTML escaping (`escapeHTML`, `unescapeHTML`) | `@quartz-community/utils/escape` |
|
||||
| Emoji utilities (`getIconCode`) | `@quartz-community/utils/emoji` |
|
||||
| Browser runtime (`onNav`, `onRender`, `fetchContentIndex`) | `@quartz-community/runtime` |
|
||||
|
||||
Do **not** import from `@jackyzha0/quartz` or from `vfile` directly. Use the community packages instead.
|
||||
All utilities are also exported from `@quartz-community/utils` itself. The tables assume `@quartz-community/types` 1.3.0+ and `@quartz-community/utils` 1.2.0+.
|
||||
|
||||
A plugin that gives headings ids, or writes links to headings, must use the heading helpers: they make the same ids as GitHub Flavored Markdown and the table of contents (`HeadingSlugger` numbers repeated headings `foo`, `foo-1`, …), so anchors written in Obsidian resolve. See [[paths#Headings and anchors]].
|
||||
|
||||
Do **not** import from `@jackyzha0/quartz`: plugins run against whichever Quartz version the site uses. Use the community packages instead. Import `vfile` only for types, such as the `declare module "vfile"` block that adds your `file.data` fields; it is a shared package, so list it in `peerDependencies` rather than bundling it.
|
||||
|
||||
## Internationalization (i18n)
|
||||
|
||||
@@ -853,10 +955,10 @@ npx quartz plugin prune --dry-run
|
||||
```
|
||||
|
||||
> [!tip]
|
||||
> Both `resolve` and `prune` fall back to `quartz.config.default.yaml` if no `quartz.config.yaml` is present. This is useful for CI environments where the default config is the source of truth. See [[cli/plugin#prune|prune]] and [[cli/plugin#resolve|resolve]] for full details.
|
||||
> Both `install --from-config` and `prune` fall back to `quartz.config.default.yaml` if no `quartz.config.yaml` is present. This is useful for CI environments where the default config is the source of truth. See [[cli/plugin#install|install]] and [[cli/plugin#prune|prune]] for full details.
|
||||
|
||||
## Component Plugins
|
||||
|
||||
For plugins that provide visual components (like Explorer, Graph, Search), see the [[creating components|creating component plugins]] guide.
|
||||
|
||||
Component-only plugins (those with `"category": ["component"]` in their manifest) are loaded via side-effect import rather than a factory function. If your component-only plugin needs to receive user options from `quartz.config.yaml`, export an `init(options)` function — see [[creating components#Receiving YAML Options in Component-Only Plugins|receiving YAML options]] for details.
|
||||
Quartz loads components from your package's `./components` export by the names listed in `quartz.components` (see [[plugin manifest#components]]). Component-only plugins (those with `"category": ["component"]` in their manifest) are loaded via side-effect import rather than a factory function. If your component-only plugin needs to receive user options from `quartz.config.yaml`, export an `init(options)` function — see [[creating components#Receiving YAML Options in Component-Only Plugins|receiving YAML options]] for details.
|
||||
+20
-2
@@ -15,7 +15,7 @@ Luckily, we can mimic nominal typing using [brands](https://www.typescriptlang.o
|
||||
type FullSlug = string
|
||||
|
||||
// we do
|
||||
type FullSlug = string & { __brand: "full" }
|
||||
type FullSlug = string & { _brand: "FullSlug" }
|
||||
|
||||
// that way, the following will fail typechecking
|
||||
const slug: FullSlug = "some random string"
|
||||
@@ -25,7 +25,7 @@ While this prevents most typing mistakes _within_ our nominal typing system (e.g
|
||||
|
||||
Thus, we still need to be careful when casting from a string to one of these nominal types in the 'entrypoints', illustrated with hexagon shapes in the diagram below.
|
||||
|
||||
The following diagram draws the relationships between all the path sources, nominal path types, and what functions in `quartz/path.ts` convert between them.
|
||||
The following diagram draws the relationships between all the path sources, nominal path types, and what functions convert between them. In Quartz core they live in `quartz/util/path.ts`; plugins import the same functions from `@quartz-community/utils` (the types `FilePath`, `FullSlug` and `SimpleSlug` from `@quartz-community/types`).
|
||||
|
||||
```mermaid
|
||||
graph LR
|
||||
@@ -49,3 +49,21 @@ Here are the main types of slugs with a rough description of each type of path:
|
||||
- `RelativeURL`: must start with `.` or `..` to indicate it's a relative URL. Shouldn't have `/index` as an ending or a file extension but can contain a trailing slash.
|
||||
|
||||
To get a clearer picture of how these relate to each other, take a look at the path tests in `quartz/util/path.test.ts`.
|
||||
|
||||
## A page's slug
|
||||
|
||||
`slugifyFilePath()` lowercases, replaces spaces with `-` and normalizes Unicode to NFC (so `café.md` written in NFD, as macOS does, gets the same slug). But a page isn't always published at the slug of its file path: a note with a `permalink` in its frontmatter is published at that address instead (see [[built-in processing]]). Always use `file.data.slug` (or `fileData.slug` in components) for a page's address, and `file.data.relativePath` / `filePath` for its file; don't recompute the slug from the path.
|
||||
|
||||
## Links
|
||||
|
||||
To resolve a link the way Quartz does, use `transformLink(src, target, { strategy, allSlugs })`: `src` is the current page's slug, `strategy` is the site's `configuration.links.markdownLinkResolution` (`absolute`, `relative` or `shortest`) and `allSlugs` is `ctx.allSlugs`. It decodes percent-encoding, applies the same slug rules as `slugifyFilePath()` and resolves folder notes. A Markdown link whose path doesn't percent-decode (`[x](%zz)`) is external in Obsidian and in Quartz; check with `linkPathDecodes(link)` before treating a link as internal. `splitAnchor(link)` splits off the `#anchor` and slugs it as a heading anchor.
|
||||
|
||||
## Headings and anchors
|
||||
|
||||
Heading ids follow the GitHub rule (`github-slugger`, as `rehype-slug` and the table of contents use): lowercase, punctuation removed, spaces replaced by `-`, other letters and digits kept. Plugins that give headings ids or link to headings must use the helpers from `@quartz-community/utils`, so ids and anchors match:
|
||||
|
||||
- `slugHeading(text)`: the id of a heading with this text;
|
||||
- `HeadingSlugger`: slugs all headings of one page in order and numbers repeats (`foo`, `foo-1`, …) — create one per page;
|
||||
- `obsidianHeadingAnchor(text)`: the anchor Obsidian writes for a heading (it replaces `:`, `|`, `^`, `#` and `\` with spaces); slug it with `slugHeading` and add it as an extra id when it differs;
|
||||
- `resolveAnchorHref(href, ids)`: points a same-page `#anchor` at an id that exists on the page (an id as written, a block reference `#^name`, or a heading's text);
|
||||
- `slugTag(tag)`: the slug of a tag, as used for tag pages.
|
||||
@@ -31,14 +31,18 @@ Add `capabilities` to the `quartz` field of your plugin's `package.json`:
|
||||
"provides": {},
|
||||
"requires": {
|
||||
"data": [
|
||||
{ "name": "links", "from": "crawl-links", "reason": "the backlinks list is always empty" }
|
||||
{
|
||||
"name": "links",
|
||||
"from": "quartz:links",
|
||||
"reason": "the backlinks list is always empty"
|
||||
}
|
||||
]
|
||||
},
|
||||
"optional": {
|
||||
"data": [
|
||||
{
|
||||
"name": "frontmatter",
|
||||
"from": "note-properties",
|
||||
"from": "quartz:frontmatter",
|
||||
"reason": "titles fall back to file names"
|
||||
}
|
||||
]
|
||||
@@ -67,7 +71,7 @@ Each section maps a **kind** to a list:
|
||||
|
||||
A requirement is either a name, or `{ "name", "from"?, "reason"? }`:
|
||||
|
||||
- `from` — plugin name(s) (the manifest `name`, e.g. `"crawl-links"`) known to provide it. It is used for the "enable …" hint, **and** a requirement counts as satisfied whenever a plugin named in `from` is enabled, even if that plugin predates capability declarations. Always set `from` for first-party providers: it keeps new consumers working with old providers.
|
||||
- `from` — plugin name(s) (the manifest `name`, e.g. `"syntax-highlighting"`) known to provide it. It is used for the "enable …" hint, **and** a requirement counts as satisfied whenever a plugin named in `from` is enabled, even if that plugin predates capability declarations. Always set `from` for first-party providers: it keeps new consumers working with old providers. [[built-in processing|Built-ins]] are named `quartz:frontmatter`, `quartz:links`, `quartz:drafts` and `quartz:contentIndex` (the names of the plugins they replaced, `crawl-links`, `remove-draft` and `content-index`, work too).
|
||||
- `reason` — what breaks without it, appended to the warning.
|
||||
|
||||
Names are matched exactly (after trimming). Unknown kinds or malformed entries are ignored and reported, never fatal.
|
||||
@@ -78,10 +82,10 @@ These never need a provider plugin (`coreCapabilities()` in `quartz/plugins/load
|
||||
|
||||
- data: `slug`, `filePath`, `relativePath`
|
||||
- dom: `#quartz-body`, `.page`, `.center`, `article`, `.popover-hint`, `.sidebar`
|
||||
- globals: `fetchData`, `addCleanup`, `spaNavigate`
|
||||
- globals: `fetchData`, `addCleanup`, `spaNavigate`, `quartzStaticUrl`, `quartzPrefetch` (the last is only set while [[prefetching]] is on)
|
||||
- events: `nav` (always), `prenav` (only with `enableSPA`)
|
||||
|
||||
Note that `fetchData` is a promise for `static/contentIndex.json`, which Quartz emits by default ([[ContentIndex|built-in content index]]). Declare `files: ["static/contentIndex.json"]` if you read it. Since this release `fetchData` resolves to `{}` (with a console warning) when the file is missing, instead of rejecting.
|
||||
Note that `fetchData` is a promise for `static/contentIndex.json`, which Quartz emits by default ([[ContentIndex|built-in content index]]). Declare `files: ["static/contentIndex.json"]` if you read it. Since Quartz 5.1, `fetchData` resolves to `{}` (with a console warning) when the file is missing, instead of rejecting.
|
||||
|
||||
## How the check works
|
||||
|
||||
@@ -92,7 +96,7 @@ Note that `fetchData` is a promise for `static/contentIndex.json`, which Quartz
|
||||
3. Only if something is missing, also read the manifests of **disabled** entries in `quartz.config.yaml` to suggest which one to enable.
|
||||
4. Warnings are printed once per process (main thread only).
|
||||
|
||||
The check is static: it cannot see option-dependent behaviour (e.g. `syntax-highlighting` with `clipboard: false` still "provides" `.clipboard-button`) or pipeline order (see the `dependencies` / `defaultOrder` checks for that).
|
||||
The check is static: it cannot see option-dependent behaviour (e.g. `syntax-highlighting` with `clipboard: false` still "provides" `.clipboard-button`) or pipeline order: for that, set [[plugin manifest#defaultOrder|`defaultOrder`]] (and [[plugin manifest#dependencies|`dependencies`]]: a missing dependency or one ordered after your plugin fails the build, a disabled one is a warning).
|
||||
|
||||
## Writing robust consumers
|
||||
|
||||
@@ -104,27 +108,12 @@ Declaring a requirement is not a substitute for handling its absence. For `optio
|
||||
|
||||
## Built-ins as providers
|
||||
|
||||
Quartz's [[built-in processing]] steps take part in the check like plugins: when enabled, built-in frontmatter provides `frontmatter`, `aliases` and `frontmatterLinks`, built-in links provides `links`, and the built-in content index provides `static/contentIndex.json`. When one is turned off, warnings suggest `configuration.<key>` (and a `from: "crawl-links"` hint is shown as `configuration.links`).
|
||||
Quartz's [[built-in processing]] steps take part in the check like plugins: when enabled, built-in frontmatter provides `frontmatter`, `aliases` and `frontmatterLinks`, built-in links provides `links`, and the built-in content index provides `static/contentIndex.json`. Built-in links also provides the DOM classes `.internal`, `.external` and `.broken`, and the content index `sitemap.xml`. When one is turned off, warnings suggest `configuration.<key>` (a `from: "crawl-links"` or `"quartz:links"` hint is shown as `configuration.links`).
|
||||
|
||||
The same declarations decide replacement: an enabled plugin that `provides` `data: ["frontmatter"]`, `data: ["links"]` or `files: ["static/contentIndex.json"]` replaces the matching built-in.
|
||||
The same declarations decide replacement: an enabled plugin that `provides` `data: ["frontmatter"]`, `data: ["links"]` or `files: ["static/contentIndex.json"]` replaces the matching built-in. Built-in drafts can't be replaced.
|
||||
|
||||
## Migration path
|
||||
## Who declares capabilities
|
||||
|
||||
1. **Now (this change):** core checker + declarations on a representative set of first-party plugins: `note-properties`, `crawl-links`, `backlinks`, `description`, `content-index`, `syntax-highlighting`, `obsidian-flavored-markdown`, `remove-draft`, `search`.
|
||||
2. **Next, first-party plugins** — drafts derived from the workspace catalog (`just catalog show <plugin>` in the dev-mode workspace lists data read/written, DOM classes and scripts):
|
||||
In Quartz 5.1, these first-party plugins declare capabilities: `backlinks`, `description`, `syntax-highlighting`, `obsidian-flavored-markdown` and `search` (and the plugins replaced by built-ins: `note-properties`, `crawl-links`, `remove-draft`, `content-index`). Plugins without declarations are never checked and never cause warnings, so third-party plugins can add them at their own pace.
|
||||
|
||||
| Plugin | Draft |
|
||||
| ------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
|
||||
| `explicit-publish` | requires data `frontmatter` (built in) |
|
||||
| `graph`, `explorer` | requires files `static/contentIndex.json` (built in); optional events `themechange` from darkmode |
|
||||
| `recent-notes`, `content-meta` | optional data `dates` from created-modified-date |
|
||||
| `alias-redirects` | requires data `aliases` (built in) |
|
||||
| `table-of-contents` | provides data `toc`, `collapseToc` |
|
||||
| `created-modified-date` | provides data `dates`, `defaultDateType` |
|
||||
| `unlisted-pages`, `encrypted-pages` | provide data `unlisted` (encrypted-pages also `encrypted`, events `render`, `content-index-updated`) |
|
||||
| `darkmode` | provides events `themechange` |
|
||||
| `og-image`, `folder-page`, `tag-page` | optional data `description` from description, `dates` from created-modified-date |
|
||||
| `canvas-page`, `obsidian-plugin-excalidraw` | optional dom `.explorer` (they style it) from explorer |
|
||||
|
||||
3. **Third-party plugins:** add declarations at their own pace; nothing changes for them otherwise.
|
||||
4. **Later (proposals, not implemented):** print `optional` infos with `quartz build --verbose`; a `strictCapabilities` option that turns warnings into errors; ordering checks for `data` between transformers (needs a `phase` per provided key); option-aware provides; a `transforms` kind for "rewrites links" style contracts (OFM currently uses crawl-links' `.internal` class as a proxy); exporting these types from `@quartz-community/types`.
|
||||
Not implemented (yet): printing unsatisfied `optional` requirements, turning warnings into errors, ordering checks between transformers, and option-aware `provides`. The capability types are not exported from `@quartz-community/types`; the schema above is the contract.
|
||||
@@ -0,0 +1,160 @@
|
||||
---
|
||||
title: Plugin manifest
|
||||
---
|
||||
|
||||
The `quartz` field of a plugin's `package.json` is its **manifest**: it tells Quartz what kind of plugin it is, where it runs in the pipeline, which components and frames it ships and what it needs. Quartz reads it from the installed package (`node_modules/<package>/package.json` for npm plugins, `.quartz/plugins/<name>/package.json` for Git and local plugins). See [[making plugins]] for how to write the plugin itself.
|
||||
|
||||
```json title="package.json"
|
||||
{
|
||||
"name": "@you/my-plugin",
|
||||
"version": "1.2.0",
|
||||
"description": "Adds reading times",
|
||||
"exports": {
|
||||
".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" },
|
||||
"./components": {
|
||||
"types": "./dist/components/index.d.ts",
|
||||
"import": "./dist/components/index.js"
|
||||
}
|
||||
},
|
||||
"quartz": {
|
||||
"name": "my-plugin",
|
||||
"displayName": "My Plugin",
|
||||
"category": ["transformer", "component"],
|
||||
"quartzVersion": ">=5.1.0",
|
||||
"defaultOrder": 70,
|
||||
"defaultEnabled": true,
|
||||
"defaultOptions": { "wordsPerMinute": 200 },
|
||||
"configSchema": {
|
||||
"type": "object",
|
||||
"properties": { "wordsPerMinute": { "type": "number" } },
|
||||
"additionalProperties": false
|
||||
},
|
||||
"components": {
|
||||
"ReadingTime": {
|
||||
"displayName": "Reading time",
|
||||
"description": "Shows how long a page takes to read",
|
||||
"defaultPosition": "beforeBody",
|
||||
"defaultPriority": 40
|
||||
}
|
||||
},
|
||||
"capabilities": {
|
||||
"provides": { "data": ["readingTime"] }
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Default |
|
||||
| ----------------- | -------------------------------------- | ------------------------------- |
|
||||
| `name` | `string` | the package / directory name |
|
||||
| `displayName` | `string` | `name` |
|
||||
| `description` | `string` | the package's `description` |
|
||||
| `category` | category, or an array of categories | detected from the entry module |
|
||||
| `quartzVersion` | semver range | none (works with every version) |
|
||||
| `deprecated` | `string` | none |
|
||||
| `dependencies` | `string[]` (plugin sources) | `[]` |
|
||||
| `defaultOrder` | `number` | `50` |
|
||||
| `defaultEnabled` | `boolean` | `true` |
|
||||
| `defaultOptions` | object | `{}` |
|
||||
| `configSchema` | JSON Schema of the options object | none |
|
||||
| `components` | `{ [exportName]: { displayName, … } }` | none |
|
||||
| `frames` | `{ [exportName]: { exportName } }` | none |
|
||||
| `requiresInstall` | `boolean` | `false` |
|
||||
| `capabilities` | `{ provides?, requires?, optional? }` | none |
|
||||
|
||||
`author` and `homepage` fall back to the package's own fields; the bug-report link Quartz prints when a plugin fails comes from the package's `bugs` or `repository` field.
|
||||
|
||||
### `name`, `displayName`, `description`
|
||||
|
||||
`name` is the short name Quartz uses in error messages and that other plugins name in the `from` of their [[plugin capabilities|capability]] requirements. `displayName` (used in dependency errors) and `description` describe the plugin to people, e.g. in the TUI.
|
||||
|
||||
### Version
|
||||
|
||||
Quartz uses the package's `version`. A `quartz.version` field (the plugin template used to ship one) is only used when the package has no `version`, so you don't need to keep it in sync.
|
||||
|
||||
### `category`
|
||||
|
||||
One of `"transformer"`, `"filter"`, `"emitter"`, `"pageType"` or `"component"`, or an array for a plugin that is several things at once (e.g. `["transformer", "component"]`). For each processing category (everything except `component`), Quartz looks for the plugin's factory in the entry module (`.`): the `default` export, else a `plugin` export, else the only exported function, else the exported function that returns an instance with that category's methods when called without options. A plugin with several processing categories should therefore not have a `default` export, since Quartz would use it for every category.
|
||||
|
||||
A plugin whose categories are all `"component"` is loaded differently: Quartz imports its entry module for its side effects, calls its `init(options)` export if there is one (see [[creating components#Receiving YAML Options in Component-Only Plugins|receiving YAML options]]) and loads its components.
|
||||
|
||||
Without a `category`, Quartz tries to detect it from the entry module; if it can't and the plugin declares no components, the plugin is skipped with an error. Set it.
|
||||
|
||||
### `quartzVersion`
|
||||
|
||||
The Quartz versions the plugin works with, as a semver range (`">=5.1.0"`). Locally a mismatch is a warning; in CI the build fails. See [[versioning#For plugin authors]].
|
||||
|
||||
### `deprecated`
|
||||
|
||||
A message saying why the plugin is deprecated and what replaces it. Quartz 5.1+ warns while the plugin is enabled (during the build, in `plugin add` and in `plugin doctor`); the plugin keeps working.
|
||||
|
||||
### `dependencies`
|
||||
|
||||
Other plugins that must run for this one to work, as plugin sources. Each one is matched **exactly** against the `source` of the entries in `quartz.config.yaml`: `"@quartz-community/foo"` doesn't match an entry `github:quartz-community/foo`, so use the form the default config uses (the npm package name for official plugins). The build **fails** when a dependency isn't in the config at all, when it runs later than the plugin (its order is higher), or when dependencies form a cycle. A dependency that is in the config but disabled is a warning.
|
||||
|
||||
Don't declare `crawl-links`, `remove-draft` or `content-index`: they are [[built-in processing]] since Quartz 5.1, which treats such a dependency as satisfied by the built-in, but Quartz 5.0 fails the build when the plugin is not in the config. Declare what you need from them as [[plugin capabilities|capabilities]] instead (`requires: { data: ["links"] }`), and order your plugin after them with `defaultOrder`.
|
||||
|
||||
### `defaultOrder`
|
||||
|
||||
Where the plugin runs among plugins of the same category, lower first, when the user's config entry sets no `order`. Built-ins take part in the same scale (on equal order a built-in runs first). For transformers:
|
||||
|
||||
| Order | Transformer |
|
||||
| ----- | ---------------------------------------------- |
|
||||
| 0 | built-in frontmatter (`file.data.frontmatter`) |
|
||||
| 10 | `created-modified-date` |
|
||||
| 20 | `syntax-highlighting` |
|
||||
| 30 | `github-flavored-markdown` |
|
||||
| 40 | `obsidian-flavored-markdown` |
|
||||
| 50 | default |
|
||||
| 60 | built-in links (`file.data.links`) |
|
||||
| 70 | `description` |
|
||||
|
||||
A transformer that reads `file.data.links` must do so in `htmlPlugins` (it isn't set yet while `markdownPlugins` run) and have an order above 60. Filters and emitters run in order too (the built-in drafts filter and content index emitter are at 50), although emitters run in parallel.
|
||||
|
||||
### `defaultEnabled`, `defaultOptions`
|
||||
|
||||
`npx quartz plugin add` writes the plugin's entry with `enabled: defaultEnabled`, `order: defaultOrder` and `options: defaultOptions`, so a later change to `defaultOrder` only reaches entries without an `order`. When Quartz loads the plugin, it merges the options as `{ ...defaultOptions, ...options from quartz.config.yaml, ...options from quartz.ts }` and passes the result to the factory (or to `init`).
|
||||
|
||||
### `configSchema`
|
||||
|
||||
A JSON Schema for the options object. Quartz warns about likely mistakes in a plugin's `options` when it loads the config and in `npx quartz plugin doctor`:
|
||||
|
||||
- an option name that looks like a typo of a known one (`did you mean …?`), or any unknown option when the schema sets `"additionalProperties": false`;
|
||||
- a value of the wrong type (`properties.<name>.type`, with `"integer"` counted as a number);
|
||||
- a value not in `properties.<name>.enum`.
|
||||
|
||||
Options are known from `properties` and from the keys of `defaultOptions`; without a schema, types are inferred from `defaultOptions`, and a value of the same type as an option's default is always accepted.
|
||||
|
||||
First-party plugins declare their options as `optionSchema` instead, a flat map of option name to type that [Quartz Syncer](https://github.com/saberzero1/quartz-syncer) also uses for its settings. Quartz reads it the same way, with `"enum"` plus `values` for a choice:
|
||||
|
||||
```json title="package.json"
|
||||
"optionSchema": {
|
||||
"limit": { "type": "number", "description": "How many notes to list" },
|
||||
"mode": { "type": "enum", "values": ["light", "dark"] },
|
||||
"showTags": { "type": "boolean" }
|
||||
}
|
||||
```
|
||||
|
||||
### `components`
|
||||
|
||||
The components the plugin provides, keyed by export name. Quartz imports them from the package's **`./components`** export (not the entry module) and registers each name it finds there; a name missing from `./components` is reported as a warning. Each entry can set:
|
||||
|
||||
- `displayName`, `description`: describe the component, e.g. in the TUI;
|
||||
- `defaultPosition`: the layout slot used when the user's `layout:` block has no `position` (`header`, `left`, `right`, `beforeBody`, `afterBody` or `footer`). Without either, the component isn't placed;
|
||||
- `defaultPriority`: the order within that slot when the user sets none (default 50, lower first).
|
||||
|
||||
See [[creating components]].
|
||||
|
||||
### `frames`
|
||||
|
||||
[[layout#Page Frames|Page frames]] the plugin provides, keyed by export name, loaded from the package's `./frames` export. See [[making plugins#Providing Custom Frames]].
|
||||
|
||||
### `requiresInstall`
|
||||
|
||||
Set it when the plugin needs native packages that can't be bundled (e.g. `sharp`). Quartz then installs the plugin's `peerDependencies` (except the packages it shares with plugins, like Preact) into the site when it installs the plugin from Git. See [[making plugins#Plugins with Native Dependencies]].
|
||||
|
||||
### `capabilities`
|
||||
|
||||
What the plugin provides to and needs from other plugins (`file.data` keys, DOM classes, globals, events, files, CSS variables), so Quartz can warn when a provider is missing. See [[plugin capabilities]].
|
||||
@@ -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`) needs `">=5.1.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"`. 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`.
|
||||
|
||||
+27
-13
@@ -8,19 +8,19 @@ The `build` command transforms your Markdown content into a static HTML website.
|
||||
|
||||
## Flags
|
||||
|
||||
| Flag | Shorthand | Description | Default |
|
||||
| ----------------- | --------- | --------------------------------------------------------- | ----------------- |
|
||||
| `--directory` | `-d` | The directory containing your Quartz project | Current directory |
|
||||
| `--verbose` | `-v` | Enable detailed logging for debugging | `false` |
|
||||
| `--output` | `-o` | The directory where the built site will be saved | `public` |
|
||||
| `--serve` | | Start a local development server | `false` |
|
||||
| `--watch` | | Rebuild the site when files change | `false` |
|
||||
| `--port` | | The port for the development server | `8080` |
|
||||
| `--wsPort` | | The port for the WebSocket hot-reload server | `3001` |
|
||||
| `--baseDir` | | Set a base directory for the site (e.g. for GitHub Pages) | `/` |
|
||||
| `--remoteDevHost` | | The hostname to use for the development server | `localhost` |
|
||||
| `--bundleInfo` | | Output a JSON file with bundle size information | `false` |
|
||||
| `--concurrency` | `-c` | Number of worker threads to use for building | CPU core count |
|
||||
| Flag | Shorthand | Description | Default |
|
||||
| ----------------- | --------- | ---------------------------------------------------------------------------------- | ------------------ |
|
||||
| `--directory` | `-d` | The content folder | `content` |
|
||||
| `--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` |
|
||||
| `--watch` | | Rebuild the site when files change | `false` |
|
||||
| `--port` | | The port for the development server | `8080` |
|
||||
| `--wsPort` | | The port for the WebSocket hot-reload server | `3001` |
|
||||
| `--baseDir` | | Base path the development server serves the site under | `""` (none) |
|
||||
| `--remoteDevHost` | | Hostname for the hot-reload WebSocket when not developing on localhost | `""` (`localhost`) |
|
||||
| `--bundleInfo` | | Print an analysis of Quartz's own esbuild bundle (files and sizes) to the terminal | `false` |
|
||||
| `--concurrency` | `-c` | Number of worker threads to use for building | CPU core count |
|
||||
|
||||
## Examples
|
||||
|
||||
@@ -56,6 +56,20 @@ If you have a very large vault, you can limit the number of concurrent workers t
|
||||
npx quartz build --concurrency 2
|
||||
```
|
||||
|
||||
### Verbose output
|
||||
|
||||
`npx quartz build --verbose` also prints:
|
||||
|
||||
- the plugins loaded, in the order they run (transformers, filters, emitters, page types)
|
||||
- the [[built-in processing|built-ins]] and whether each is on (with its order) or off, and why
|
||||
- a layout report: which components each page type renders in each slot (see [[layout#Checking your layout]])
|
||||
- every link to a page that is not on the site (including links to drafts) — without `--verbose` the end-of-build summary counts them and shows a few examples
|
||||
- every file each emitter writes
|
||||
|
||||
### In CI
|
||||
|
||||
When the `CI` environment variable is set (GitHub Actions, Cloudflare Pages, Netlify, Vercel, … set it), the build fails on plugins that fail to load or that need a newer Quartz, instead of warning. Set `QUARTZ_ALLOW_BROKEN_PLUGINS=1` or `QUARTZ_ALLOW_INCOMPATIBLE_PLUGINS=1` to build anyway. See [[troubleshooting#Reading build output]].
|
||||
|
||||
## Serve vs Watch
|
||||
|
||||
The `--serve` and `--watch` flags control different behaviors:
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ The `create` command initializes a new Quartz project. It helps you set up your
|
||||
| Flag | Shorthand | Description |
|
||||
| ------------- | --------- | -------------------------------------------------------------------------- |
|
||||
| `--template` | `-t` | Configuration template (`default`, `obsidian`, `ttrpg`, `blog`, or `docs`) |
|
||||
| `--directory` | `-d` | The directory where Quartz will be initialized |
|
||||
| `--directory` | `-d` | The content folder to set up (default: `content`) |
|
||||
| `--source` | `-s` | The source directory of your Markdown files |
|
||||
| `--strategy` | `-X` | How to handle the source files (`new`, `copy`, or `symlink`) |
|
||||
| `--links` | `-l` | How to resolve internal links (`absolute`, `shortest`, or `relative`) |
|
||||
|
||||
+2
-1
@@ -27,6 +27,7 @@ You can run the CLI using `npx quartz`.
|
||||
- [[restore|restore]]: Recover your content folder from the local cache.
|
||||
- [[cli/plugin|plugin]]: Install, add, remove, prune, and configure plugins. Use `plugin install` with flags for lockfile/config sync, updates, and checks, and `plugin doctor` to diagnose plugin problems.
|
||||
- [[tui|tui]]: Use a terminal interface to manage plugins and layout.
|
||||
- `info`: Print your Quartz version (with its git state), 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. See [[versioning]].
|
||||
|
||||
## Global Flags
|
||||
|
||||
@@ -34,7 +35,7 @@ These flags are accepted by every Quartz command:
|
||||
|
||||
| Flag | Shorthand | Description | Default |
|
||||
| --------------- | --------- | ------------------------------------------------------------------------------------------------------- | -------------- |
|
||||
| `--directory` | `-d` | The directory containing your Quartz project | `content` |
|
||||
| `--directory` | `-d` | The content folder (relative to your Quartz project) | `content` |
|
||||
| `--verbose` | `-v` | Enable detailed logging for debugging | `false` |
|
||||
| `--concurrency` | `-c` | Max parallel workers for operations that run in parallel (e.g. `build`, `plugin install`, `plugin add`) | CPU core count |
|
||||
|
||||
|
||||
+4
-2
@@ -25,9 +25,10 @@ npx quartz plugin list
|
||||
|
||||
### add
|
||||
|
||||
Add a new plugin from a Git repository. The plugin is installed, pinned in `quartz.lock.json`, and added to `quartz.config.yaml` with its default options — enabled unless the plugin is disabled by default.
|
||||
Add a new plugin from npm or a Git repository. The plugin is installed (Git plugins are pinned in `quartz.lock.json`, npm packages recorded in `package.json`), and added to `quartz.config.yaml` with its default options — enabled unless the plugin is disabled by default.
|
||||
|
||||
```shell
|
||||
npx quartz plugin add @quartz-community/graph # an npm package, as the default config uses
|
||||
npx quartz plugin add github:username/repo
|
||||
npx quartz plugin add username/repo # same as github:username/repo
|
||||
```
|
||||
@@ -158,7 +159,8 @@ npx quartz plugin doctor --fix # move settings of plugins that are now bui
|
||||
- broken local plugin symlinks and plugins without a built entry point (`dist/`)
|
||||
- option typos and type mismatches, and declared plugin dependencies that are missing or disabled
|
||||
- plugins that don't support your Quartz version (their `quartzVersion`, see [[versioning#Plugin compatibility]])
|
||||
- entries for plugins that are now [[built-in processing|built into Quartz]] (`crawl-links`, `remove-draft`, `content-index`); `--fix` moves their options into `configuration` (keeping your comments) and removes their now unused pins from `quartz.lock.json`
|
||||
- deprecated plugins (their `quartz.deprecated` message names the replacement)
|
||||
- entries for plugins that are now [[built-in processing|built into Quartz]] (`crawl-links`, `remove-draft`, `content-index`) and note-properties' `delimiters`/`language` options; `--fix` moves them into `configuration` (`links`, `drafts`, `contentIndex`, `frontmatter`), keeping your comments, and removes the now unused pins from `quartz.lock.json`
|
||||
- lockfile entries that are no longer configured (clean up with `prune`)
|
||||
|
||||
It exits with status 1 when it finds errors, so it can run as a CI check.
|
||||
|
||||
+19
-17
@@ -6,32 +6,34 @@ The `sync` command automates the process of pushing your local changes to GitHub
|
||||
|
||||
## Flags
|
||||
|
||||
| Flag | Shorthand | Description | Default |
|
||||
| ------------- | --------- | ------------------------------------ | ----------------- |
|
||||
| `--directory` | `-d` | The directory of your Quartz project | Current directory |
|
||||
| `--verbose` | `-v` | Enable detailed logging | `false` |
|
||||
| `--commit` | | Whether to commit changes | `true` |
|
||||
| `--no-commit` | | Skip committing changes | `false` |
|
||||
| `--message` | `-m` | Custom commit message | `update content` |
|
||||
| `--push` | | Whether to push changes to remote | `true` |
|
||||
| `--no-push` | | Skip pushing changes | `false` |
|
||||
| `--pull` | | Whether to pull changes from remote | `true` |
|
||||
| `--no-pull` | | Skip pulling changes | `false` |
|
||||
| Flag | Shorthand | Description | Default |
|
||||
| ------------- | --------- | ----------------------------------- | -------------------------- |
|
||||
| `--directory` | `-d` | The content folder | `content` |
|
||||
| `--verbose` | `-v` | Enable detailed logging | `false` |
|
||||
| `--commit` | | Whether to commit changes | `true` |
|
||||
| `--no-commit` | | Skip committing changes | `false` |
|
||||
| `--message` | `-m` | Custom commit message | `Quartz sync: <date time>` |
|
||||
| `--push` | | Whether to (force-)push to remote | `true` |
|
||||
| `--no-push` | | Skip pushing changes | `false` |
|
||||
| `--pull` | | Whether to pull changes from remote | `true` |
|
||||
| `--no-pull` | | Skip pulling changes | `false` |
|
||||
|
||||
## Workflow
|
||||
|
||||
When you run `npx quartz sync`, Quartz performs the following steps:
|
||||
|
||||
1. **Pull**: It fetches and merges changes from your remote GitHub repository.
|
||||
2. **Add**: It stages all new and modified files in your project.
|
||||
3. **Commit**: It creates a new commit with your changes.
|
||||
4. **Push**: It sends your new commit to GitHub.
|
||||
1. **Commit**: It stages all new and modified files in your project (`git add .`) and commits them.
|
||||
2. **Pull**: It merges the `v5` branch of your repository (`origin`) into your branch.
|
||||
3. **Push**: It force-pushes your current branch to `origin` (`git push -uf`).
|
||||
|
||||
> [!warning] `sync` force-pushes
|
||||
> The push overwrites the remote branch with your local one. If you skip the pull (`--no-pull`) while the remote has commits you don't have — for example from another device or a GitHub edit — those commits are lost on the remote.
|
||||
|
||||
## Common Workflows
|
||||
|
||||
### Regular Sync
|
||||
|
||||
The most common usage is to simply run the command with no flags. This pulls, commits, and pushes everything.
|
||||
The most common usage is to simply run the command with no flags. This commits, pulls, and pushes everything.
|
||||
|
||||
```shell
|
||||
npx quartz sync
|
||||
@@ -69,6 +71,6 @@ If you have a very large number of changes, Git might occasionally fail due to b
|
||||
|
||||
### Autostash
|
||||
|
||||
Quartz uses `git pull --rebase --autostash` internally. This means if you have unstaged changes when you run `sync`, Quartz will temporarily hide them, pull the remote changes, and then bring your changes back. If a conflict occurs during this process, you will need to resolve it manually using standard Git tools.
|
||||
Quartz pulls with `git pull --no-rebase --autostash --no-edit --allow-unrelated-histories`: remote changes are merged (not rebased) without opening an editor, and uncommitted changes (e.g. with `--no-commit`) are set aside during the pull and brought back afterwards. If a conflict occurs, resolve it with standard Git tools, commit, and run `npx quartz sync --no-pull`.
|
||||
|
||||
For more information on initial setup, see [[installation]].
|
||||
+58
-23
@@ -7,18 +7,22 @@ Quartz is meant to be extremely configurable, even if you don't know any coding.
|
||||
> [!tip]
|
||||
> If you edit `quartz.config.yaml` using a text-editor with YAML language support like VSCode, it will warn you when you've made an error in your configuration, helping you avoid configuration mistakes!
|
||||
|
||||
The configuration of Quartz can be broken down into two main parts:
|
||||
The configuration of Quartz can be broken down into three parts:
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
configuration:
|
||||
pageTitle: "My Site"
|
||||
# ... general configuration
|
||||
plugins:
|
||||
- source: github:quartz-community/some-plugin
|
||||
- source: "@quartz-community/explorer"
|
||||
enabled: true
|
||||
# ... plugin entries
|
||||
layout:
|
||||
# ... groups and per-page-type layout overrides
|
||||
```
|
||||
|
||||
`configuration` and `plugins` are described below; the `layout` section (component groups, `byPageType` overrides, sidebar modes) is described in [[layout]].
|
||||
|
||||
## General Configuration
|
||||
|
||||
This part of the configuration concerns anything that can affect the whole site. The following is a list breaking down all the things you can configure:
|
||||
@@ -49,6 +53,7 @@ This part of the configuration concerns anything that can affect the whole site.
|
||||
- `publishAssets`: which non-Markdown files (images, PDFs, …) from `content` are copied to the site.
|
||||
- `"all"` (default): every file that isn't ignored.
|
||||
- `"referenced"`: only files a published page links to or embeds. Use this with [[ExplicitPublish]] or [[private pages|drafts]], so that files only unpublished notes use stay private.
|
||||
- Files that Quartz renders as pages themselves (e.g. `.base` and `.canvas` files) are never copied as raw assets.
|
||||
- `ignorePatterns`: a list of [glob](<https://en.wikipedia.org/wiki/Glob_(programming)>) patterns that Quartz should ignore and not search through when looking for files inside the `content` folder. See [[private pages]] for more details.
|
||||
- `theme`: configure how the site looks.
|
||||
- `fontOrigin`: where to load fonts from.
|
||||
@@ -70,7 +75,7 @@ This part of the configuration concerns anything that can affect the whole site.
|
||||
- `header`: font to use for headers
|
||||
- `code`: font for inline and block quotes
|
||||
- `body`: font for everything
|
||||
- `colors`: controls the theming of the site.
|
||||
- `colors`: controls the theming of the site. It has two color schemes, `lightMode` and `darkMode`, each with the same keys:
|
||||
- `light`: page background
|
||||
- `lightgray`: borders
|
||||
- `gray`: graph links, heavier borders
|
||||
@@ -80,10 +85,25 @@ This part of the configuration concerns anything that can affect the whole site.
|
||||
- `tertiary`: hover states and visited [[graph view|graph]] nodes
|
||||
- `highlight`: internal link background, highlighted text, [[syntax highlighting|highlighted lines of code]]
|
||||
- `textHighlight`: markdown highlighted text background
|
||||
- `frontmatter`, `links`, `drafts`, `contentIndex`: options for Quartz's [[built-in processing]] — frontmatter parsing ([[Frontmatter]]), link resolution ([[CrawlLinks]]), draft handling ([[RemoveDrafts]]) and the content index, sitemap and RSS feed ([[ContentIndex]]). They are on by default; set e.g. `links: { markdownLinkResolution: relative }` to change an option or `contentIndex: false` to turn one off.
|
||||
- `frontmatter`, `links`, `drafts`, `contentIndex`: options for Quartz's [[built-in processing]] — frontmatter parsing ([[Frontmatter]]), link resolution ([[CrawlLinks]]), draft handling ([[RemoveDrafts]]) and the content index, sitemap and RSS feed ([[ContentIndex]]). They are on by default. Each takes an object of options (plus `enabled` and `order`) or a boolean shorthand: set e.g. `links: { markdownLinkResolution: relative }` to change an option or `contentIndex: false` to turn one off.
|
||||
- `links.markdownLinkResolution` defaults to `shortest` (Obsidian's default). An old `crawl-links` plugin entry that Quartz migrates keeps that plugin's default, `absolute`, unless it sets another value.
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
configuration:
|
||||
theme:
|
||||
colors:
|
||||
lightMode:
|
||||
light: "#faf8f8"
|
||||
secondary: "#284b63"
|
||||
# ... the other keys
|
||||
darkMode:
|
||||
light: "#161618"
|
||||
secondary: "#7b97aa"
|
||||
# ... the other keys
|
||||
```
|
||||
|
||||
> [!note] Colors with an Obsidian theme
|
||||
> A theme from [quartz-themes](https://github.com/saberzero1/quartz-themes) (the Obsidian and TTRPG [[create#Templates|templates]] enable one) brings its own color scheme and colors the page through Obsidian's CSS variables (`--text-normal` for most text, `--text-muted` for paragraphs, `--background-primary`, `--interactive-accent`, …). The `colors` above then have little or no effect. To change a theme's colors, override its variables in `quartz/styles/custom.scss`:
|
||||
> A theme from [quartz-themes](https://github.com/saberzero1/quartz-themes) (the [[ThemesCore|@quartz-themes/core]] plugin; the Obsidian and TTRPG [[create#Templates|templates]] enable one) brings its own color scheme and colors the page through Obsidian's CSS variables (`--text-normal` for most text, `--text-muted` for paragraphs, `--background-primary`, `--interactive-accent`, …). The `colors` above then have little or no effect. To change a theme's colors, override its variables in `quartz/styles/custom.scss`:
|
||||
>
|
||||
> ```scss title="quartz/styles/custom.scss"
|
||||
> html[saved-theme="dark"] body {
|
||||
@@ -102,10 +122,10 @@ You can think of Quartz plugins as a series of transformations over content.
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
plugins:
|
||||
- source: github:quartz-community/created-modified-date
|
||||
- source: "@quartz-community/created-modified-date"
|
||||
enabled: true
|
||||
order: 10 # controls execution order
|
||||
- source: github:quartz-community/syntax-highlighting
|
||||
- source: "@quartz-community/syntax-highlighting"
|
||||
enabled: true
|
||||
order: 20
|
||||
# ... more plugins
|
||||
@@ -127,7 +147,7 @@ Plugins are categorized by their type (transformer, filter, emitter, pageType) b
|
||||
> ```
|
||||
|
||||
- [[tags/plugin/transformer|Transformers]] **map** over content (e.g. parsing frontmatter, generating a description)
|
||||
- [[tags/plugin/filter|Filters]] **filter** content (e.g. filtering out drafts)
|
||||
- [[tags/plugin/filter|Filters]] **filter** content (e.g. hiding [[UnlistedPages|unlisted pages]]; dropping drafts is [[built-in processing|built in]])
|
||||
- [[tags/plugin/emitter|Emitters]] **reduce** over content (e.g. creating an RSS feed or pages that list all files with a specific tag)
|
||||
- **Page Types** define how different types of pages are rendered (content pages, folder listings, tag listings). Each page type can use a different [[layout#Page Frames|page frame]] to control its overall HTML structure.
|
||||
|
||||
@@ -144,15 +164,15 @@ See [[layout#Page Frames]] for details on available frames and how frame resolut
|
||||
|
||||
### Internal vs External Plugins
|
||||
|
||||
Quartz distinguishes between internal plugins that are bundled with Quartz and community plugins that are installed separately.
|
||||
Quartz distinguishes between processing that is built into Quartz and plugins that are installed separately.
|
||||
|
||||
In `quartz.config.yaml`, community plugins are referenced by their GitHub source:
|
||||
In `quartz.config.yaml`, the official plugins are referenced by their npm package name (this is what the default config uses); other plugins can also be referenced by a Git source such as `github:org/repo`:
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
plugins:
|
||||
- source: github:quartz-community/explorer
|
||||
- source: "@quartz-community/explorer"
|
||||
enabled: true
|
||||
- source: github:quartz-community/syntax-highlighting
|
||||
- source: "@quartz-community/syntax-highlighting"
|
||||
enabled: true
|
||||
options:
|
||||
theme:
|
||||
@@ -160,14 +180,15 @@ plugins:
|
||||
dark: github-dark
|
||||
```
|
||||
|
||||
Internal plugins (like `FrontMatter`) are bundled with Quartz. Community plugins are installed separately and referenced by their `github:org/repo` source.
|
||||
Frontmatter parsing, link resolution, drafts and the content index are not plugins: they are [[built-in processing|built into Quartz]] and configured under `configuration.frontmatter`, `.links`, `.drafts` and `.contentIndex`. Everything else is a plugin, referenced by its source: npm plugins (all the default ones) are installed in `node_modules`, Git and local plugins in `.quartz/plugins/`.
|
||||
|
||||
### Community Plugins
|
||||
|
||||
To install a community plugin, you can use the following command:
|
||||
|
||||
```shell
|
||||
npx quartz plugin add github:quartz-community/explorer
|
||||
npx quartz plugin add @quartz-community/explorer # an npm package
|
||||
npx quartz plugin add github:username/repo # a Git repository
|
||||
```
|
||||
|
||||
This adds the plugin to `quartz.config.yaml` and installs it to `.quartz/plugins/`.
|
||||
@@ -192,7 +213,9 @@ The `source` field for a plugin can be either a simple string or an object with
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
plugins:
|
||||
- source: github:quartz-community/explorer
|
||||
- source: "@quartz-community/explorer"
|
||||
enabled: true
|
||||
- source: github:username/repo
|
||||
enabled: true
|
||||
```
|
||||
|
||||
@@ -217,18 +240,27 @@ The object form supports the following fields:
|
||||
| `ref` | ❌ | Git ref (branch or tag) to pin to. Equivalent to the `#ref` suffix on string sources. |
|
||||
| `name` | ❌ | Override the directory name used in `.quartz/plugins/`. Defaults to the repository name. |
|
||||
|
||||
> [!example] Real-world example
|
||||
> The [quartz-themes](https://github.com/saberzero1/quartz-themes) plugin lives in the `plugin/` subdirectory of its repository. To install it:
|
||||
> [!example] Example
|
||||
> A plugin in the `plugin/` subdirectory of a repository, pinned to a tag:
|
||||
>
|
||||
> ```yaml title="quartz.config.yaml"
|
||||
> plugins:
|
||||
> - source:
|
||||
> name: quartz-themes
|
||||
> repo: "https://github.com/saberzero1/quartz-themes.git"
|
||||
> name: my-plugin
|
||||
> repo: "https://github.com/user/repo.git"
|
||||
> subdir: plugin
|
||||
> ref: v1.0.0
|
||||
> enabled: true
|
||||
> ```
|
||||
>
|
||||
> Themes from [quartz-themes](https://github.com/saberzero1/quartz-themes) don't need this: they are published to npm as `@quartz-themes/core` and the default config already has a (disabled) entry for it:
|
||||
>
|
||||
> ```yaml title="quartz.config.yaml"
|
||||
> plugins:
|
||||
> - source: "@quartz-themes/core"
|
||||
> enabled: true
|
||||
> options:
|
||||
> theme: "tokyo-night"
|
||||
> theme: tokyo-night
|
||||
> mode: both
|
||||
> ```
|
||||
|
||||
@@ -241,7 +273,7 @@ You can customize the behaviour of Quartz by adding, removing and reordering plu
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
plugins:
|
||||
- source: github:quartz-community/note-properties
|
||||
- source: "@quartz-community/note-properties"
|
||||
enabled: true
|
||||
options:
|
||||
includeAll: false
|
||||
@@ -250,7 +282,7 @@ plugins:
|
||||
- tags
|
||||
- aliases
|
||||
order: 5
|
||||
- source: github:quartz-community/created-modified-date
|
||||
- source: "@quartz-community/created-modified-date"
|
||||
enabled: true
|
||||
options:
|
||||
priority:
|
||||
@@ -258,7 +290,7 @@ plugins:
|
||||
- git
|
||||
- filesystem
|
||||
order: 10
|
||||
- source: github:quartz-community/latex
|
||||
- source: "@quartz-community/latex"
|
||||
enabled: true
|
||||
options:
|
||||
renderEngine: katex
|
||||
@@ -304,6 +336,9 @@ configuration:
|
||||
code: IBM Plex Mono
|
||||
```
|
||||
|
||||
> [!note]
|
||||
> Quartz uses `title`, but the config's JSON schema doesn't list it yet, so an editor with YAML validation may flag it. The warning can be ignored.
|
||||
|
||||
For more control over font weights and italics, use the TS override in `quartz.ts`:
|
||||
|
||||
```ts title="quartz.ts"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: Customizing Components
|
||||
---
|
||||
|
||||
In Quartz v4, components such as the footer lived in `quartz/components/` and you customized them by editing their source. In v5, most components are [[configuration#Plugins|community plugins]]: Quartz installs them into `.quartz/plugins/` and runs their **built** code (`dist/`). Editing the files in `.quartz/plugins/` therefore has no effect, and is overwritten the next time the plugin is installed or updated.
|
||||
In Quartz v4, components such as the footer lived in `quartz/components/` and you customized them by editing their source. In v5, most components are [[configuration#Plugins|community plugins]], and Quartz runs their **built** code (`dist/`). The default plugins are npm packages in `node_modules/@quartz-community/`; plugins installed from Git live in `.quartz/plugins/`. Editing either copy is the wrong approach: changes to the source have no effect until it is rebuilt, and both are overwritten the next time the plugin is installed or updated.
|
||||
|
||||
There are four ways to change a component, from least to most effort. Try them in this order.
|
||||
|
||||
|
||||
+17
-2
@@ -9,7 +9,22 @@ Quartz supports rendering [Obsidian Bases](https://obsidian.md/help/bases) (`.ba
|
||||
> [!note]
|
||||
> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page.
|
||||
|
||||
Bases support is provided by the [[BasesPage]] plugin. See the plugin page for configuration options, built-in views, the expression engine, and how to extend with custom views.
|
||||
Bases support is provided by the [[BasesPage]] plugin, which is enabled by default. See the plugin page for configuration options, built-in views, notes on the expression language, and how to extend with custom views.
|
||||
|
||||
## Changed in Quartz 5.1 (bases-page 1.2)
|
||||
|
||||
Bases now behave like Obsidian's in many details. If you upgrade, check filters and formulas that rely on the old behaviour:
|
||||
|
||||
- A base opens on its **first view** (it used to open on the first table view); `defaultViewType` has no default.
|
||||
- `file.name` of a Markdown note has no extension (`Note`); other files keep it (`Plan.canvas`). `file.fullname` always has it.
|
||||
- `file.tags` keeps `#` and the tags' original case; the `tags` property holds only frontmatter tags. `hasTag()` matches nested tags and is true if **any** of the given tags match.
|
||||
- Dates display in the site's locale; `date()` only parses ISO-style strings. Subtracting dates gives a duration (`9 days`) with `.days`, `.hours`, … fields.
|
||||
- `imageAspectRatio` is height / width; `file.folder` of a root file is `/`; `contains()` on text ignores case.
|
||||
- `this` in an embedded base refers to the embedding note.
|
||||
- Tags link to tag pages; links to missing notes are marked broken.
|
||||
- `.base` pages follow the site's publish filters, such as [[ExplicitPublish]].
|
||||
|
||||
See [[BasesPage#Obsidian compatibility]] for details.
|
||||
|
||||
## Demo
|
||||
|
||||
@@ -17,5 +32,5 @@ Bases support is provided by the [[BasesPage]] plugin. See the plugin page for c
|
||||
|
||||
## Customization
|
||||
|
||||
- Install: `npx quartz plugin add github:quartz-community/bases-page`
|
||||
- Install: `npx quartz plugin add @quartz-community/bases-page`
|
||||
- Source: [`quartz-community/bases-page`](https://github.com/quartz-community/bases-page)
|
||||
@@ -9,7 +9,7 @@ Quartz supports rendering [JSON Canvas](https://jsoncanvas.org) (`.canvas`) file
|
||||
> [!note]
|
||||
> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page.
|
||||
|
||||
Canvas support is provided by the [[CanvasPage]] plugin. See the plugin page for configuration options and a full list of supported features.
|
||||
Canvas support is provided by the [[CanvasPage]] plugin, which is enabled by default. See the plugin page for configuration options and a full list of supported features.
|
||||
|
||||
## Demo
|
||||
|
||||
@@ -17,5 +17,5 @@ Canvas support is provided by the [[CanvasPage]] plugin. See the plugin page for
|
||||
|
||||
## Customization
|
||||
|
||||
- Install: `npx quartz plugin add github:quartz-community/canvas-page`
|
||||
- Install: `npx quartz plugin add @quartz-community/canvas-page`
|
||||
- Source: [`quartz-community/canvas-page`](https://github.com/quartz-community/canvas-page)
|
||||
@@ -4,7 +4,7 @@ tags:
|
||||
- feature/transformer
|
||||
---
|
||||
|
||||
Quartz uses [Katex](https://katex.org/) by default to typeset both inline and block math expressions at build time.
|
||||
Quartz uses [Katex](https://katex.org/) by default to typeset both inline and block math expressions at build time. [MathJax](https://www.mathjax.org/) and [Typst](https://typst.app/) are available with the [[plugins/Latex|Latex]] plugin's `renderEngine` option (`katex`, `mathjax` or `typst`).
|
||||
|
||||
## Syntax
|
||||
|
||||
|
||||
@@ -8,12 +8,12 @@ Quartz supports [Mermaid](https://mermaid.js.org) for diagrams and charts in you
|
||||
|
||||
Default renderer is Mermaid.js. Set `diagramRenderer: pele` on [[ObsidianFlavoredMarkdown]] to use [Pele](https://pele.run) instead. Mermaid.js is deprecated; Pele will become the default later.
|
||||
|
||||
> [!warning]
|
||||
> Wondering why Mermaid diagrams may not be showing up even if you have them enabled? You may need to reorder your plugins so that [[ObsidianFlavoredMarkdown]] is _after_ [[SyntaxHighlighting]].
|
||||
> [!note]
|
||||
> In the default config [[ObsidianFlavoredMarkdown]] (`order: 40`) runs after [[SyntaxHighlighting]] (`order: 20`). If Mermaid diagrams don't show up and you changed either `order`, restore that sequence.
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
plugins:
|
||||
- source: github:quartz-community/obsidian-flavored-markdown
|
||||
- source: "@quartz-community/obsidian-flavored-markdown"
|
||||
options:
|
||||
mermaid: true
|
||||
diagramRenderer: pele # default: mermaid
|
||||
|
||||
@@ -8,7 +8,9 @@ Quartz was originally designed as a tool to publish Obsidian vaults as websites.
|
||||
|
||||
By default, Quartz ships with the [[ObsidianFlavoredMarkdown]] plugin, which is a transformer plugin that adds support for [Obsidian Flavored Markdown](https://help.obsidian.md/Editing+and+formatting/Obsidian+Flavored+Markdown). This includes support for features like [[wikilinks]] and [[Mermaid diagrams]].
|
||||
|
||||
It also ships with support for [frontmatter parsing](https://help.obsidian.md/Editing+and+formatting/Properties) with the same fields that Obsidian uses through its built-in [[Frontmatter]] transformer plugin.
|
||||
Since ObsidianFlavoredMarkdown 2.0, Markdown renders as it does in Obsidian: by default (`preset: "legacy"`) it parses with Obsidian's own parser. This replaces the Markdown parser, so other plugins' syntax extensions are not used and only YAML frontmatter is recognized. Use `preset: "strict"` (CommonMark/GFM as specified plus Obsidian's syntax) for TOML (`+++`) frontmatter or plugins that add their own Markdown syntax. [[GitHubFlavoredMarkdown]] runs before it (order 30, then 40); if you set `order` for either plugin, keep GitHubFlavoredMarkdown first.
|
||||
|
||||
It also ships with support for [frontmatter parsing](https://help.obsidian.md/Editing+and+formatting/Properties) with the same fields that Obsidian uses, [[built-in processing|built into Quartz]] ([[Frontmatter]], configured under `configuration.frontmatter`).
|
||||
|
||||
Finally, Quartz's built-in [[CrawlLinks|link processing]] (`configuration.links`) lets you customize link resolution to match Obsidian.
|
||||
|
||||
@@ -37,6 +39,10 @@ Inside tables, pipes in wikilinks can be escaped with a backslash:
|
||||
| [[page\|alias]] |
|
||||
```
|
||||
|
||||
### Line breaks
|
||||
|
||||
A single line break inside a paragraph renders as a line break (`<br>`), as in Obsidian's default reading view. Set `strictLineBreaks: true` in the ObsidianFlavoredMarkdown options to join the lines with a space instead, like Obsidian's "Strict line breaks" setting. It defaults to `true` under `preset: "strict"`.
|
||||
|
||||
### Highlights
|
||||
|
||||
Wrap text in `==` to highlight it:
|
||||
@@ -196,10 +202,11 @@ By default, Obsidian does not render its Markdown syntax inside HTML blocks. Qua
|
||||
|
||||
### Footnotes
|
||||
|
||||
Footnotes using the `[^1]` syntax are fully supported through the [[GitHubFlavoredMarkdown]] plugin:
|
||||
Footnotes using the `[^1]` syntax and inline footnotes (`^[…]`) are supported by the [[ObsidianFlavoredMarkdown]] plugin. Both are numbered in order; an undefined footnote reference shows its bare label, as in Obsidian:
|
||||
|
||||
```markdown
|
||||
Here is a sentence with a footnote.[^1]
|
||||
Here is one with an inline footnote.^[This is the inline footnote content.]
|
||||
|
||||
[^1]: This is the footnote content.
|
||||
```
|
||||
@@ -208,12 +215,13 @@ Here is a sentence with a footnote.[^1]
|
||||
|
||||
Quartz focuses on supporting Obsidian's core features. Functionality from Obsidian community plugins is handled by Quartz community plugins:
|
||||
|
||||
| Obsidian Plugin | Quartz Support |
|
||||
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Dataview | Supported via [Quartz Syncer](https://community.obsidian.md/plugins/quartz-syncer) — exports Dataview queries as static content during sync |
|
||||
| Excalidraw | Supported via the `obsidian-plugin-excalidraw` community plugin |
|
||||
| Leaflet Maps | Supported via the `obsidian-plugin-leaflet` community plugin |
|
||||
| Style Settings | Supported via the `quartz-themes` community plugin |
|
||||
| Obsidian Plugin | Quartz Support |
|
||||
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Dataview | Supported via [Quartz Syncer](https://community.obsidian.md/plugins/quartz-syncer) — exports Dataview queries as static content during sync |
|
||||
| Excalidraw | Supported via the [[ObsidianPluginExcalidraw\|obsidian-plugin-excalidraw]] community plugin |
|
||||
| Leaflet Maps | Supported via the `obsidian-plugin-leaflet` community plugin |
|
||||
| TTRPG Tools: Maps | Supported via the [[ObsidianPluginTtrpgToolsMaps\|obsidian-plugin-ttrpg-tools-maps]] community plugin |
|
||||
| Style Settings | Supported via the [[ThemesCore\|@quartz-themes/core]] plugin |
|
||||
|
||||
> [!tip]
|
||||
> As a general rule: Obsidian core features are supported by Quartz directly, while Obsidian community plugin features are supported by corresponding Quartz community plugins. Not all Obsidian community plugins will have Quartz equivalents, but popular ones are likely to be supported by the community.
|
||||
|
||||
@@ -8,37 +8,37 @@ tags:
|
||||
|
||||
Because the Markdown generated by ox-hugo is not pure Markdown but Hugo specific, we need to transform it to fit into Quartz. This is done by the [[OxHugoFlavoredMarkdown]] plugin. Even though this plugin was written with `ox-hugo` in mind, it should work for any Hugo specific Markdown.
|
||||
|
||||
The plugin is in the default `quartz.config.yaml` but disabled; set `enabled: true` on its entry. ox-hugo usually writes TOML frontmatter (`+++`), which Quartz's [[Frontmatter|built-in frontmatter parsing]] reads when configured under `configuration.frontmatter`. [[ObsidianFlavoredMarkdown]]'s default `legacy` preset only recognizes YAML frontmatter, so switch it to `preset: strict` too:
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
configuration:
|
||||
frontmatter:
|
||||
delimiters: "+++"
|
||||
language: toml # if using toml frontmatter
|
||||
plugins:
|
||||
- source: github:quartz-community/obsidian-flavored-markdown
|
||||
- source: "@quartz-community/github-flavored-markdown"
|
||||
enabled: true
|
||||
order: 30
|
||||
- source: github:quartz-community/ox-hugo
|
||||
enabled: true
|
||||
order: 25 # must come before obsidian-flavored-markdown
|
||||
- source: github:quartz-community/github-flavored-markdown
|
||||
enabled: true
|
||||
order: 40
|
||||
- source: github:quartz-community/note-properties
|
||||
- source: "@quartz-community/obsidian-flavored-markdown"
|
||||
enabled: true
|
||||
options:
|
||||
delimiters: "+++"
|
||||
language: toml # if using toml frontmatter
|
||||
order: 5
|
||||
preset: strict # needed for TOML (+++) frontmatter
|
||||
order: 40
|
||||
- source: "@quartz-community/ox-hugo"
|
||||
enabled: true
|
||||
order: 91
|
||||
```
|
||||
|
||||
For the TS override approach, place overrides before `loadQuartzConfig()` in `quartz.ts`:
|
||||
OxHugoFlavoredMarkdown rewrites the Markdown source before it is parsed, so its `order` relative to the other Markdown plugins doesn't matter.
|
||||
|
||||
For options that need code, place overrides before `loadQuartzConfig()` in `quartz.ts`:
|
||||
|
||||
```ts title="quartz.ts (override)"
|
||||
import * as ExternalPlugin from "./.quartz/plugins"
|
||||
|
||||
ExternalPlugin.NoteProperties({ delims: "+++", language: "toml" })
|
||||
ExternalPlugin.OxHugoFlavouredMarkdown()
|
||||
ExternalPlugin.OxHugoFlavouredMarkdown({ replaceOrgLatex: false })
|
||||
```
|
||||
|
||||
> [!note]
|
||||
> In YAML, plugin execution order is controlled by the `order` field. Lower numbers execute first. Ensure `ox-hugo` has a lower `order` than `obsidian-flavored-markdown`.
|
||||
|
||||
## Usage
|
||||
|
||||
Quartz by default doesn't understand `org-roam` files as they aren't Markdown. You're responsible for using an external tool like `ox-hugo` to export the `org-roam` files as Markdown content to Quartz and managing the static assets so that they're available in the final output.
|
||||
|
||||
@@ -9,14 +9,16 @@ tags:
|
||||
Quartz supports transforming the special Markdown syntax from Roam Research (like `{{[[components]]}}` and other formatting) into
|
||||
regular Markdown via the [[RoamFlavoredMarkdown]] plugin.
|
||||
|
||||
The plugin is in the default `quartz.config.yaml` but disabled; set `enabled: true` on its entry:
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
plugins:
|
||||
- source: github:quartz-community/roam
|
||||
- source: "@quartz-community/obsidian-flavored-markdown"
|
||||
enabled: true
|
||||
order: 25 # must come before obsidian-flavored-markdown
|
||||
- source: github:quartz-community/obsidian-flavored-markdown
|
||||
order: 40
|
||||
- source: "@quartz-community/roam"
|
||||
enabled: true
|
||||
order: 30
|
||||
order: 92
|
||||
```
|
||||
|
||||
For the TS override approach, place overrides before `loadQuartzConfig()` in `quartz.ts`:
|
||||
@@ -28,7 +30,7 @@ ExternalPlugin.RoamFlavoredMarkdown()
|
||||
```
|
||||
|
||||
> [!warning]
|
||||
> In YAML, plugin execution order is controlled by the `order` field. Ensure `roam` has a lower `order` value than `obsidian-flavored-markdown` so it runs first.
|
||||
> With [[ObsidianFlavoredMarkdown]]'s wikilinks on (the default), syntax built on `[[…]]` — `{{[[TODO]]}}`, `{{[[DONE]]}}`, `[[>]]` — is parsed as a wikilink before this plugin runs, whatever the `order`, so it renders as a link. `^^highlight^^` and the other syntax not built on `[[…]]` work.
|
||||
|
||||
## Customization
|
||||
|
||||
|
||||
@@ -11,5 +11,8 @@ Under the hood, this is done by hijacking page navigations and instead fetching
|
||||
## Configuration
|
||||
|
||||
- Disable SPA Routing: set the `enableSPA` field of the [[configuration]] in `quartz.config.yaml` to be `false`.
|
||||
- Exclude a single link: add `data-router-ignore` to it in HTML; it is followed with a normal page load. Links with `target="_blank"` and links to other sites are never handled by the router. `data-router-noscroll` keeps the scroll position when the link is followed.
|
||||
|
||||
Pages are fetched ahead of a click by [[prefetching]], which the router uses to show them at once.
|
||||
Pages are fetched ahead of a click by [[prefetching]], which the router uses to show them at once; the fetched pages are also reused by [[popover previews]].
|
||||
|
||||
Redirects are followed: when a link is redirected (for example `folder` → `folder/` on static hosts, or an alias page to its canonical page), the address bar shows the final URL and relative links on the new page resolve against it.
|
||||
@@ -13,5 +13,5 @@ A backlink for a note is a link from another note to that note. Links in the bac
|
||||
|
||||
- Removing backlinks: remove the `backlinks` entry from `quartz.config.yaml` or set `enabled: false`.
|
||||
- Hide when empty: hide `Backlinks` if given page doesn't contain any backlinks (default to `true`). To disable this, set `hideWhenEmpty: false` in the plugin options in `quartz.config.yaml`.
|
||||
- Install: `npx quartz plugin add github:quartz-community/backlinks`
|
||||
- Install: `npx quartz plugin add @quartz-community/backlinks`
|
||||
- Source: [`quartz-community/backlinks`](https://github.com/quartz-community/backlinks)
|
||||
@@ -19,7 +19,7 @@ For example, here's what the default configuration looks like:
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
plugins:
|
||||
- source: github:quartz-community/breadcrumbs
|
||||
- source: "@quartz-community/breadcrumbs"
|
||||
enabled: true
|
||||
options:
|
||||
spacerSymbol: "❯"
|
||||
@@ -29,11 +29,14 @@ plugins:
|
||||
layout:
|
||||
position: beforeBody
|
||||
priority: 5
|
||||
condition: not-index # no breadcrumbs on the home page
|
||||
```
|
||||
|
||||
For the TS override approach:
|
||||
|
||||
```ts title="quartz.ts (override)"
|
||||
import * as ExternalPlugin from "./.quartz/plugins"
|
||||
|
||||
// Must be placed before loadQuartzConfig()
|
||||
ExternalPlugin.Breadcrumbs({
|
||||
spacerSymbol: "❯",
|
||||
@@ -50,5 +53,5 @@ You can also adjust where the breadcrumbs will be displayed by changing the `lay
|
||||
Want to customize it even more?
|
||||
|
||||
- Removing breadcrumbs: remove the `breadcrumbs` entry from `quartz.config.yaml` or set `enabled: false`.
|
||||
- Install: `npx quartz plugin add github:quartz-community/breadcrumbs`
|
||||
- Install: `npx quartz plugin add @quartz-community/breadcrumbs`
|
||||
- Source: [`quartz-community/breadcrumbs`](https://github.com/quartz-community/breadcrumbs)
|
||||
@@ -63,6 +63,8 @@ A plugin can take over a built-in by declaring that it provides the same thing i
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
@@ -83,5 +85,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-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`.
|
||||
- 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]].
|
||||
@@ -8,7 +8,7 @@ Quartz supports the same Admonition-callout syntax as Obsidian.
|
||||
|
||||
This includes
|
||||
|
||||
- 12 Distinct callout types (each with several aliases)
|
||||
- 13 distinct callout types (most with several aliases)
|
||||
- Collapsable callouts
|
||||
|
||||
```
|
||||
@@ -18,8 +18,8 @@ This includes
|
||||
|
||||
See [documentation on supported types and syntax here](https://help.obsidian.md/Editing+and+formatting/Callouts).
|
||||
|
||||
> [!warning]
|
||||
> Wondering why callouts may not be showing up even if you have them enabled? You may need to reorder your plugins so that [[ObsidianFlavoredMarkdown]] is _after_ [[SyntaxHighlighting]].
|
||||
> [!note]
|
||||
> In the default config [[ObsidianFlavoredMarkdown]] (`order: 40`) runs after [[SyntaxHighlighting]] (`order: 20`). If callouts don't show up and you changed either `order`, restore that sequence.
|
||||
|
||||
## Customization
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ tags:
|
||||
- component
|
||||
---
|
||||
|
||||
Quartz also has the ability to hook into various providers to enable readers to leave comments on your site.
|
||||
Quartz can add a comment section to your pages with the [[plugins/Comments|Comments]] plugin, so readers can leave comments on your site.
|
||||
|
||||
> [!note]
|
||||
> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page.
|
||||
@@ -33,11 +33,11 @@ After entering both your repository and selecting the discussion category, Giscu
|
||||
|
||||
![[giscus-results.png]]
|
||||
|
||||
Finally, in `quartz.config.yaml`, add the comments plugin with the following options (using the values you got from above):
|
||||
Finally, in `quartz.config.yaml`, enable the comments plugin (it is in the default configuration but disabled) and fill in the values you got from above:
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
plugins:
|
||||
- source: github:quartz-community/comments
|
||||
- source: "@quartz-community/comments"
|
||||
enabled: true
|
||||
options:
|
||||
provider: giscus
|
||||
@@ -56,6 +56,7 @@ For the TS override approach:
|
||||
|
||||
```ts title="quartz.ts (override)"
|
||||
// If using quartz.ts overrides instead of YAML:
|
||||
import * as ExternalPlugin from "./.quartz/plugins"
|
||||
import { loadQuartzConfig, loadQuartzLayout } from "./quartz/plugins/loader/config-loader"
|
||||
|
||||
const config = await loadQuartzConfig()
|
||||
@@ -79,7 +80,7 @@ export const layout = await loadQuartzLayout({
|
||||
```
|
||||
|
||||
> [!note]
|
||||
> Install the comments plugin first: `npx quartz plugin add github:quartz-community/comments`
|
||||
> If the plugin is not in your configuration, install it first: `npx quartz plugin add @quartz-community/comments`
|
||||
|
||||
### Customization
|
||||
|
||||
@@ -95,7 +96,7 @@ type Options = {
|
||||
categoryId: string
|
||||
|
||||
// Url to folder with custom themes
|
||||
// defaults to 'https://${cfg.baseUrl}/static/giscus'
|
||||
// defaults to 'https://${baseUrl}/static/giscus'
|
||||
themeUrl?: string
|
||||
|
||||
// filename for light theme .css file
|
||||
@@ -131,13 +132,13 @@ type Options = {
|
||||
|
||||
#### Custom CSS theme
|
||||
|
||||
Quartz supports custom theme for Giscus. To use a custom CSS theme, place the `.css` file inside the `quartz/static` folder and set the configuration values.
|
||||
Quartz supports custom themes for Giscus. By default Giscus loads `light.css` and `dark.css` from `https://<baseUrl>/static/giscus`, which Quartz ships in `quartz/static/giscus/` (this needs `baseUrl` to be set to your real domain). To use a custom CSS theme, place the `.css` file inside the `quartz/static/giscus` folder and set the configuration values.
|
||||
|
||||
For example, if you have a light theme `light-theme.css`, a dark theme `dark-theme.css`, and your Quartz site is hosted at `https://example.com/`:
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
plugins:
|
||||
- source: github:quartz-community/comments
|
||||
- source: "@quartz-community/comments"
|
||||
enabled: true
|
||||
options:
|
||||
provider: giscus
|
||||
@@ -149,6 +150,7 @@ plugins:
|
||||
```
|
||||
|
||||
```ts title="quartz.ts (override)"
|
||||
import * as ExternalPlugin from "./.quartz/plugins"
|
||||
import { loadQuartzConfig, loadQuartzLayout } from "./quartz/plugins/loader/config-loader"
|
||||
|
||||
const config = await loadQuartzConfig()
|
||||
|
||||
@@ -12,7 +12,7 @@ Quartz supports darkmode out of the box that respects the user's theme preferenc
|
||||
## Customization
|
||||
|
||||
- Removing darkmode: remove the `darkmode` entry from `quartz.config.yaml` or set `enabled: false`.
|
||||
- Install: `npx quartz plugin add github:quartz-community/darkmode`
|
||||
- Install: `npx quartz plugin add @quartz-community/darkmode`
|
||||
- Source: [`quartz-community/darkmode`](https://github.com/quartz-community/darkmode)
|
||||
|
||||
You can also listen to the `themechange` event to perform any custom logic when the theme changes.
|
||||
|
||||
@@ -11,17 +11,17 @@ Quartz features an explorer that allows you to navigate all files and folders on
|
||||
|
||||
## Installation
|
||||
|
||||
The Explorer is available as a community plugin from GitHub:
|
||||
The Explorer is part of the default `quartz.config.yaml`. If your config doesn't have it, add it with:
|
||||
|
||||
```bash
|
||||
npm install github:quartz-community/explorer --legacy-peer-deps
|
||||
npx quartz plugin add @quartz-community/explorer
|
||||
```
|
||||
|
||||
Then add it to your `quartz.config.yaml`:
|
||||
This adds an entry like this to your `quartz.config.yaml`:
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
plugins:
|
||||
- source: github:quartz-community/explorer
|
||||
- source: "@quartz-community/explorer"
|
||||
enabled: true
|
||||
layout:
|
||||
position: left
|
||||
@@ -41,17 +41,17 @@ Display names for folders get determined by the `title` frontmatter field in `fo
|
||||
|
||||
## Customization
|
||||
|
||||
Most configuration can be done by passing in options to `Explorer()`.
|
||||
Most configuration can be done through the plugin's `options`.
|
||||
|
||||
For example, here's what the default configuration looks like:
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
plugins:
|
||||
- source: github:quartz-community/explorer
|
||||
- source: "@quartz-community/explorer"
|
||||
enabled: true
|
||||
options:
|
||||
title: Explorer
|
||||
folderClickBehavior: collapse # "link" to navigate or "collapse" to toggle
|
||||
title: Explorer # defaults to the translated "Explorer"
|
||||
folderClickBehavior: link # "link" to navigate or "collapse" to toggle
|
||||
folderDefaultState: collapsed # "collapsed" or "open"
|
||||
useSavedState: true
|
||||
layout:
|
||||
@@ -171,7 +171,7 @@ Using this example, the explorer will alphabetically sort everything.
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
plugins:
|
||||
- source: github:quartz-community/explorer
|
||||
- source: "@quartz-community/explorer"
|
||||
enabled: true
|
||||
options:
|
||||
# Simple options go in YAML
|
||||
|
||||
@@ -8,13 +8,13 @@ Quartz emits listing pages for any folders and tags you have.
|
||||
|
||||
## Folder Listings
|
||||
|
||||
Quartz will generate an index page for all the pages under that folder. This includes any content that is multiple levels deep.
|
||||
Quartz will generate an index page for all the pages under that folder. This includes any content that is multiple levels deep, and pages rendered from other files such as [[Bases|`.base`]] and [[Canvas|`.canvas`]] files: a folder that holds only such pages gets a folder page too.
|
||||
|
||||
Additionally, Quartz will also generate pages for subfolders. Say you have a note in a nested folder `content/abc/def/note.md`. Then Quartz would generate a page for all the notes under `abc` _and_ a page for all the notes under `abc/def`.
|
||||
|
||||
You can link to the folder listing by referencing its name, plus a trailing slash, like this: `[[advanced/]]` (results in [[advanced/]]).
|
||||
|
||||
By default, Quartz will title the page `Folder: <folder name>` and no description. You can override this by creating an `index.md` file in the folder with the `title` [[authoring content#Syntax|frontmatter]] field. Any content you write in this file will also be used in the folder description.
|
||||
By default, Quartz will title the page with the folder name (set the [[FolderPage]] option `prefixFolders: true` for `Folder: <folder name>`) and no description. You can override this by creating an `index.md` file in the folder with the `title` [[authoring content#Syntax|frontmatter]] field. Any content you write in this file will also be used in the folder description.
|
||||
|
||||
For example, for the folder `content/posts`, you can add another file `content/posts/index.md` to add a specific description for it.
|
||||
|
||||
@@ -26,7 +26,7 @@ Quartz also supports tag hierarchies as well (e.g. `plugin/emitter`) and will al
|
||||
|
||||
You can link to the tag listing by referencing its name with a `tag/` prefix, like this: `[[tags/plugin]]` (results in [[tags/plugin]]).
|
||||
|
||||
As with folder listings, you can also provide a description and title for a tag page by creating a file for each tag. For example, if you wanted to create a custom description for the #component tag, you would create a file at `content/tags/component.md` with a title and description.
|
||||
Tag pages are titled with the tag name (set the [[TagPage]] option `prefixTags: true` for `Tag: <tag>`). As with folder listings, you can also provide a description and title for a tag page by creating a file for each tag. For example, if you wanted to create a custom description for the #component tag, you would create a file at `content/tags/component.md` with a title and description.
|
||||
|
||||
## Customization
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ Full-text search in Quartz is powered by [Flexsearch](https://github.com/nextapp
|
||||
> [!note]
|
||||
> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page.
|
||||
|
||||
It can be opened by either clicking on the search bar or pressing `⌘`/`ctrl` + `K`. The top 5 search results are shown on each query. Matching subterms are highlighted and the most relevant 30 words are excerpted. Clicking on a search result will navigate to that page.
|
||||
It can be opened by either clicking on the search bar or pressing `⌘`/`ctrl` + `K`. The top 8 search results are shown on each query, each with up to 5 of its tags. Matching subterms are highlighted and the most relevant 30 words are excerpted. Clicking on a search result will navigate to that page.
|
||||
|
||||
To search content by tags, you can either press `⌘`/`ctrl` + `shift` + `K` or start your query with `#` (e.g. `#components`).
|
||||
|
||||
@@ -22,10 +22,10 @@ This component is also keyboard accessible: Tab and Shift+Tab will cycle forward
|
||||
|
||||
By default, it indexes every page on the site with **Markdown syntax removed**. This means link URLs for instance are not indexed.
|
||||
|
||||
It properly tokenizes Chinese, Korean, and Japenese characters and constructs separate indexes for the title, content and tags, weighing title matches above content matches.
|
||||
It properly tokenizes Chinese, Korean, and Japanese characters and constructs separate indexes for the title, content and tags, weighing title matches above content matches.
|
||||
|
||||
## Customization
|
||||
|
||||
- Removing search: remove the `search` entry from `quartz.config.yaml` or set `enabled: false`.
|
||||
- Install: `npx quartz plugin add github:quartz-community/search`
|
||||
- Install: `npx quartz plugin add @quartz-community/search`
|
||||
- Source: [`quartz-community/search`](https://github.com/quartz-community/search)
|
||||
@@ -14,17 +14,17 @@ Quartz features a graph-view that can show both a local graph view and a global
|
||||
|
||||
## Installation
|
||||
|
||||
The Graph View is available as a community plugin from GitHub:
|
||||
The Graph View is part of the default `quartz.config.yaml`. If your config doesn't have it, add it with:
|
||||
|
||||
```bash
|
||||
npm install github:quartz-community/graph --legacy-peer-deps
|
||||
npx quartz plugin add @quartz-community/graph
|
||||
```
|
||||
|
||||
Then add it to your `quartz.config.yaml`:
|
||||
This adds an entry like this to your `quartz.config.yaml`:
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
plugins:
|
||||
- source: github:quartz-community/graph
|
||||
- source: "@quartz-community/graph"
|
||||
enabled: true
|
||||
layout:
|
||||
position: right
|
||||
@@ -42,13 +42,13 @@ Additionally, similar to how browsers highlight visited links a different colour
|
||||
|
||||
## Customization
|
||||
|
||||
Most configuration can be done by passing in options to `Graph()`.
|
||||
Most configuration can be done through the plugin's `options`.
|
||||
|
||||
For example, here's what the default configuration looks like:
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
plugins:
|
||||
- source: github:quartz-community/graph
|
||||
- source: "@quartz-community/graph"
|
||||
enabled: true
|
||||
options:
|
||||
localGraph:
|
||||
@@ -63,6 +63,7 @@ plugins:
|
||||
opacityScale: 1
|
||||
removeTags: []
|
||||
showTags: true
|
||||
focusOnHover: false
|
||||
enableRadial: false
|
||||
globalGraph:
|
||||
drag: true
|
||||
@@ -70,7 +71,7 @@ plugins:
|
||||
depth: -1
|
||||
scale: 0.9
|
||||
repelForce: 0.5
|
||||
centerForce: 0.3
|
||||
centerForce: 0.2
|
||||
linkDistance: 30
|
||||
fontSize: 0.6
|
||||
opacityScale: 1
|
||||
|
||||
@@ -9,6 +9,8 @@ The locale field generally follows a certain format: `{language}-{REGION}`
|
||||
- `{language}` is usually a [2-letter lowercase language code](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes).
|
||||
- `{REGION}` is usually a [2-letter uppercase region code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
|
||||
|
||||
Quartz's own strings (page titles of generated pages, dates, …) live in `quartz/i18n/locales`. Each plugin that shows text (explorer, search, graph, backlinks, …) ships its own translations in its repository, under `src/i18n/locales`, and picks the one matching `locale`. A missing locale falls back to `en-US`.
|
||||
|
||||
> [!tip] Interested in contributing?
|
||||
> We [gladly welcome translation PRs](https://github.com/jackyzha0/quartz/tree/v5/quartz/i18n/locales)! To contribute a translation, do the following things:
|
||||
>
|
||||
@@ -16,3 +18,5 @@ The locale field generally follows a certain format: `{language}-{REGION}`
|
||||
> 2. Rename it to `{language}-{REGION}.ts` so it matches a locale of the format shown above.
|
||||
> 3. Fill in the translations!
|
||||
> 4. Add the entry under `TRANSLATIONS` in `quartz/i18n/index.ts`.
|
||||
>
|
||||
> To translate a plugin's interface, do the same in that plugin's repository (`src/i18n/locales`, `src/i18n/index.ts`).
|
||||
@@ -16,7 +16,8 @@ Quartz comes with a wide variety of features out of the box. Most features are p
|
||||
- [[Roam Research compatibility]] — Support for Roam Research syntax
|
||||
- [[features/Citations|Citations]] — Academic citation support
|
||||
- [[Canvas]] — Render Obsidian Canvas files as interactive pages
|
||||
- [[Bases]] — Database-like views for your notes (tables, cards, galleries, and more)
|
||||
- [[Bases]] — Database-like views for your notes (tables, cards, lists, boards, galleries)
|
||||
- [[built-in processing]] — Frontmatter, link resolution, drafts and the content index, built into Quartz
|
||||
|
||||
## Navigation & Discovery
|
||||
|
||||
@@ -29,14 +30,14 @@ Quartz comes with a wide variety of features out of the box. Most features are p
|
||||
- [[folder and tag listings]] — Browse notes by folder or tag
|
||||
- [[recent notes]] — Display recently modified notes
|
||||
- [[popover previews]] — Hover previews for internal links
|
||||
- [[StackedPages|stacked pages]] — Andy Matuschak-style stacked sliding panes for tracing note connections
|
||||
- [[StackedPages|stacked pages]] — Open linked notes as binder-style stacked tabs for tracing note connections
|
||||
- [[EncryptedPages|encrypted pages]] — Password-protect individual pages with client-side encryption
|
||||
|
||||
## Appearance & Reading
|
||||
|
||||
- [[features/darkmode]] — Light and dark mode toggle
|
||||
- [[reader mode]] — Distraction-free reading experience
|
||||
- [[features/comments|comments]] — Add comments via Giscus, Utterances, or other providers
|
||||
- [[features/comments|comments]] — Add comments via Giscus
|
||||
- [[social images]] — Auto-generated Open Graph images for social sharing
|
||||
|
||||
## Publishing & Deployment
|
||||
@@ -44,5 +45,6 @@ Quartz comes with a wide variety of features out of the box. Most features are p
|
||||
- [[RSS Feed]] — RSS feed generation for content syndication
|
||||
- [[private pages]] — Control which pages are published
|
||||
- [[SPA Routing]] — Single-page app navigation
|
||||
- [[prefetching]] — Fetch pages before their links are followed, so they open at once
|
||||
- [[Docker Support]] — Build and deploy with Docker
|
||||
- [[i18n]] — Internationalization with 30+ supported locales
|
||||
@@ -8,10 +8,15 @@ By default, Quartz only fetches previews for pages inside your vault due to [COR
|
||||
|
||||
When [[creating components|creating your own components]], you can include this `popover-hint` class to also include it in the popover.
|
||||
|
||||
Similar to Obsidian, [[quartz-layout-desktop.png|images referenced using wikilinks]] can also be viewed as popups.
|
||||
Similar to Obsidian, [[quartz-layout-desktop.png|images referenced using wikilinks]] can also be viewed as popups, and links to PDFs show the PDF.
|
||||
|
||||
Popovers are shown for internal links (`a.internal`). A link to an alias page shows the page it redirects to. To turn off the popover for a single link, add `data-no-popover="true"` to it in HTML (Quartz does this for heading anchor links).
|
||||
|
||||
With [[SPA Routing]], a page that was already fetched by [[prefetching]] or by the router is reused, so a popover doesn't download it again.
|
||||
|
||||
## Configuration
|
||||
|
||||
- Remove popovers: set the `enablePopovers` field in `quartz.config.yaml` to be `false`.
|
||||
- Remove popovers for one link: add `data-no-popover="true"` to it.
|
||||
- Style: `quartz/components/styles/popover.scss`
|
||||
- Script: `quartz/components/scripts/popover.inline.ts`
|
||||
@@ -8,14 +8,18 @@ There may be some notes you want to avoid publishing as a website. Quartz suppor
|
||||
|
||||
## Filter Plugins
|
||||
|
||||
[[making plugins#Filters|Filter plugins]] are plugins that filter out content based off of certain criteria. By default, Quartz's built-in [[RemoveDrafts|draft handling]] filters out any note that has `draft: true` in the frontmatter.
|
||||
[[making plugins#Filters|Filter plugins]] are plugins that filter out content based off of certain criteria. By default, Quartz's built-in [[RemoveDrafts|draft handling]] filters out any note that has `draft: true` in the frontmatter. Set `configuration.drafts.publish: true` to publish drafts anyway (e.g. for a preview deployment).
|
||||
|
||||
If you'd like to only publish a select number of notes, you can instead use [[ExplicitPublish]] which will filter out all notes except for any that have `publish: true` in the frontmatter.
|
||||
If you'd like to only publish a select number of notes, you can instead use [[ExplicitPublish]] which will filter out all notes except for any that have `publish: true` in the frontmatter. It is in the default `quartz.config.yaml` but disabled; set `enabled: true` on its entry.
|
||||
|
||||
To publish a page but keep it out of listings (explorer, search, graph, backlinks, RSS, sitemap, folder and tag pages), add `unlisted: true` to its frontmatter. This is handled by [[UnlistedPages]], which is enabled by default. The page is still reachable by its URL.
|
||||
|
||||
Bases, canvases and Excalidraw drawings follow the same filters. A drawing stored as Markdown has frontmatter of its own. A `.base` or `.canvas` file has none: with [[ExplicitPublish]] it is published when a published note links to it, and with encrypted pages it is encrypted with the password of the encrypted note that links to it.
|
||||
|
||||
> [!warning]
|
||||
> Regardless of the filter plugin used, **all non-markdown files will be emitted and available publicly in the final build.** This includes files such as images, voice recordings, PDFs, etc.
|
||||
> By default (`publishAssets: "all"`), **all non-markdown files are emitted and available publicly in the final build**, regardless of the filter plugin used. This includes files such as images, voice recordings, PDFs, etc.
|
||||
>
|
||||
> Set `publishAssets: "referenced"` in the [[configuration]] to copy only the files that published pages link to or embed, so that files only used by unpublished notes stay private.
|
||||
|
||||
## `ignorePatterns`
|
||||
|
||||
|
||||
@@ -15,17 +15,17 @@ Reader Mode is enabled by default. To disable it, set `enabled: false` in your `
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
plugins:
|
||||
- source: github:quartz-community/reader-mode
|
||||
- source: "@quartz-community/reader-mode"
|
||||
enabled: false
|
||||
```
|
||||
|
||||
Or remove the plugin entirely:
|
||||
|
||||
```bash
|
||||
npx quartz plugin remove github:quartz-community/reader-mode
|
||||
npx quartz plugin remove reader-mode
|
||||
```
|
||||
|
||||
- Install: `npx quartz plugin add github:quartz-community/reader-mode`
|
||||
- Install: `npx quartz plugin add @quartz-community/reader-mode`
|
||||
- Source: [`quartz-community/reader-mode`](https://github.com/quartz-community/reader-mode)
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -3,7 +3,20 @@ title: Recent Notes
|
||||
tags: component
|
||||
---
|
||||
|
||||
Quartz can generate a list of recent notes based on some filtering and sorting criteria. Though this component isn't included in any [[layout]] by default, you can add it by installing the plugin and configuring it in `quartz.config.yaml`.
|
||||
Quartz can generate a list of recent notes based on some filtering and sorting criteria. The plugin is in the default `quartz.config.yaml` but disabled; set `enabled: true` on its entry. It is placed in `afterBody` by default; add a `layout` block to put it somewhere else (see [[layout]]).
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
plugins:
|
||||
- source: "@quartz-community/recent-notes"
|
||||
enabled: true
|
||||
options:
|
||||
limit: 3
|
||||
showTags: true
|
||||
linkToMore: false
|
||||
layout:
|
||||
position: right
|
||||
priority: 40
|
||||
```
|
||||
|
||||
> [!note]
|
||||
> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page.
|
||||
@@ -13,12 +26,12 @@ Quartz can generate a list of recent notes based on some filtering and sorting c
|
||||
Most options are configured in the `options` section of the plugin entry in `quartz.config.yaml`:
|
||||
|
||||
- Changing the title from "Recent notes": set `title: "Recent writing"` in options
|
||||
- Changing the number of recent notes: set `limit: 5` in options
|
||||
- Changing the number of recent notes (default 3): set `limit: 5` in options
|
||||
- Display the note's tags (defaults to true): set `showTags: false` in options
|
||||
- Hide generated tag pages from the list (defaults to false): set `hideTagPages: true` in options. This filters out any page whose slug lives under the conventional `tags/` prefix.
|
||||
- Hide generated folder index pages from the list (defaults to false): set `hideFolderPages: true` in options. This filters out any page whose slug matches Quartz's folder-path convention (trailing slash or `index` suffix).
|
||||
- Show a 'see more' link: set `linkToMore: "tags/components"` in options. This field should be a full slug to a page that exists.
|
||||
- Show a 'see more' link (default `false`, no link): set `linkToMore: "tags/components"` in options. This field should be a full slug to a page that exists.
|
||||
- Customize filtering: requires a TS override — pass `filter: someFilterFunction` to the plugin constructor in `quartz.ts`. The filter function should have the signature `(f: QuartzPluginData) => boolean`.
|
||||
- Customize sorting: requires a TS override — pass `sort: someSortFunction` to the plugin constructor in `quartz.ts`. By default, Quartz will sort by date and then tie break lexographically. The sort function should have the signature `(f1: QuartzPluginData, f2: QuartzPluginData) => number`.
|
||||
- Install: `npx quartz plugin add github:quartz-community/recent-notes`
|
||||
- Customize sorting: requires a TS override — pass `sort: someSortFunction` to the plugin constructor in `quartz.ts`. By default, Quartz will sort by date and then tie break lexicographically. The sort function should have the signature `(f1: QuartzPluginData, f2: QuartzPluginData) => number`.
|
||||
- Install: `npx quartz plugin add @quartz-community/recent-notes`
|
||||
- Source: [`quartz-community/recent-notes`](https://github.com/quartz-community/recent-notes)
|
||||
@@ -8,7 +8,7 @@ Quartz can also dynamically generate and use new cover images for every page to
|
||||
|
||||
## Showcase
|
||||
|
||||
After enabling the [[CustomOgImages]] emitter plugin, the social media link preview for [[authoring content | Authoring Content]] looks like this:
|
||||
With the [[CustomOgImages]] emitter plugin (enabled by default), the social media link preview for [[authoring content | Authoring Content]] looks like this:
|
||||
|
||||
| Light | Dark |
|
||||
| ----------------------------------- | ---------------------------------- |
|
||||
|
||||
@@ -11,8 +11,10 @@ You can hide the TOC on a page by adding `enableToc: false` to the frontmatter f
|
||||
|
||||
By default, the TOC shows all headings from H1 (`# Title`) to H3 (`### Title`) and is only displayed if there is more than one heading on the page.
|
||||
|
||||
TOC entries link to the heading ids that [[GitHubFlavoredMarkdown]] gives headings, and both use the same slug function as [[wikilinks#Heading anchors|heading links]], so they always agree. Since GitHubFlavoredMarkdown 2.1 a heading containing `--` gets GitHub's id (`## Range 1--2` → `#range-1--2`, previously `#range-12`); update hand-written links to the old id.
|
||||
|
||||
## Customization
|
||||
|
||||
The table of contents is a functionality of the [[TableOfContents]] plugin. See the plugin page for more customization options.
|
||||
|
||||
It also needs the `TableOfContents` component, which is displayed in the right sidebar by default. You can change this by customizing the [[layout]]. The TOC component can be configured with the `layout` parameter, which can either be `modern` (default) or `legacy`.
|
||||
The same plugin entry provides the `TableOfContents` component, which is displayed in the right sidebar by default. You can change this with the entry's `layout` block (see [[layout]]). The component's style is set with the `layout` option, which can either be `modern` (default) or `legacy`.
|
||||
@@ -6,10 +6,17 @@ Wikilinks were pioneered by earlier internet wikis to make it easier to write li
|
||||
|
||||
Quartz supports Wikilinks by default and these links are resolved by Quartz's built-in [[CrawlLinks|link processing]]. See the [Obsidian Help page on Internal Links](https://help.obsidian.md/Linking+notes+and+files/Internal+links) for more information on Wikilink syntax.
|
||||
|
||||
This is enabled as a part of [[Obsidian compatibility]] and can be configured and enabled/disabled from that plugin.
|
||||
Parsing wikilinks is part of [[Obsidian compatibility]] ([[ObsidianFlavoredMarkdown]]). How links are resolved (`markdownLinkResolution`, pretty link text, broken-link styling, …) is configured under `configuration.links` (see [[CrawlLinks]]).
|
||||
|
||||
Wikilink matching is case-insensitive to mirror Obsidian: `[[My Note]]`, `[[my note]]`, and `[[MY NOTE]]` all resolve to the same file. The generated URL is lowercased (e.g. `my-note`).
|
||||
|
||||
Links behave as in Obsidian in a few more ways:
|
||||
|
||||
- Link paths are NFC-normalized, so a link spelled with a decomposed `é` reaches `café.md`.
|
||||
- A short link to an Obsidian folder note (`[[Topic]]` for `Topic/Topic.md`) reaches the folder page.
|
||||
- A Markdown link whose path is not valid percent-encoding (`[x](%zz)`) is treated as an external link.
|
||||
- An image without alt text gets its path as alt text, as Obsidian names an embed: `![[pic.png]]` gets `pic.png`, and a Markdown image of a file the site doesn't have gets its decoded path (`` → "missing pic.png").
|
||||
|
||||
## Syntax
|
||||
|
||||
- `[[Path to file]]`: produces a link to `Path to file.md` (or `Path-to-file.md`) with the text `Path to file`
|
||||
@@ -17,6 +24,12 @@ Wikilink matching is case-insensitive to mirror Obsidian: `[[My Note]]`, `[[my n
|
||||
- `[[Path to file#Anchor]]`: produces a link to the anchor `Anchor` in the file `Path to file.md`
|
||||
- `[[Path to file#^block-ref]]`: produces a link to the specific block `block-ref` in the file `Path to file.md`
|
||||
|
||||
A `^id` at the end of a wikilink's text stays part of the link text (`[[note|a ^id]]` shows `a ^id`); it doesn't turn the paragraph into a block with that id.
|
||||
|
||||
### Heading anchors
|
||||
|
||||
Heading ids are slugs of the heading text, the same ones GitHub uses: `## My Heading` → `#my-heading`, `## Range 1--2` → `#range-1--2`. Heading links, embeds and the [[table of contents]] use the same slugs. Obsidian replaces `:`, `|`, `^`, `#` and `\` in a heading with spaces when it writes a link to it (`[[note#Colon unspaced]]` for `## Colon:unspaced`); such links and embeds reach the heading too.
|
||||
|
||||
### Embeds
|
||||
|
||||
- `![[Path to image]]`: embeds an image into the page
|
||||
|
||||
@@ -12,7 +12,7 @@ Got everything set up? Preview your site locally with `npx quartz build --serve`
|
||||
|
||||
## Syntax
|
||||
|
||||
As Quartz uses Markdown files as the main way of writing content, it fully supports Markdown syntax. By default, Quartz also ships with a few syntax extensions like [Github Flavored Markdown](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) (footnotes, strikethrough, tables, tasklists) and [Obsidian Flavored Markdown](https://help.obsidian.md/Editing+and+formatting/Obsidian+Flavored+Markdown) ([[callouts]], [[wikilinks]]).
|
||||
As Quartz uses Markdown files as the main way of writing content, it fully supports Markdown syntax. By default, Quartz also ships with a few syntax extensions like [Github Flavored Markdown](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) (strikethrough, tables, tasklists) and [Obsidian Flavored Markdown](https://help.obsidian.md/Editing+and+formatting/Obsidian+Flavored+Markdown) ([[callouts]], [[wikilinks]], footnotes including inline `^[…]` footnotes).
|
||||
|
||||
Additionally, Quartz also allows you to specify additional metadata in your notes called **frontmatter**.
|
||||
|
||||
@@ -39,6 +39,9 @@ Some common frontmatter fields that are natively supported by Quartz:
|
||||
|
||||
See [[Frontmatter]] for a complete list of frontmatter.
|
||||
|
||||
> [!warning] Frontmatter must be valid
|
||||
> Frontmatter is YAML (or TOML, if configured) made of `key: value` properties. If a file's frontmatter can't be parsed — broken YAML, or a single value or list instead of properties — the build stops with an error naming the file. JavaScript frontmatter (`---js`, `---javascript`) is refused: Quartz never runs code from your content.
|
||||
|
||||
## Syncing your Content
|
||||
|
||||
When your Quartz is at a point you're happy with, you can save your changes to GitHub.
|
||||
|
||||
@@ -25,7 +25,7 @@ You need these tools installed before continuing:
|
||||
|
||||
Follow these in order:
|
||||
|
||||
1. **[[installation|Installation]]** — Get Quartz (via GitHub template or clone), install dependencies, run the setup wizard (`npx quartz create`), install plugins, and preview your site locally
|
||||
1. **[[installation|Installation]]** — Get Quartz (via GitHub template or clone), install dependencies, run the setup wizard (`npx quartz create`, which also installs plugins), and preview your site locally
|
||||
2. **[[authoring-content|Authoring Content]]** — Write and organize your Markdown notes in the `content/` folder
|
||||
3. **[[installation#Setting Up Your GitHub Repository|Push to GitHub]]** — Create a repository and push your site with `npx quartz sync`
|
||||
4. **[[hosting|Deploy]]** — Host your site for free on GitHub Pages, Cloudflare, Netlify, or Vercel
|
||||
|
||||
@@ -68,16 +68,14 @@ This will prompt you for:
|
||||
|
||||
For non-interactive usage and more details, see the [[create|`quartz create` CLI reference]].
|
||||
|
||||
## 4. Install Plugins
|
||||
## 4. Plugins
|
||||
|
||||
The template you chose references community plugins that need to be installed:
|
||||
`npx quartz create` already installed the plugins your template uses: the default plugins are npm packages installed by `npm i`, and any Git plugins the template references are downloaded into `.quartz/plugins/`. If you later add Git plugins to `quartz.config.yaml` by hand, install them with:
|
||||
|
||||
```bash
|
||||
npx quartz plugin install --from-config
|
||||
```
|
||||
|
||||
This downloads and builds all plugins listed in `quartz.config.yaml` into `.quartz/plugins/`.
|
||||
|
||||
> [!tip]
|
||||
> If some plugins fail to build, try refreshing them to their latest versions:
|
||||
>
|
||||
@@ -151,7 +149,8 @@ npx quartz sync
|
||||
> - `-d` or `--directory`: the content folder. This is normally just `content`
|
||||
> - `-v` or `--verbose`: print out extra logging information
|
||||
> - `--commit` or `--no-commit`: whether to make a `git` commit for your changes
|
||||
> - `--push` or `--no-push`: whether to push updates to your GitHub fork of Quartz
|
||||
> - `-m` or `--message`: the commit message (default: `Quartz sync: <date and time>`)
|
||||
> - `--push` or `--no-push`: whether to force-push updates to your GitHub fork of Quartz
|
||||
> - `--pull` or `--no-pull`: whether to try and pull in any updates from your GitHub fork (i.e. from other devices) before pushing
|
||||
|
||||
## Next Steps
|
||||
|
||||
@@ -70,11 +70,7 @@ cp -r /tmp/quartz-content/* content/
|
||||
Copy-Item -Recurse $env:TEMP\quartz-content\* content\
|
||||
```
|
||||
|
||||
After running `create`, install all plugins referenced in the generated config:
|
||||
|
||||
```bash
|
||||
npx quartz plugin install --from-config
|
||||
```
|
||||
`create` also installs the plugins the chosen template references, so there is no separate install step.
|
||||
|
||||
## What Changed in v5
|
||||
|
||||
@@ -83,11 +79,13 @@ Quartz 5 introduces a community plugin system that fundamentally changes how plu
|
||||
Key changes:
|
||||
|
||||
- **Configuration format**: TypeScript (`quartz.config.ts`, `quartz.layout.ts`) → YAML (`quartz.config.yaml`)
|
||||
- **Plugin system**: Plugins are now standalone Git repositories, installed via `npx quartz plugin add`
|
||||
- **Plugin system**: Plugins are now standalone packages. The default ones are npm packages that ship with Quartz; others are added with `npx quartz plugin add`
|
||||
- **Import pattern**: Community plugins use `ExternalPlugin.X()` (from `.quartz/plugins`) instead of `Plugin.X()` (from `./quartz/plugins`)
|
||||
- **Layout structure**: `quartz.layout.ts` is gone — layout position is now a per-plugin property in `quartz.config.yaml`
|
||||
- **Page types**: A new plugin category for page rendering (content, folder, tag pages)
|
||||
- **URL casing**: All generated URLs are now lowercased and hyphenated (e.g. `My Notes/Hello World.md` → `/my-notes/hello-world`). In v4, the original casing of file and folder names was preserved in URLs.
|
||||
- **Line breaks**: a single line break inside a paragraph renders as `<br>`, as in Obsidian (v4 rendered a space). Set `strictLineBreaks: true` in the [[ObsidianFlavoredMarkdown]] options for the v4 behaviour.
|
||||
- **Heading ids**: heading ids follow GitHub, so some differ from v4 (`## Range 1--2` → `#range-1--2`, was `#range-12`). Links that hard-code an old id need updating; `[[page#Range 1--2]]` keeps working.
|
||||
|
||||
### URL Casing and SEO
|
||||
|
||||
@@ -136,19 +134,19 @@ Mapping v4 plugin names to v5 equivalents:
|
||||
| `Plugin.AliasRedirects()` | `ExternalPlugin.AliasRedirects()` | Community |
|
||||
| `Plugin.ContentIndex()` | built in (`configuration.contentIndex`) | Internal |
|
||||
|
||||
Component layout mapping:
|
||||
Component layout mapping (`ExternalPlugin` is imported from `./.quartz/plugins` in `quartz.ts`):
|
||||
|
||||
| v4 Layout | v5 Layout |
|
||||
| ----------------------------- | ---------------------------------------- |
|
||||
| `Component.Explorer()` | `Plugin.Explorer()` |
|
||||
| `Component.Graph()` | `Plugin.Graph()` |
|
||||
| `Component.Search()` | `Plugin.Search()` |
|
||||
| `Component.Backlinks()` | `Plugin.Backlinks()` |
|
||||
| `Component.Darkmode()` | `Plugin.Darkmode()` |
|
||||
| `Component.Footer()` | `Plugin.Footer()` |
|
||||
| `Component.TableOfContents()` | `Plugin.TableOfContents()` |
|
||||
| `Component.Explorer()` | `ExternalPlugin.Explorer()` |
|
||||
| `Component.Graph()` | `ExternalPlugin.Graph()` |
|
||||
| `Component.Search()` | `ExternalPlugin.Search()` |
|
||||
| `Component.Backlinks()` | `ExternalPlugin.Backlinks()` |
|
||||
| `Component.Darkmode()` | `ExternalPlugin.Darkmode()` |
|
||||
| `Component.Footer()` | `ExternalPlugin.Footer()` |
|
||||
| `Component.TableOfContents()` | `ExternalPlugin.TableOfContents()` |
|
||||
| `Component.Head()` | `Component.Head()` (unchanged, internal) |
|
||||
| `Component.Spacer()` | `Plugin.Spacer()` |
|
||||
| `Component.Spacer()` | `ExternalPlugin.Spacer()` |
|
||||
|
||||
If you edited a component's source in `quartz/components/` (for example `Footer.tsx`), that no longer works: components are now installed plugins. See [[customizing components]] for the v5 ways to change them.
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ To fetch the latest Quartz updates, simply run
|
||||
npx quartz upgrade
|
||||
```
|
||||
|
||||
As Quartz uses [git](https://git-scm.com/) under the hood for versioning, upgrading effectively 'pulls' in the updates from the official Quartz GitHub repository. Merge conflicts in `quartz.lock.json` are handled automatically — Quartz backs up your lockfile before pulling and restores it afterward. For other files with local changes that conflict with the updates, you may need to resolve these manually yourself (or, pull manually using `git pull origin upstream`).
|
||||
As Quartz uses [git](https://git-scm.com/) under the hood for versioning, upgrading effectively 'pulls' in the updates from the official Quartz GitHub repository. Merge conflicts in `quartz.lock.json` are handled automatically — Quartz backs up your lockfile before pulling and restores it afterward. For other files with local changes that conflict with the updates, you may need to resolve these manually yourself (or pull manually with `git pull upstream v5`).
|
||||
|
||||
> [!hint]
|
||||
> Quartz will try to cache your content before upgrading to try and prevent merge conflicts. If you get a conflict mid-merge, you can stop the merge and then run `npx quartz restore` to restore your content from the cache.
|
||||
@@ -28,6 +28,35 @@ npx quartz plugin install --latest
|
||||
|
||||
See the [[upgrade|CLI reference for upgrade]] for more details on available flags.
|
||||
|
||||
## Upgrading from 5.0 to 5.1
|
||||
|
||||
Run the upgrade, then let `plugin doctor` update your config:
|
||||
|
||||
```bash
|
||||
npx quartz upgrade
|
||||
npx quartz plugin doctor --fix
|
||||
```
|
||||
|
||||
`upgrade` shows the release notes since your version and runs `plugin doctor` for you. `--fix` moves the entries of plugins that are now [[built-in processing|built into Quartz]] (`crawl-links`, `remove-draft`, `content-index`, and note-properties' `delimiters`/`language` options) into `configuration.links`, `drafts`, `contentIndex` and `frontmatter`, and removes their unused pins from `quartz.lock.json`. Until you run it, those entries keep working and are applied automatically.
|
||||
|
||||
### Changes you may notice
|
||||
|
||||
- **Line breaks**: a single line break inside a paragraph now renders as `<br>`, as in Obsidian's reading view ([[ObsidianFlavoredMarkdown]] 2.0). Set `strictLineBreaks: true` in its options to keep the old behaviour (a space). The [[HardLineBreaks]] plugin is deprecated and no longer in the default config; Quartz warns while it is enabled.
|
||||
- **Plugin order**: [[GitHubFlavoredMarkdown]] now runs before ObsidianFlavoredMarkdown (`order` 30, then 40). If your config sets `order` for either, keep GitHubFlavoredMarkdown first. Strikethrough (`~~`) now follows Obsidian's rules.
|
||||
- **Heading ids**: a heading containing `--` gets the same id as on GitHub (`## Range 1--2` → `#range-1--2`, was `#range-12`). Links that hard-code an old id need updating; `[[page#Range 1--2]]` keeps working.
|
||||
- **Bases** behave as in Obsidian 1.15 ([[BasesPage]] 1.2): `file.name` of a Markdown note has no extension (`Note`; `file.fullname` has it), `file.tags` keeps `#` and the original case, nested tags match (`#project` finds `#project/x`), the cards' `imageAspectRatio` is height/width (it was inverted), a base opens on its first view, and subtracting dates gives a duration (`(due - today()).days`).
|
||||
- **Permalinks** are now the page's address: `permalink: page` publishes the note at `/page`, and its file path redirects there. Before, the permalink only redirected to the file path. See [[authoring-content|frontmatter fields]].
|
||||
- **Frontmatter**: `---js` / `---javascript` frontmatter is refused, and invalid frontmatter (e.g. broken YAML) stops the build with an error naming the file.
|
||||
- **Plugins in CI**: builds with `CI` set (GitHub Actions, Cloudflare Pages, Netlify, Vercel, …) fail on plugins that fail to load or need a newer Quartz. Set `QUARTZ_ALLOW_BROKEN_PLUGINS=1` or `QUARTZ_ALLOW_INCOMPATIBLE_PLUGINS=1` to deploy anyway. See [[troubleshooting#Reading build output]].
|
||||
|
||||
### New options
|
||||
|
||||
- `configuration.prefetch` (default `viewport`): pages are fetched before their links are followed. See [[prefetching]].
|
||||
- `configuration.publishAssets: referenced` copies only the files published pages use, so files used only by unpublished notes stay private (default `all`).
|
||||
- `layout.sidebars`: how sidebars taller than the screen behave (`fit`, `scroll`, `static`). See [[layout#Sidebar modes]].
|
||||
|
||||
See [[whats-new#New in 5.1|What's new in 5.1]] for everything else.
|
||||
|
||||
### Layout System Changes
|
||||
|
||||
The `footer` layout slot is now an array of components, consistent with other layout slots like `header`, `left`, and `right`. Additionally, `header` and `footer` are now configurable layout positions — plugins can declare `layout: { position: header }` or `layout: { position: footer }` in their YAML config.
|
||||
@@ -104,17 +133,7 @@ plugins:
|
||||
> [!important]
|
||||
> The `@` scoped name must be quoted in YAML. Use double quotes around the source value.
|
||||
|
||||
Then install the packages:
|
||||
|
||||
```bash
|
||||
npm install @quartz-community/syntax-highlighting
|
||||
```
|
||||
|
||||
Or install all default plugins at once:
|
||||
|
||||
```bash
|
||||
npm install @quartz-community/created-modified-date @quartz-community/syntax-highlighting @quartz-community/obsidian-flavored-markdown @quartz-community/github-flavored-markdown @quartz-community/table-of-contents @quartz-community/description @quartz-community/latex @quartz-community/quartz-fonts @quartz-community/alias-redirects @quartz-community/favicon @quartz-community/og-image @quartz-community/cname @quartz-community/canvas-page @quartz-community/content-page @quartz-community/folder-page @quartz-community/tag-page @quartz-community/explorer @quartz-community/graph @quartz-community/search @quartz-community/backlinks @quartz-community/article-title @quartz-community/content-meta @quartz-community/page-title @quartz-community/darkmode @quartz-community/reader-mode @quartz-community/breadcrumbs @quartz-community/footer @quartz-community/spacer @quartz-community/bases-page @quartz-community/note-properties @quartz-community/unlisted-pages @quartz-community/encrypted-pages
|
||||
```
|
||||
The default plugins are already dependencies in Quartz's `package.json`, so `npm i` installs them — no separate install step is needed. For other npm plugins, use `npx quartz plugin add "@scope/plugin-name"`, which installs the package and adds the entry for you.
|
||||
|
||||
### Do I Have to Switch?
|
||||
|
||||
|
||||
@@ -7,9 +7,26 @@ aliases:
|
||||
|
||||
Quartz 5 is a ground-up rearchitecture of Quartz focused on extensibility, performance, and Obsidian compatibility. If you're coming from v4, see [[migrating|Migrating to Quartz 5]] for the upgrade path.
|
||||
|
||||
## New in 5.1
|
||||
|
||||
Upgrading from 5.0? See [[upgrading#Upgrading from 5.0 to 5.1|Upgrading from 5.0 to 5.1]] for the steps and the changes you may notice.
|
||||
|
||||
- **[[prefetching|Prefetching]]** — pages are fetched before their links are followed, so they open at once (`configuration.prefetch`, default `viewport`). Works with and without SPA routing.
|
||||
- **[[built-in processing|Built-in processing]]** — frontmatter, link resolution, drafts and the content index are built into Quartz (`configuration.frontmatter`, `links`, `drafts`, `contentIndex`) instead of plugins that broke the site when disabled.
|
||||
- **`publishAssets: referenced`** — only copy the images and files that published pages use.
|
||||
- **Permalinks as addresses** — `permalink: page` publishes a note at `/page`, as in Obsidian Publish.
|
||||
- **Sidebar modes** — [[layout#Sidebar modes|`layout.sidebars`]] (`fit`, `scroll`, `static`) and a new `docs` template (`npx quartz create --template docs`).
|
||||
- **Markdown as in Obsidian** — [[ObsidianFlavoredMarkdown]] 2.0 parses with Obsidian's own parser: single line breaks render as `<br>`, inline footnotes (`text^[note]`), image sizes on Markdown images (``), themed Mermaid diagrams. [[GitHubFlavoredMarkdown]] now runs first, and headings get the same ids as on GitHub.
|
||||
- **Bases as in Obsidian 1.15** — [[BasesPage]] 1.2: durations, nested tags, `file.name`/`file.fullname`, Obsidian's card layout. Pages rendered from `.base`, `.canvas` and Excalidraw files follow your publish filters.
|
||||
- **`npx quartz info`** — prints your Quartz version, environment and plugins for bug reports.
|
||||
- **`npx quartz plugin doctor`** — checks your config, lockfile and installed plugins, and `--fix` migrates entries of plugins that are now built in. `npx quartz upgrade` shows the release notes and runs these checks.
|
||||
- **Clearer errors** — plugin errors name the plugin, what it was doing and the file; problems in content say so; broken or incompatible plugins fail CI builds. `--verbose` prints a layout report.
|
||||
- **Plugin compatibility** — a plugin's required Quartz version is checked (a warning locally, an error in CI), and deprecated plugins are flagged.
|
||||
- **Fixes** — Windows (npm plugins in `.quartz/plugins/index.ts`, local plugin paths, aliases, git dates), no sideways scrolling on phones, SPA navigation across redirects, and JavaScript frontmatter (`---js`) is no longer executed.
|
||||
|
||||
## Plugin Ecosystem
|
||||
|
||||
The biggest change in v5 is the move to a **community plugin ecosystem**. Plugins are now standalone packages maintained in the [quartz-community](https://github.com/quartz-community) GitHub organization and installed via git:
|
||||
The biggest change in v5 is the move to a **community plugin ecosystem**. Plugins are now standalone packages maintained in the [quartz-community](https://github.com/quartz-community) GitHub organization. The default plugins are npm packages (`@quartz-community/explorer`) that ship with Quartz; others can be added from npm, git or a local folder:
|
||||
|
||||
```bash
|
||||
npx quartz plugin add github:quartz-community/explorer
|
||||
@@ -41,10 +58,13 @@ configuration:
|
||||
body: Source Sans Pro
|
||||
code: IBM Plex Mono
|
||||
plugins:
|
||||
- source: github:quartz-community/obsidian-flavored-markdown
|
||||
- source: "@quartz-community/github-flavored-markdown"
|
||||
enabled: true
|
||||
order: 30
|
||||
- source: github:quartz-community/explorer
|
||||
- source: "@quartz-community/obsidian-flavored-markdown"
|
||||
enabled: true
|
||||
order: 40
|
||||
- source: "@quartz-community/explorer"
|
||||
enabled: true
|
||||
layout:
|
||||
position: left
|
||||
@@ -76,7 +96,7 @@ Quartz 5 aims for full compatibility with Obsidian's core features:
|
||||
- **Video/audio embeds** — full format support (mp4, webm, ogv, mov, mkv, avi, flac, aac, etc.)
|
||||
- **Canvas files** — rendered as interactive, pannable pages via the canvas-page plugin
|
||||
- **Obsidian URI links** — marked with CSS class for custom styling
|
||||
- **Footnotes** — via the GitHub Flavored Markdown plugin
|
||||
- **Footnotes** — including inline footnotes (`text^[note]`), parsed by the Obsidian Flavored Markdown plugin
|
||||
|
||||
See [[Obsidian compatibility]] for the full list.
|
||||
|
||||
@@ -98,11 +118,11 @@ The layout system is now declarative. Plugins declare their position (`left`, `r
|
||||
|
||||
```yaml
|
||||
plugins:
|
||||
- source: github:quartz-community/explorer
|
||||
- source: "@quartz-community/explorer"
|
||||
layout:
|
||||
position: left
|
||||
priority: 50
|
||||
- source: github:quartz-community/graph
|
||||
- source: "@quartz-community/graph"
|
||||
layout:
|
||||
position: right
|
||||
priority: 10
|
||||
@@ -127,16 +147,18 @@ Additional features:
|
||||
|
||||
The CLI is simpler and more helpful:
|
||||
|
||||
| Command | Description |
|
||||
| -------------------------------- | --------------------------------------- |
|
||||
| `npx quartz create` | Interactive setup wizard with templates |
|
||||
| `npx quartz build --serve` | Build and serve with hot reload |
|
||||
| `npx quartz sync` | Commit and push to GitHub |
|
||||
| `npx quartz upgrade` | Pull latest Quartz updates |
|
||||
| `npx quartz plugin install` | Install plugins from lockfile |
|
||||
| `npx quartz plugin add <source>` | Add a new plugin |
|
||||
| `npx quartz plugin list` | List installed plugins |
|
||||
| `npx quartz plugin prune` | Remove unused plugins |
|
||||
| Command | Description |
|
||||
| -------------------------------- | ----------------------------------------- |
|
||||
| `npx quartz create` | Interactive setup wizard with templates |
|
||||
| `npx quartz build --serve` | Build and serve with hot reload |
|
||||
| `npx quartz sync` | Commit and push to GitHub |
|
||||
| `npx quartz upgrade` | Pull latest Quartz updates |
|
||||
| `npx quartz plugin install` | Install plugins from lockfile |
|
||||
| `npx quartz plugin add <source>` | Add a new plugin |
|
||||
| `npx quartz plugin list` | List installed plugins |
|
||||
| `npx quartz plugin prune` | Remove unused plugins |
|
||||
| `npx quartz plugin doctor` | Diagnose plugin problems |
|
||||
| `npx quartz info` | Print version and plugins for bug reports |
|
||||
|
||||
Other improvements:
|
||||
|
||||
|
||||
+5
-2
@@ -15,6 +15,9 @@ However, if you'd like to publish your site to the world, you need a way to host
|
||||
> [!tip] Keeping plugins in sync
|
||||
> All hosting examples below use `npx quartz plugin install` to install plugins from the lockfile. If contributors may add plugins to `quartz.config.yaml` without updating the lockfile, add `npx quartz plugin install --from-config` after `install` in your build command to install any missing plugins. See [[cli/plugin#install|plugin install]] for details.
|
||||
|
||||
> [!note] Builds fail on broken plugins
|
||||
> Hosted builds run with the `CI` environment variable set, so a plugin that fails to load or needs a newer Quartz fails the deploy instead of publishing a site with a missing feature. Run `npx quartz plugin doctor` locally to find the cause, or set `QUARTZ_ALLOW_BROKEN_PLUGINS=1` / `QUARTZ_ALLOW_INCOMPATIBLE_PLUGINS=1` in the build environment to deploy anyway. See [[troubleshooting#Reading build output]].
|
||||
|
||||
## Cloudflare Pages
|
||||
|
||||
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/) and select your account.
|
||||
@@ -40,9 +43,9 @@ To add a custom domain, check out [Cloudflare's documentation](https://developer
|
||||
|
||||
## GitHub Pages
|
||||
|
||||
In your local Quartz, create a new file `quartz/.github/workflows/deploy.yml`.
|
||||
In your local Quartz, create a new file `.github/workflows/deploy.yml` at the root of the repository.
|
||||
|
||||
```yaml title="quartz/.github/workflows/deploy.yml"
|
||||
```yaml title=".github/workflows/deploy.yml"
|
||||
name: Deploy Quartz site to GitHub Pages
|
||||
|
||||
on:
|
||||
|
||||
+3
-5
@@ -20,12 +20,10 @@ cd quartz
|
||||
npm i
|
||||
|
||||
# 3. Initialize your site (choose a template, set your base URL, import content)
|
||||
# This also installs the plugins your template uses
|
||||
npx quartz create
|
||||
|
||||
# 4. Install plugins referenced by your chosen template
|
||||
npx quartz plugin install --from-config
|
||||
|
||||
# 5. Preview your site locally
|
||||
# 4. Preview your site locally
|
||||
npx quartz build --serve
|
||||
```
|
||||
|
||||
@@ -66,4 +64,4 @@ For a comprehensive list of features, visit the [features page](./features/). Yo
|
||||
|
||||
Having trouble with Quartz? Try searching for your issue using the search feature or check the [[troubleshooting]] page. If you haven't already, [[upgrading|upgrade]] to the newest version of Quartz to see if this fixes your issue.
|
||||
|
||||
If you're still having trouble, feel free to [submit an issue](https://github.com/jackyzha0/quartz/issues) if you feel you found a bug or ask for help in our [Discord Community](https://discord.gg/cRFFHYye7t). You can also browse the [[community]] page for third-party plugins and resources.
|
||||
If you're still having trouble, feel free to [submit an issue](https://github.com/jackyzha0/quartz/issues) if you feel you found a bug (include the output of `npx quartz info`) or ask for help in our [Discord Community](https://discord.gg/cRFFHYye7t). You can also browse the [[community]] page for third-party plugins and resources.
|
||||
@@ -74,10 +74,10 @@ For full programmatic control, use the `Component.Flex()` wrapper in `quartz.ts`
|
||||
Component.Flex({
|
||||
components: [
|
||||
{
|
||||
Component: Plugin.Search(),
|
||||
Component: ExternalPlugin.Search(),
|
||||
grow: true, // Search will grow to fill available space
|
||||
},
|
||||
{ Component: Plugin.Darkmode() }, // Darkmode keeps its natural size
|
||||
{ Component: ExternalPlugin.Darkmode() }, // Darkmode keeps its natural size
|
||||
],
|
||||
direction: "row",
|
||||
gap: "1rem",
|
||||
@@ -147,7 +147,7 @@ Component.MobileOnly(Component.Spacer())
|
||||
```
|
||||
|
||||
```ts title="quartz.ts (override)"
|
||||
Component.DesktopOnly(Plugin.TableOfContents())
|
||||
Component.DesktopOnly(ExternalPlugin.TableOfContents())
|
||||
```
|
||||
|
||||
## `ConditionalRender` Component
|
||||
@@ -184,7 +184,7 @@ For custom conditions that aren't covered by the built-in presets, import the in
|
||||
```ts title="quartz.ts (override)"
|
||||
import { loadQuartzConfig, loadQuartzLayout } from "./quartz/plugins/loader/config-loader"
|
||||
import * as Component from "./quartz/components"
|
||||
import { Search } from "./.quartz/plugins/search"
|
||||
import * as ExternalPlugin from "./.quartz/plugins"
|
||||
|
||||
const config = await loadQuartzConfig()
|
||||
export default config
|
||||
@@ -192,7 +192,7 @@ export const layout = await loadQuartzLayout({
|
||||
defaults: {
|
||||
left: [
|
||||
Component.ConditionalRender({
|
||||
component: Search(),
|
||||
component: ExternalPlugin.Search(),
|
||||
condition: (props) => props.fileData.slug?.startsWith("notes/") ?? false,
|
||||
}),
|
||||
],
|
||||
@@ -200,7 +200,7 @@ export const layout = await loadQuartzLayout({
|
||||
})
|
||||
```
|
||||
|
||||
The wrapped plugin must be installed and enabled in `quartz.config.yaml`. A TypeScript layout override replaces the selected slot, so include any other components you want to keep in that slot alongside the conditional component.
|
||||
`./.quartz/plugins` is the generated index of all installed plugins, npm and Git alike (importing a single plugin from `./.quartz/plugins/<name>` only works for plugins installed from Git). The wrapped plugin must be installed and enabled in `quartz.config.yaml`. A TypeScript layout override replaces the selected slot, so include any other components you want to keep in that slot alongside the conditional component.
|
||||
|
||||
```typescript
|
||||
type ConditionalRenderConfig = {
|
||||
@@ -210,4 +210,4 @@ type ConditionalRenderConfig = {
|
||||
```
|
||||
|
||||
> [!tip]
|
||||
> You can also register custom conditions for use in YAML by calling `registerCondition()` in a plugin's initialization code. See [[making plugins]] for more details.
|
||||
> You can also register custom conditions for use in YAML: call `registerCondition(name, (props) => boolean)` from `./quartz/plugins/loader/conditions` at the top of `quartz.ts`, before `loadQuartzConfig()`, then use `condition: <name>` in a layout block.
|
||||
+12
-11
@@ -42,47 +42,47 @@ Layout components are configured in the `layout` section of `quartz.config.yaml`
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
plugins:
|
||||
- source: github:quartz-community/explorer
|
||||
- source: "@quartz-community/explorer"
|
||||
enabled: true
|
||||
layout:
|
||||
position: left
|
||||
priority: 50
|
||||
- source: github:quartz-community/graph
|
||||
- source: "@quartz-community/graph"
|
||||
enabled: true
|
||||
layout:
|
||||
position: right
|
||||
priority: 10
|
||||
- source: github:quartz-community/search
|
||||
- source: "@quartz-community/search"
|
||||
enabled: true
|
||||
layout:
|
||||
position: left
|
||||
priority: 20
|
||||
- source: github:quartz-community/backlinks
|
||||
- source: "@quartz-community/backlinks"
|
||||
enabled: true
|
||||
layout:
|
||||
position: right
|
||||
priority: 30
|
||||
- source: github:quartz-community/article-title
|
||||
- source: "@quartz-community/article-title"
|
||||
enabled: true
|
||||
layout:
|
||||
position: beforeBody
|
||||
priority: 10
|
||||
- source: github:quartz-community/content-meta
|
||||
- source: "@quartz-community/content-meta"
|
||||
enabled: true
|
||||
layout:
|
||||
position: beforeBody
|
||||
priority: 20
|
||||
- source: github:quartz-community/tag-list
|
||||
- source: "@quartz-community/tag-list"
|
||||
enabled: true
|
||||
layout:
|
||||
position: beforeBody
|
||||
priority: 30
|
||||
- source: github:quartz-community/darkmode
|
||||
- source: "@quartz-community/darkmode"
|
||||
enabled: true
|
||||
layout:
|
||||
position: header
|
||||
priority: 10
|
||||
- source: github:quartz-community/footer
|
||||
- source: "@quartz-community/footer"
|
||||
enabled: true
|
||||
options:
|
||||
links:
|
||||
@@ -122,7 +122,7 @@ Plugins can specify a `condition` in their layout block to control when they app
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
plugins:
|
||||
- source: github:quartz-community/breadcrumbs
|
||||
- source: "@quartz-community/breadcrumbs"
|
||||
enabled: true
|
||||
layout:
|
||||
position: beforeBody
|
||||
@@ -165,6 +165,7 @@ Components with equal priority keep the order in which they appear in `quartz.co
|
||||
| `exclude` | Plugins to leave out on this page type. Use the plugin name (`reader-mode`); the full source (`@quartz-community/reader-mode`, `github:…/reader-mode`) works too. |
|
||||
| `positions` | Clear slots: `right: []` removes everything from the right sidebar. Only empty lists are supported. |
|
||||
| `template` | The [[#Page Frames\|page frame]] to use, e.g. `full-width` or `minimal`. |
|
||||
| `sidebars` | [[#Sidebar modes\|Sidebar modes]] for this page type (`left`/`right`: `fit`, `scroll` or `static`), merged over `layout.sidebars`. |
|
||||
|
||||
Slots that a page type does not change follow the defaults.
|
||||
|
||||
@@ -215,7 +216,7 @@ export const layout = await loadQuartzLayout({
|
||||
3. `defaults` in `quartz.ts`
|
||||
4. the layout built from each plugin's `layout` block
|
||||
|
||||
Community component plugins are installed via `npx quartz plugin add github:quartz-community/<name>`. See [[layout-components]] for built-in layout utilities (Flex, MobileOnly, DesktopOnly, etc.).
|
||||
Component plugins are installed via `npx quartz plugin add @quartz-community/<name>` (or a `github:org/repo` source). See [[layout-components]] for built-in layout utilities (Flex, MobileOnly, DesktopOnly, etc.).
|
||||
|
||||
You can also checkout the guide on [[creating components]] if you're interested in further customizing the behaviour of Quartz.
|
||||
|
||||
|
||||
@@ -67,4 +67,4 @@ This plugin accepts the following configuration options:
|
||||
- Category: Emitter
|
||||
- Function name: `ExternalPlugin.AliasRedirects()`.
|
||||
- Source: [`quartz-community/alias-redirects`](https://github.com/quartz-community/alias-redirects)
|
||||
- Install: `npx quartz plugin add github:quartz-community/alias-redirects`
|
||||
- Install: `npx quartz plugin add @quartz-community/alias-redirects` (included in the default configuration)
|
||||
@@ -21,4 +21,4 @@ This plugin has no configuration options.
|
||||
- Category: Component
|
||||
- Function name: `ExternalPlugin.ArticleTitle()`.
|
||||
- Source: [`quartz-community/article-title`](https://github.com/quartz-community/article-title)
|
||||
- Install: `npx quartz plugin add github:quartz-community/article-title`
|
||||
- Install: `npx quartz plugin add @quartz-community/article-title` (included in the default configuration)
|
||||
+13
-3
@@ -5,14 +5,24 @@ tags:
|
||||
image: https://images.unsplash.com/photo-1526304640581-d334cdbbf45e
|
||||
---
|
||||
|
||||
This plugin emits all non-Markdown static assets in your content folder (like images, videos, HTML, etc). The plugin respects the `ignorePatterns` in the global [[configuration]].
|
||||
This plugin emits the non-Markdown static assets in your content folder (like images, videos, PDFs, HTML, etc). The plugin respects the `ignorePatterns` in the global [[configuration]]. Files that a page type renders as pages (such as `.base` and `.canvas` files) are not copied as assets.
|
||||
|
||||
Note that all static assets will then be accessible through its path on your generated site, i.e: `host.me/path/to/static.pdf`
|
||||
Which assets are emitted depends on `configuration.publishAssets`:
|
||||
|
||||
- `"all"` (default): every asset in the content folder is copied.
|
||||
- `"referenced"`: only assets that published pages link to or embed (`src`, `href`, `data`, `poster` and `srcset` attributes) are copied. Use this together with [[private pages|publish filters]] so that images used only by unpublished notes don't end up on your site.
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
configuration:
|
||||
publishAssets: referenced
|
||||
```
|
||||
|
||||
Assets are written to their slugified path, so `content/path/to/My File.pdf` becomes `host.me/path/to/My-File.pdf`.
|
||||
|
||||
> [!note]
|
||||
> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page.
|
||||
|
||||
This plugin has no configuration options.
|
||||
This plugin has no options of its own; it is always enabled.
|
||||
|
||||
## API
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ Shows pages that link to the current page.
|
||||
> [!note]
|
||||
> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page.
|
||||
|
||||
See [[plugins/Backlinks]] for detailed usage information.
|
||||
See [[features/backlinks|Backlinks]] for detailed usage information.
|
||||
|
||||
## Configuration
|
||||
|
||||
@@ -25,10 +25,13 @@ This plugin accepts the following configuration options:
|
||||
### Default options
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: github:quartz-community/backlinks
|
||||
- source: "@quartz-community/backlinks"
|
||||
enabled: true
|
||||
options:
|
||||
hideWhenEmpty: true
|
||||
layout:
|
||||
position: right
|
||||
priority: 50
|
||||
```
|
||||
|
||||
## API
|
||||
@@ -36,4 +39,4 @@ This plugin accepts the following configuration options:
|
||||
- Category: Component
|
||||
- Function name: `ExternalPlugin.Backlinks()`.
|
||||
- Source: [`quartz-community/backlinks`](https://github.com/quartz-community/backlinks)
|
||||
- Install: `npx quartz plugin add github:quartz-community/backlinks`
|
||||
- Install: `npx quartz plugin add @quartz-community/backlinks`
|
||||
+53
-11
@@ -11,7 +11,7 @@ enabled: true
|
||||
required: false
|
||||
---
|
||||
|
||||
This plugin provides support for [Obsidian Bases](https://obsidian.md/help/bases) (`.base` files) in Quartz. It reads `.base` files from your vault, resolves matching notes based on the query definition, and renders them as interactive database-like views with support for tables, lists, cards, and maps. It uses the `default` [[layout#Page Frames|page frame]] (three-column layout with sidebars).
|
||||
This plugin provides support for [Obsidian Bases](https://obsidian.md/help/bases) (`.base` files) in Quartz. It reads `.base` files from your vault, resolves matching notes based on the query definition, and renders them as interactive database-like views with support for tables, lists, cards, galleries, and boards. It uses the `default` [[layout#Page Frames|page frame]] (three-column layout with sidebars).
|
||||
|
||||
> [!note]
|
||||
> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page.
|
||||
@@ -20,14 +20,37 @@ This plugin provides support for [Obsidian Bases](https://obsidian.md/help/bases
|
||||
|
||||
- **Table view**: Sortable columns with automatic type rendering (strings, numbers, booleans, arrays, links).
|
||||
- **List view**: Compact list with metadata chips for each entry.
|
||||
- **Cards view**: Card layout with optional image property support.
|
||||
- **Map view**: Placeholder for future map-based visualization.
|
||||
- **Multiple views**: A single `.base` file can define multiple views, displayed as switchable tabs.
|
||||
- **Cards view**: Card layout with an optional cover image (`image` property, `imageFit`, `imageAspectRatio`).
|
||||
- **Gallery view**: Image-focused grid of thumbnails.
|
||||
- **Board view**: Kanban-style columns, one per value of the grouping property (`boardProperty` or `groupBy`).
|
||||
- **Multiple views**: A single `.base` file can define multiple views, displayed as switchable tabs. A base opens on its first view, as in Obsidian.
|
||||
- **Embedding**: `![[Tasks.base]]` embeds a base in a note, and `![[Tasks.base#Open tasks]]` embeds one view (matched by its name as written, case-sensitively). Inline ` ```base ` code blocks work too.
|
||||
- **Filters**: Recursive filter trees with `and`/`or`/`not` operators.
|
||||
- **Formulas**: Computed properties via formula expressions.
|
||||
- **Summaries**: Column-level aggregations (Sum, Average, Min, Max, Median, etc.).
|
||||
- **Property configuration**: Custom display names for properties.
|
||||
- **Link rendering**: Wikilinks and Markdown links within cell values are rendered as clickable links.
|
||||
- **Link rendering**: Links (`link()`, link-valued properties such as `"[[Note]]"`) are rendered as clickable links; links to missing notes get Quartz's `broken` class.
|
||||
- **Tag links**: tags in tables, lists, cards and boards link to their tag pages (when [[TagPage]] is enabled).
|
||||
|
||||
Map views from Obsidian are not supported: a view with an unknown type shows `Unknown view type: <type>`.
|
||||
|
||||
## Obsidian compatibility
|
||||
|
||||
bases-page 1.2 (shipped with Quartz 5.1) brings evaluation in line with Obsidian. Notable behaviour, some of it changed from earlier versions:
|
||||
|
||||
- `file.name` is the name without the extension for Markdown notes (`Note`) and with it for other files (`Plan.canvas`, `Tasks.base`). `file.basename` never has the extension, `file.fullname` always does (`Note.md`).
|
||||
- `file.tags` lists tags as written, with `#` and their original case, inline tags first. The `tags` property holds only the frontmatter tags.
|
||||
- `file.hasTag("a/b")`, `file.tags.contains("a/b")`, `containsAny` and `containsAll` also match nested tags (`a/b/c`) by whole segments, ignoring case and a leading `#`. `file.hasTag("x", "y")` is true when the note has **any** of the tags.
|
||||
- Dates are shown as Obsidian shows them (moment's `L` / `L LT`) in the site's `configuration.locale`; `.format()` and `.relative()` are locale-aware. `date()` only reads ISO-style strings (`2024-03-05`, `2024-03-05 14:30`, `2024-03-05T14:30:00Z`) and `20240305`, in local time; other strings give an empty value.
|
||||
- Subtracting dates gives a duration, shown like `9 days`. Durations have `.days`, `.hours`, `.minutes`, `.seconds`, `.milliseconds`, `.weeks` (fractional), and `.months`/`.years`; `duration()` takes one whole number and one unit (`1d`, `2 weeks`).
|
||||
- `imageAspectRatio` on cards is height / width, as in Obsidian (0.5 is a wide cover, 2 a tall one; default 1).
|
||||
- `file.folder` of a file at the root of the vault is `/`.
|
||||
- `contains()`, `containsAny()` and `containsAll()` on text ignore case; on lists they are case-sensitive.
|
||||
- `this`: in a base embedded in a note, `this.<key>` and `this.file` are that note's properties and file; on the `.base` page itself, `this` is the `.base` file.
|
||||
- A formula error (such as an unknown function) is shown in its cell.
|
||||
- `.base` files are listed in bases like other files.
|
||||
|
||||
With Quartz 5.1, `.base` pages follow the site's publish filters (e.g. [[ExplicitPublish]], [[RemoveDrafts]]): a `.base` file has no frontmatter, so with ExplicitPublish it is published only when a published note links to it. A `.base` page links only to the notes its views show.
|
||||
|
||||
## Interaction with `unlisted` pages
|
||||
|
||||
@@ -40,15 +63,18 @@ This plugin provides support for [Obsidian Bases](https://obsidian.md/help/bases
|
||||
|
||||
This plugin accepts the following configuration options:
|
||||
|
||||
- `defaultViewType`: The default view type when none is specified in the `.base` file. Defaults to `"table"`.
|
||||
- `defaultViewType`: Open a base on its first view of this type. Unset by default: a base opens on its first view, as in Obsidian.
|
||||
- `linkResolution`: How to resolve internal links in view renderers. Should match `configuration.links.markdownLinkResolution` (built-in [[CrawlLinks|link processing]]). Can be `"absolute"`, `"relative"`, or `"shortest"`. Defaults to `"shortest"`.
|
||||
- `customViews`: A map of custom view renderers. Keys are view type names. These override built-in renderers for the same type, or add new view types. Requires a TS override.
|
||||
|
||||
### Default options
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: github:quartz-community/bases-page
|
||||
- source: "@quartz-community/bases-page"
|
||||
enabled: true
|
||||
options:
|
||||
linkResolution: shortest
|
||||
order: 50
|
||||
```
|
||||
|
||||
For custom view renderers, use a TS override in `quartz.ts`:
|
||||
@@ -58,18 +84,34 @@ import * as ExternalPlugin from "./.quartz/plugins"
|
||||
|
||||
// Must be placed before loadQuartzConfig()
|
||||
ExternalPlugin.BasesPage({
|
||||
defaultViewType: "table",
|
||||
customViews: {
|
||||
myView: ({ entries, view, basesData, total, locale }) => {
|
||||
myView: ({
|
||||
entries,
|
||||
view,
|
||||
basesData,
|
||||
total,
|
||||
locale,
|
||||
slug,
|
||||
allSlugs,
|
||||
linkResolution,
|
||||
options,
|
||||
tagPages,
|
||||
}) => {
|
||||
// return JSX
|
||||
},
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
A view renderer receives the matching `entries`, the `view` definition, the parsed `basesData`, the `total` count, the site `locale`, the page's `slug`, `allSlugs` and `linkResolution` (for resolving links), the registration's `options`, and `tagPages` (whether tags link to tag pages). Plugins can also register view types (with their own `css` and `afterDOMLoaded` script) through `viewRegistry` from `@quartz-community/bases-page/registry`.
|
||||
|
||||
## Expressions
|
||||
|
||||
Filters and formulas use the Obsidian Bases expression language (see [Obsidian's Bases syntax](https://obsidian.md/help/bases/syntax) and [functions](https://obsidian.md/help/bases/functions)). The plugin's [README](https://github.com/quartz-community/bases-page#expression-engine) lists the supported properties, functions and methods, and the compiler API exported from `@quartz-community/bases-page/compiler`.
|
||||
|
||||
## API
|
||||
|
||||
- Category: Page Type, Component
|
||||
- Category: Transformer, Page Type, Component
|
||||
- Function name: `ExternalPlugin.BasesPage()`.
|
||||
- Source: [`quartz-community/bases-page`](https://github.com/quartz-community/bases-page)
|
||||
- Install: `npx quartz plugin add github:quartz-community/bases-page`
|
||||
- Install: `npx quartz plugin add @quartz-community/bases-page`
|
||||
@@ -14,7 +14,7 @@ Navigation breadcrumb trail.
|
||||
> [!note]
|
||||
> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page.
|
||||
|
||||
See [[plugins/Breadcrumbs]] for detailed usage information.
|
||||
See [[features/breadcrumbs|Breadcrumbs]] for detailed usage information.
|
||||
|
||||
## Configuration
|
||||
|
||||
@@ -28,13 +28,17 @@ This plugin accepts the following configuration options:
|
||||
### Default options
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: github:quartz-community/breadcrumbs
|
||||
- source: "@quartz-community/breadcrumbs"
|
||||
enabled: true
|
||||
options:
|
||||
spacerSymbol: "❯"
|
||||
rootName: Home
|
||||
resolveFrontmatterTitle: true
|
||||
showCurrentPage: true
|
||||
layout:
|
||||
position: beforeBody
|
||||
priority: 5
|
||||
condition: not-index
|
||||
```
|
||||
|
||||
## API
|
||||
@@ -42,4 +46,4 @@ This plugin accepts the following configuration options:
|
||||
- Category: Component
|
||||
- Function name: `ExternalPlugin.Breadcrumbs()`.
|
||||
- Source: [`quartz-community/breadcrumbs`](https://github.com/quartz-community/breadcrumbs)
|
||||
- Install: `npx quartz plugin add github:quartz-community/breadcrumbs`
|
||||
- Install: `npx quartz plugin add @quartz-community/breadcrumbs`
|
||||
@@ -9,7 +9,7 @@ enabled: true
|
||||
required: false
|
||||
---
|
||||
|
||||
This plugin emits a `CNAME` record that points your subdomain to the default domain of your site.
|
||||
This plugin writes a `CNAME` file to the root of the output folder containing the hostname of `configuration.baseUrl` (for `baseUrl: quartz.example.com/docs` that is `quartz.example.com`). Hosts such as GitHub Pages read this file to serve the site on a custom domain. If `baseUrl` is not set, the plugin warns and writes nothing.
|
||||
|
||||
If you want to use a custom domain name like `quartz.example.com` for the site, then this is needed.
|
||||
|
||||
@@ -25,4 +25,4 @@ This plugin has no configuration options.
|
||||
- Category: Emitter
|
||||
- Function name: `ExternalPlugin.CNAME()`.
|
||||
- Source: [`quartz-community/cname`](https://github.com/quartz-community/cname)
|
||||
- Install: `npx quartz plugin add github:quartz-community/cname`
|
||||
- Install: `npx quartz plugin add @quartz-community/cname`
|
||||
@@ -56,4 +56,4 @@ layout:
|
||||
- Category: Page Type
|
||||
- Function name: `ExternalPlugin.CanvasPage()`.
|
||||
- Source: [`quartz-community/canvas-page`](https://github.com/quartz-community/canvas-page)
|
||||
- Install: `npx quartz plugin add github:quartz-community/canvas-page`
|
||||
- Install: `npx quartz plugin add @quartz-community/canvas-page` (included in the default configuration)
|
||||
@@ -26,4 +26,4 @@ This plugin accepts the following configuration options:
|
||||
- Category: Transformer
|
||||
- Function name: `ExternalPlugin.Citations()`.
|
||||
- Source: [`quartz-community/citations`](https://github.com/quartz-community/citations)
|
||||
- Install: `npx quartz plugin add github:quartz-community/citations`
|
||||
- Install: `npx quartz plugin add @quartz-community/citations`
|
||||
+31
-12
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Comments
|
||||
description: Comment system integration (Giscus, Utterances, etc.).
|
||||
description: Comment section powered by Giscus.
|
||||
tags:
|
||||
- plugin/component
|
||||
image: "[[giscus-results.png]]"
|
||||
@@ -9,36 +9,53 @@ enabled: false
|
||||
required: false
|
||||
---
|
||||
|
||||
Comment system (giscus, utterances, etc.).
|
||||
Adds a comment section to the bottom of each page, backed by [Giscus](https://giscus.app/) (GitHub Discussions). Giscus is currently the only provider.
|
||||
|
||||
> [!note]
|
||||
> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page.
|
||||
|
||||
See [[plugins/Comments]] for detailed usage information.
|
||||
See [[features/comments|Comments]] for setup instructions.
|
||||
|
||||
## Configuration
|
||||
|
||||
This plugin accepts the following configuration options:
|
||||
|
||||
- `provider`: The comment provider to use. Currently only `giscus` is supported.
|
||||
- `options`: Provider-specific options.
|
||||
- `repo`: The GitHub repository to use for comments.
|
||||
- `provider`: The comment provider to use. Defaults to `giscus`, the only supported provider.
|
||||
- `options`: Provider-specific options. `repo`, `repoId`, `category` and `categoryId` are **required**; get them from the [Giscus site](https://giscus.app/).
|
||||
- `repo`: The GitHub repository to use for comments (`owner/name`).
|
||||
- `repoId`: The ID of the GitHub repository.
|
||||
- `category`: The discussion category to use.
|
||||
- `categoryId`: The ID of the discussion category.
|
||||
- `lang`: The language for the comment system. Defaults to `en`.
|
||||
- `themeUrl`: URL to a folder with custom themes.
|
||||
- `themeUrl`: URL to a folder with custom themes. Defaults to `https://<baseUrl>/static/giscus`.
|
||||
- `lightTheme`: Filename for the light theme CSS file. Defaults to `light`.
|
||||
- `darkTheme`: Filename for the dark theme CSS file. Defaults to `dark`.
|
||||
- `mapping`: How to map pages to discussions. Defaults to `url`.
|
||||
- `mapping`: How to map pages to discussions (`url`, `title`, `og:title`, `specific`, `number`, `pathname`). Defaults to `url`.
|
||||
- `strict`: Use strict title matching. Defaults to `true`.
|
||||
- `reactionsEnabled`: Whether to enable reactions for the main post. Defaults to `true`.
|
||||
- `inputPosition`: Where to put the comment input box relative to the comments. Defaults to `bottom`.
|
||||
- `inputPosition`: Where to put the comment input box relative to the comments (`top` or `bottom`). Defaults to `bottom`.
|
||||
|
||||
Set `comments: false` in a page's frontmatter to hide the comment section on that page.
|
||||
|
||||
### Default options
|
||||
|
||||
The plugin is disabled by default. The default configuration contains:
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: github:quartz-community/comments
|
||||
- source: "@quartz-community/comments"
|
||||
enabled: false
|
||||
options:
|
||||
provider: giscus
|
||||
options: {}
|
||||
layout:
|
||||
position: afterBody
|
||||
priority: 10
|
||||
```
|
||||
|
||||
To enable it, set `enabled: true` and fill in the required options, for example:
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: "@quartz-community/comments"
|
||||
enabled: true
|
||||
options:
|
||||
provider: giscus
|
||||
@@ -47,7 +64,9 @@ This plugin accepts the following configuration options:
|
||||
repoId: MDEwOlJlcG9zaXRvcnkzODcyMTMyMDg
|
||||
category: Announcements
|
||||
categoryId: DIC_kwDOFxRnmM4B-Xg6
|
||||
lang: en
|
||||
layout:
|
||||
position: afterBody
|
||||
priority: 10
|
||||
```
|
||||
|
||||
## API
|
||||
@@ -55,4 +74,4 @@ This plugin accepts the following configuration options:
|
||||
- Category: Component
|
||||
- Function name: `ExternalPlugin.Comments()`.
|
||||
- Source: [`quartz-community/comments`](https://github.com/quartz-community/comments)
|
||||
- Install: `npx quartz plugin add github:quartz-community/comments`
|
||||
- Install: `npx quartz plugin add @quartz-community/comments`
|
||||
@@ -15,5 +15,5 @@ This plugin has no configuration options.
|
||||
## API
|
||||
|
||||
- Category: Emitter
|
||||
- Function name: `Plugin.ComponentResources()` (internal plugin).
|
||||
- Internal plugin: always runs and has no entry in `quartz.config.yaml`.
|
||||
- Source: [`quartz/plugins/emitters/componentResources.ts`](https://github.com/jackyzha0/quartz/blob/v5/quartz/plugins/emitters/componentResources.ts).
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: ContentMeta
|
||||
description: Displays creation date and reading time.
|
||||
description: Displays the page date and reading time.
|
||||
tags:
|
||||
- plugin/component
|
||||
image:
|
||||
@@ -9,7 +9,9 @@ enabled: true
|
||||
required: false
|
||||
---
|
||||
|
||||
This plugin displays content metadata below the article title, such as the creation date and estimated reading time.
|
||||
This plugin displays content metadata below the article title: the page's date and the estimated reading time.
|
||||
|
||||
The date shown is the one selected by the `defaultDateType` option of [[CreatedModifiedDate]] (`modified` by default), so no date is shown when that plugin is disabled. Pages without text content show no metadata.
|
||||
|
||||
> [!note]
|
||||
> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page.
|
||||
@@ -24,11 +26,14 @@ This plugin accepts the following configuration options:
|
||||
### Default options
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: github:quartz-community/content-meta
|
||||
- source: "@quartz-community/content-meta"
|
||||
enabled: true
|
||||
options:
|
||||
showReadingTime: true
|
||||
showComma: true
|
||||
layout:
|
||||
position: beforeBody
|
||||
priority: 20
|
||||
```
|
||||
|
||||
## API
|
||||
@@ -36,4 +41,4 @@ This plugin accepts the following configuration options:
|
||||
- Category: Component
|
||||
- Function name: `ExternalPlugin.ContentMeta()`.
|
||||
- Source: [`quartz-community/content-meta`](https://github.com/quartz-community/content-meta)
|
||||
- Install: `npx quartz plugin add github:quartz-community/content-meta`
|
||||
- Install: `npx quartz plugin add @quartz-community/content-meta`
|
||||
@@ -9,16 +9,21 @@ enabled: true
|
||||
required: false
|
||||
---
|
||||
|
||||
This plugin is a page type plugin for the Quartz framework. It generates the HTML pages for each piece of Markdown content. It emits the full-page [[layout]], including headers, footers, and body content, among others. It uses the `default` [[layout#Page Frames|page frame]] (three-column layout with sidebars). It is now configured in the `pageTypes` section of `quartz.config.yaml`.
|
||||
This plugin is a page type plugin for the Quartz framework. It generates the HTML pages for each piece of Markdown content. It emits the full-page [[layout]], including headers, footers, and body content, among others. It uses the `default` [[layout#Page Frames|page frame]] (three-column layout with sidebars). Like other page types, it is configured as an ordinary entry in the `plugins` list of `quartz.config.yaml`; the layout of content pages can be adjusted under `layout.byPageType.content` (see [[layout]]).
|
||||
|
||||
> [!note]
|
||||
> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page.
|
||||
|
||||
This plugin has no configuration options.
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: "@quartz-community/content-page"
|
||||
enabled: true
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
- Category: Page Type
|
||||
- Function name: `ExternalPlugin.ContentPage()`.
|
||||
- Source: [`quartz-community/content-page`](https://github.com/quartz-community/content-page)
|
||||
- Install: `npx quartz plugin add github:quartz-community/content-page`
|
||||
- Install: `npx quartz plugin add @quartz-community/content-page`
|
||||
@@ -17,9 +17,23 @@ This plugin determines the created, modified, and published dates for a document
|
||||
This plugin accepts the following configuration options:
|
||||
|
||||
- `priority`: The data sources to consult for date information. Highest priority first. Possible values are `"frontmatter"`, `"git"`, and `"filesystem"`. Defaults to `["frontmatter", "git", "filesystem"]`.
|
||||
- `defaultDateType`: Which date type to use when displaying dates. Can be `"created"`, `"modified"`, or `"published"`. Defaults to `"modified"`.
|
||||
- `defaultDateType`: Which date type to use when displaying dates (for example in [[ContentMeta]], [[RecentNotes]] and folder/tag listings). Can be `"created"`, `"modified"`, or `"published"`. Defaults to `"modified"`.
|
||||
|
||||
When loading the frontmatter, the value of [[Frontmatter#List]] is used.
|
||||
When loading the frontmatter, the `created`, `modified` and `published` fields (and their aliases such as `date`, `lastmod` and `updated`, see [[Frontmatter#Supported frontmatter]]) are used. Git only provides the modified date; the filesystem provides created and modified dates. A source only fills dates that a higher-priority source has not set. Date-only values such as `2024-03-05` are read as local midnight.
|
||||
|
||||
### Default options
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: "@quartz-community/created-modified-date"
|
||||
enabled: true
|
||||
options:
|
||||
defaultDateType: modified
|
||||
priority:
|
||||
- frontmatter
|
||||
- git
|
||||
- filesystem
|
||||
order: 10
|
||||
```
|
||||
|
||||
> [!warning]
|
||||
> If you rely on `git` for dates, make sure `defaultDateType` is set to `modified` in the plugin's options.
|
||||
@@ -31,4 +45,4 @@ When loading the frontmatter, the value of [[Frontmatter#List]] is used.
|
||||
- Category: Transformer
|
||||
- Function name: `ExternalPlugin.CreatedModifiedDate()`.
|
||||
- Source: [`quartz-community/created-modified-date`](https://github.com/quartz-community/created-modified-date)
|
||||
- Install: `npx quartz plugin add github:quartz-community/created-modified-date`
|
||||
- Install: `npx quartz plugin add @quartz-community/created-modified-date`
|
||||
+57
-221
@@ -26,49 +26,51 @@ The Custom OG Images emitter plugin generates social media preview images for yo
|
||||
|
||||
> [!info] Info
|
||||
>
|
||||
> The `baseUrl` property in your [[configuration]] must be set properly for social images to work correctly, as they require absolute paths.
|
||||
> The `baseUrl` property in your [[configuration]] must be set properly for social images to work correctly, as they require absolute URLs. Without `baseUrl`, no image meta tags are emitted.
|
||||
|
||||
Each page gets an image at `<slug>-og-image.webp`; pages with a `socialImage` in their frontmatter are skipped.
|
||||
|
||||
This plugin accepts the following configuration options:
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
plugins:
|
||||
- source: github:quartz-community/og-image
|
||||
- source: "@quartz-community/og-image"
|
||||
enabled: true
|
||||
options:
|
||||
colorScheme: lightMode # "lightMode" or "darkMode"
|
||||
width: 1200
|
||||
height: 630
|
||||
excludeRoot: false
|
||||
defaultTitle: Untitled
|
||||
defaultDescription: No description provided
|
||||
useGeneratedDescription: true
|
||||
```
|
||||
|
||||
For the TS override approach (needed for custom `imageStructure`):
|
||||
The options that take functions (`imageStructure`, `readingTimeText`) need the TS override approach:
|
||||
|
||||
```ts title="quartz.ts (override)"
|
||||
import * as ExternalPlugin from "./.quartz/plugins"
|
||||
import { defaultImage } from "./quartz/plugins/emitters/ogImage"
|
||||
import { myImage } from "./socialImage"
|
||||
|
||||
// Must be placed before loadQuartzConfig()
|
||||
ExternalPlugin.CustomOgImages({
|
||||
colorScheme: "lightMode",
|
||||
width: 1200,
|
||||
height: 630,
|
||||
excludeRoot: false,
|
||||
imageStructure: defaultImage,
|
||||
imageStructure: myImage, // omit to keep the built-in design
|
||||
readingTimeText: (minutes) => `${minutes} min read`,
|
||||
})
|
||||
```
|
||||
|
||||
### Configuration Options
|
||||
|
||||
| Option | Type | Default | Description |
|
||||
| ------------------------- | --------- | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `colorScheme` | string | "lightMode" | Theme to use for generating images ("darkMode" or "lightMode") |
|
||||
| `width` | number | 1200 | Width of the generated image in pixels |
|
||||
| `height` | number | 630 | Height of the generated image in pixels |
|
||||
| `excludeRoot` | boolean | false | Whether to exclude the root index page from auto-generated images |
|
||||
| `defaultTitle` | string | "Untitled" | Fallback title when a page has no title |
|
||||
| `defaultDescription` | string | "No description provided" | Fallback description when a page has no description |
|
||||
| `useGeneratedDescription` | boolean | true | Use a generated description (the [[Description]] plugin's excerpt of the page) when the frontmatter has none. Set to `false` to show `defaultDescription` instead |
|
||||
| `imageStructure` | component | defaultImage | Custom component to use for image generation |
|
||||
| Option | Type | Default | Description |
|
||||
| ------------------------- | --------- | --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `colorScheme` | string | "lightMode" | Theme to use for generating images ("darkMode" or "lightMode") |
|
||||
| `width` | number | 1200 | Width of the generated image in pixels |
|
||||
| `height` | number | 630 | Height of the generated image in pixels |
|
||||
| `defaultTitle` | string | "Untitled" | Fallback title when a page has no title |
|
||||
| `defaultDescription` | string | "No description provided" | Fallback description when a page has no description |
|
||||
| `useGeneratedDescription` | boolean | true | Use a generated description (the [[Description]] plugin's excerpt of the page) when the frontmatter has none. Set to `false` to show `defaultDescription` instead |
|
||||
| `readingTimeText` | function | `` `${minutes} min read` `` | Formats the reading time shown by the built-in design (TS override only) |
|
||||
| `imageStructure` | component | built-in design | Custom component to use for image generation (TS override only) |
|
||||
|
||||
The description on an image is, in order: the frontmatter's `socialDescription`, its `description`, the generated description (unless `useGeneratedDescription` is `false`), and finally `defaultDescription`. With the [[Description]] plugin enabled, every page with text has a generated description, so `defaultDescription` mostly shows with `useGeneratedDescription: false`.
|
||||
|
||||
@@ -93,100 +95,59 @@ The `socialImage` property should contain a link to an image either relative to
|
||||
|
||||
You can fully customize how the images being generated look by passing your own component to `imageStructure`. This component takes JSX + some page metadata/config options and converts it to an image using [satori](https://github.com/vercel/satori). Vercel provides an [online playground](https://og-playground.vercel.app/) that can be used to preview how your JSX looks like as a picture. This is ideal for prototyping your custom design.
|
||||
|
||||
The component receives a single object:
|
||||
|
||||
| Property | Description |
|
||||
| ------------- | ----------------------------------------------------------------------------- |
|
||||
| `cfg` | The global configuration (`cfg.theme.colors`, `cfg.baseUrl`, `cfg.locale`, …) |
|
||||
| `userOpts` | The plugin options (`colorScheme`, `width`, `height`, …) |
|
||||
| `title` | The page title (or `defaultTitle`) followed by `pageTitleSuffix` |
|
||||
| `description` | The description (see above) |
|
||||
| `fonts` | The fonts loaded for satori |
|
||||
| `fileData` | Page data: `slug`, `frontmatter`, `description`, `text`, `filePath`, `dates` |
|
||||
| `iconBase64` | `quartz/static/icon.png` as a data URL, if present |
|
||||
|
||||
### Fonts
|
||||
|
||||
You will also be passed an array containing a header and a body font (where the first entry is header and the second is body). The fonts matches the ones selected in `theme.typography.header` and `theme.typography.body` from `quartz.config.yaml` and will be passed in the format required by [`satori`](https://github.com/vercel/satori). To use them in CSS, use the `.name` property (e.g. `fontFamily: fonts[1].name` to use the "body" font family).
|
||||
`fonts` contains the header font followed by the body font, matching `theme.typography.header` and `theme.typography.body` from `quartz.config.yaml`, in the format required by [`satori`](https://github.com/vercel/satori). They are downloaded from Google Fonts (cached in `.quartz-cache/fonts`); if that fails, a system font is used, and if no font is available at all, image generation is skipped with a warning. To use them in CSS, use the `.name` property (e.g. `fontFamily: fonts[1].name` to use the "body" font family).
|
||||
|
||||
An example of a component using the header font could look like this:
|
||||
|
||||
```tsx title="socialImage.tsx"
|
||||
export const myImage: SocialImageOptions["imageStructure"] = (...) => {
|
||||
import type { SocialImageOptions } from "@quartz-community/og-image"
|
||||
|
||||
export const myImage: SocialImageOptions["imageStructure"] = ({ fonts }) => {
|
||||
return <p style={{ fontFamily: fonts[0].name }}>Cool Header!</p>
|
||||
}
|
||||
```
|
||||
|
||||
> [!example]- Local fonts
|
||||
>
|
||||
> For cases where you use a local fonts under `static` folder, make sure to set the correct `@font-face` in `custom.scss`
|
||||
>
|
||||
> ```scss title="custom.scss"
|
||||
> @font-face {
|
||||
> font-family: "Newsreader";
|
||||
> font-style: normal;
|
||||
> font-weight: normal;
|
||||
> font-display: swap;
|
||||
> src: url("/static/Newsreader.woff2") format("woff2");
|
||||
> }
|
||||
> ```
|
||||
>
|
||||
> Then in `quartz/util/og.tsx`, you can load the Satori fonts like so:
|
||||
>
|
||||
> ```tsx title="quartz/util/og.tsx"
|
||||
> import { joinSegments, QUARTZ } from "../path"
|
||||
> import fs from "fs"
|
||||
> import path from "path"
|
||||
>
|
||||
> const newsreaderFontPath = joinSegments(QUARTZ, "static", "Newsreader.woff2")
|
||||
> export async function getSatoriFonts(headerFont: FontSpecification, bodyFont: FontSpecification) {
|
||||
> // ... rest of implementation remains same
|
||||
> const fonts: SatoriOptions["fonts"] = [
|
||||
> ...headerFontData.map((data, idx) => ({
|
||||
> name: headerFontName,
|
||||
> data,
|
||||
> weight: headerWeights[idx],
|
||||
> style: "normal" as const,
|
||||
> })),
|
||||
> ...bodyFontData.map((data, idx) => ({
|
||||
> name: bodyFontName,
|
||||
> data,
|
||||
> weight: bodyWeights[idx],
|
||||
> style: "normal" as const,
|
||||
> })),
|
||||
> {
|
||||
> name: "Newsreader",
|
||||
> data: await fs.promises.readFile(path.resolve(newsreaderFontPath)),
|
||||
> weight: 400,
|
||||
> style: "normal" as const,
|
||||
> },
|
||||
> ]
|
||||
>
|
||||
> return fonts
|
||||
> }
|
||||
> ```
|
||||
>
|
||||
> This font then can be used with your custom structure.
|
||||
|
||||
## Examples
|
||||
|
||||
Here are some example image components you can use as a starting point:
|
||||
|
||||
### Basic Example
|
||||
|
||||
This example will generate images that look as follows:
|
||||
Here is an example image component you can use as a starting point. It generates images that look as follows:
|
||||
|
||||
| Light | Dark |
|
||||
| ------------------------------------------ | ----------------------------------------- |
|
||||
| ![[custom-social-image-preview-light.png]] | ![[custom-social-image-preview-dark.png]] |
|
||||
|
||||
```tsx
|
||||
import { SatoriOptions } from "satori/wasm"
|
||||
import { GlobalConfiguration } from "../cfg"
|
||||
import { SocialImageOptions, UserOpts } from "./imageHelper"
|
||||
import { QuartzPluginData } from "../plugins/vfile"
|
||||
```tsx title="socialImage.tsx"
|
||||
import type { SocialImageOptions } from "@quartz-community/og-image"
|
||||
|
||||
export const customImage: SocialImageOptions["imageStructure"] = (
|
||||
cfg: GlobalConfiguration,
|
||||
userOpts: UserOpts,
|
||||
title: string,
|
||||
description: string,
|
||||
fonts: SatoriOptions["fonts"],
|
||||
fileData: QuartzPluginData,
|
||||
) => {
|
||||
export const customImage: SocialImageOptions["imageStructure"] = ({
|
||||
cfg,
|
||||
userOpts,
|
||||
title,
|
||||
description,
|
||||
fonts,
|
||||
}) => {
|
||||
// How many characters are allowed before switching to smaller font
|
||||
const fontBreakPoint = 22
|
||||
const useSmallerFont = title.length > fontBreakPoint
|
||||
|
||||
const { colorScheme } = userOpts
|
||||
// `cfg.theme` is typed `unknown` in @quartz-community/types
|
||||
const colors = (cfg.theme as { colors: Record<string, Record<string, string>> }).colors[
|
||||
colorScheme
|
||||
]
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
@@ -205,7 +166,7 @@ export const customImage: SocialImageOptions["imageStructure"] = (
|
||||
justifyContent: "center",
|
||||
height: "100%",
|
||||
width: "100%",
|
||||
backgroundColor: cfg.theme.colors[colorScheme].light,
|
||||
backgroundColor: colors.light,
|
||||
flexDirection: "column",
|
||||
gap: "2.5rem",
|
||||
paddingTop: "2rem",
|
||||
@@ -214,7 +175,7 @@ export const customImage: SocialImageOptions["imageStructure"] = (
|
||||
>
|
||||
<p
|
||||
style={{
|
||||
color: cfg.theme.colors[colorScheme].dark,
|
||||
color: colors.dark,
|
||||
fontSize: useSmallerFont ? 70 : 82,
|
||||
marginLeft: "4rem",
|
||||
textAlign: "center",
|
||||
@@ -226,7 +187,7 @@ export const customImage: SocialImageOptions["imageStructure"] = (
|
||||
</p>
|
||||
<p
|
||||
style={{
|
||||
color: cfg.theme.colors[colorScheme].dark,
|
||||
color: colors.dark,
|
||||
fontSize: 44,
|
||||
marginLeft: "8rem",
|
||||
marginRight: "8rem",
|
||||
@@ -242,7 +203,7 @@ export const customImage: SocialImageOptions["imageStructure"] = (
|
||||
height: "100%",
|
||||
width: "2vw",
|
||||
position: "absolute",
|
||||
backgroundColor: cfg.theme.colors[colorScheme].tertiary,
|
||||
backgroundColor: colors.tertiary,
|
||||
opacity: 0.85,
|
||||
}}
|
||||
/>
|
||||
@@ -251,136 +212,11 @@ export const customImage: SocialImageOptions["imageStructure"] = (
|
||||
}
|
||||
```
|
||||
|
||||
### Advanced Example
|
||||
|
||||
The following example includes a customized social image with a custom background and formatted date:
|
||||
|
||||
```typescript title="custom-og.tsx"
|
||||
export const og: SocialImageOptions["Component"] = (
|
||||
cfg: GlobalConfiguration,
|
||||
fileData: QuartzPluginData,
|
||||
{ colorScheme }: Options,
|
||||
title: string,
|
||||
description: string,
|
||||
fonts: SatoriOptions["fonts"],
|
||||
) => {
|
||||
let created: string | undefined
|
||||
let reading: string | undefined
|
||||
if (fileData.dates) {
|
||||
created = formatDate(getDate(cfg, fileData)!, cfg.locale)
|
||||
}
|
||||
const { minutes, text: _timeTaken, words: _words } = readingTime(fileData.text!)
|
||||
reading = i18n(cfg.locale).components.contentMeta.readingTime({
|
||||
minutes: Math.ceil(minutes),
|
||||
})
|
||||
|
||||
const Li = [created, reading]
|
||||
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
position: "relative",
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
alignItems: "flex-start",
|
||||
height: "100%",
|
||||
width: "100%",
|
||||
backgroundImage: `url("https://${cfg.baseUrl}/static/og-image.jpeg")`,
|
||||
backgroundSize: "100% 100%",
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
position: "absolute",
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
background: "radial-gradient(circle at center, transparent, rgba(0, 0, 0, 0.4) 70%)",
|
||||
}}
|
||||
/>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
height: "100%",
|
||||
width: "100%",
|
||||
flexDirection: "column",
|
||||
justifyContent: "flex-start",
|
||||
alignItems: "flex-start",
|
||||
gap: "1.5rem",
|
||||
paddingTop: "4rem",
|
||||
paddingBottom: "4rem",
|
||||
marginLeft: "4rem",
|
||||
}}
|
||||
>
|
||||
<img
|
||||
src={`"https://${cfg.baseUrl}/static/icon.jpeg"`}
|
||||
style={{
|
||||
position: "relative",
|
||||
backgroundClip: "border-box",
|
||||
borderRadius: "6rem",
|
||||
}}
|
||||
width={80}
|
||||
/>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
textAlign: "left",
|
||||
fontFamily: fonts[0].name,
|
||||
}}
|
||||
>
|
||||
<h2
|
||||
style={{
|
||||
color: cfg.theme.colors[colorScheme].light,
|
||||
fontSize: "3rem",
|
||||
fontWeight: 700,
|
||||
marginRight: "4rem",
|
||||
fontFamily: fonts[0].name,
|
||||
}}
|
||||
>
|
||||
{title}
|
||||
</h2>
|
||||
<ul
|
||||
style={{
|
||||
color: cfg.theme.colors[colorScheme].gray,
|
||||
gap: "1rem",
|
||||
fontSize: "1.5rem",
|
||||
fontFamily: fonts[1].name,
|
||||
}}
|
||||
>
|
||||
{Li.map((item, index) => {
|
||||
if (item) {
|
||||
return <li key={index}>{item}</li>
|
||||
}
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
<p
|
||||
style={{
|
||||
color: cfg.theme.colors[colorScheme].light,
|
||||
fontSize: "1.5rem",
|
||||
overflow: "hidden",
|
||||
marginRight: "8rem",
|
||||
textOverflow: "ellipsis",
|
||||
display: "-webkit-box",
|
||||
WebkitLineClamp: 7,
|
||||
WebkitBoxOrient: "vertical",
|
||||
lineClamp: 7,
|
||||
fontFamily: fonts[1].name,
|
||||
}}
|
||||
>
|
||||
{description}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
```
|
||||
Page dates are available as `fileData.dates?.created` / `modified` / `published` (with [[CreatedModifiedDate]]) and the page text as `fileData.text`, for example to show a date or reading time.
|
||||
|
||||
## API
|
||||
|
||||
- Category: Emitter
|
||||
- Function name: `ExternalPlugin.CustomOgImages()`.
|
||||
- Source: [`quartz-community/og-image`](https://github.com/quartz-community/og-image)
|
||||
- Install: `npx quartz plugin add github:quartz-community/og-image`
|
||||
- Install: `npx quartz plugin add @quartz-community/og-image`
|
||||
@@ -14,19 +14,21 @@ Dark mode toggle.
|
||||
> [!note]
|
||||
> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page.
|
||||
|
||||
See [[plugins/Darkmode]] for detailed usage information.
|
||||
See [[features/darkmode|Darkmode]] for detailed usage information.
|
||||
|
||||
## Configuration
|
||||
|
||||
This plugin accepts the following configuration options:
|
||||
|
||||
- `enabled`: Whether to enable the dark mode toggle. Defaults to `true`.
|
||||
This plugin has no configuration options. To remove the toggle, set `enabled: false` on its entry.
|
||||
|
||||
### Default options
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: github:quartz-community/darkmode
|
||||
- source: "@quartz-community/darkmode"
|
||||
enabled: true
|
||||
layout:
|
||||
position: left
|
||||
priority: 30
|
||||
group: toolbar
|
||||
```
|
||||
|
||||
## API
|
||||
@@ -34,4 +36,4 @@ This plugin accepts the following configuration options:
|
||||
- Category: Component
|
||||
- Function name: `ExternalPlugin.Darkmode()`.
|
||||
- Source: [`quartz-community/darkmode`](https://github.com/quartz-community/darkmode)
|
||||
- Install: `npx quartz plugin add github:quartz-community/darkmode`
|
||||
- Install: `npx quartz plugin add @quartz-community/darkmode`
|
||||
@@ -11,20 +11,32 @@ required: false
|
||||
|
||||
This plugin generates descriptions that are used as metadata for the HTML `head`, the [[RSS Feed]] and in [[folder and tag listings]] if there is no main body content, the description is used as the text between the title and the listing.
|
||||
|
||||
If the frontmatter contains a `description` property, it is used (see [[authoring content#Syntax]]). Otherwise, the plugin will do its best to use the first few sentences of the content to reach the target description length.
|
||||
If the frontmatter contains a `description` property, it is used (see [[authoring content#Syntax]]). Otherwise, the plugin builds one from the first sentences of the content.
|
||||
|
||||
> [!note]
|
||||
> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page.
|
||||
|
||||
This plugin accepts the following configuration options:
|
||||
|
||||
- `descriptionLength`: the target length of the generated description. Default is 150 characters. The cut off happens after the first _sentence_ that ends after the given length.
|
||||
- `maxDescriptionLength`: the hard maximum length of the description. If the generated description exceeds this, it is truncated with an ellipsis. Default is 300 characters.
|
||||
- `replaceExternalLinks`: If `true` (default), replace external links with their domain and path in the description (e.g. `https://domain.tld/some_page/another_page?query=hello&target=world` is replaced with `domain.tld/some_page/another_page`).
|
||||
- `descriptionLength`: the target length of the generated description. Default is 150 characters. Whole sentences are added as long as the description stays within this length; the sentence that would exceed it is left out. The first sentence is always kept, however long it is.
|
||||
- `maxDescriptionLength`: the hard maximum length of the generated description. If it exceeds this (e.g. a long first sentence), it is truncated with an ellipsis. Default is 300 characters. A `description` from the frontmatter is not truncated.
|
||||
- `replaceExternalLinks`: If `true` (default), replace external links in both generated and frontmatter descriptions with their domain and path in the description (e.g. `https://domain.tld/some_page/another_page?query=hello&target=world` is replaced with `domain.tld/some_page/another_page`).
|
||||
|
||||
### Default options
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: "@quartz-community/description"
|
||||
enabled: true
|
||||
options:
|
||||
descriptionLength: 150
|
||||
maxDescriptionLength: 300
|
||||
replaceExternalLinks: true
|
||||
order: 70
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
- Category: Transformer
|
||||
- Function name: `ExternalPlugin.Description()`.
|
||||
- Source: [`quartz-community/description`](https://github.com/quartz-community/description)
|
||||
- Install: `npx quartz plugin add github:quartz-community/description`
|
||||
- Install: `npx quartz plugin add @quartz-community/description`
|
||||
@@ -85,6 +85,10 @@ A stealth page:
|
||||
|
||||
Use stealth pages for "secret door" content that should only reach users who already know the exact URL: private notes linked from an external wiki, personal pages you send to specific people, or anything you never want to show up in a site-internal search even to authenticated readers.
|
||||
|
||||
### Bases, canvases and drawings
|
||||
|
||||
With Quartz 5.1 and encrypted-pages 1.1, pages rendered from files (`.base`, `.canvas`, Excalidraw drawings) are encrypted too. A drawing stored as Markdown uses the `password` in its frontmatter. A `.base`, `.canvas` or `.excalidraw` file has no frontmatter, so it is encrypted with the password of the encrypted published note that links to it (the first by slug when several do); linked only from unencrypted pages, it stays unencrypted.
|
||||
|
||||
## Configuration
|
||||
|
||||
This plugin provides a transformer, an emitter, and a component. All options are set on a single config entry and shared between the transformer and the emitter — Quartz instantiates both automatically.
|
||||
@@ -101,17 +105,18 @@ This plugin provides a transformer, an emitter, and a component. All options are
|
||||
### Default options
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: github:quartz-community/encrypted-pages
|
||||
- source: "@quartz-community/encrypted-pages"
|
||||
enabled: true
|
||||
options:
|
||||
iterations: 600000
|
||||
passwordField: password
|
||||
unlistWhenEncrypted: false
|
||||
outputPath: static/encryptedContentIndex.json
|
||||
order: 900
|
||||
```
|
||||
|
||||
> [!warning]
|
||||
> The `EncryptedPages` transformer replaces the entire HAST tree of an encrypted page with an opaque ciphertext container. Any transformer that needs to read the real HTML — in particular [[CrawlLinks]], which populates the links used by backlinks and the shadow content index — must run **before** `EncryptedPages`. Use the `order` field in `quartz.config.yaml` to control this.
|
||||
> The `EncryptedPages` transformer replaces the entire HAST tree of an encrypted page with an opaque ciphertext container. Any transformer that needs to read the real HTML must run **before** `EncryptedPages`. Quartz's built-in [[CrawlLinks|link processing]] (`configuration.links`), which populates the links used by backlinks and the shadow content index, runs at order 60, and `EncryptedPages` defaults to order 900, so this holds out of the box. If you add other transformers that read page HTML, give them an `order` below `EncryptedPages`'.
|
||||
|
||||
## Security
|
||||
|
||||
@@ -126,4 +131,4 @@ This plugin provides a transformer, an emitter, and a component. All options are
|
||||
- Category: Transformer, Emitter
|
||||
- Function name: `ExternalPlugin.EncryptedPages()`, `ExternalPlugin.EncryptedContentIndex()`.
|
||||
- Source: [`quartz-community/encrypted-pages`](https://github.com/quartz-community/encrypted-pages)
|
||||
- Install: `npx quartz plugin add github:quartz-community/encrypted-pages`
|
||||
- Install: `npx quartz plugin add @quartz-community/encrypted-pages`
|
||||
@@ -26,4 +26,4 @@ Files without frontmatter — `.base`, `.canvas` and `.excalidraw` files — can
|
||||
- Category: Filter
|
||||
- Function name: `ExternalPlugin.ExplicitPublish()`.
|
||||
- Source: [`quartz-community/explicit-publish`](https://github.com/quartz-community/explicit-publish)
|
||||
- Install: `npx quartz plugin add github:quartz-community/explicit-publish`
|
||||
- Install: `npx quartz plugin add @quartz-community/explicit-publish`
|
||||
@@ -14,7 +14,7 @@ File tree explorer sidebar.
|
||||
> [!note]
|
||||
> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page.
|
||||
|
||||
See [[plugins/Explorer]] for detailed usage information.
|
||||
See [[features/explorer|Explorer]] for detailed usage information.
|
||||
|
||||
## Configuration
|
||||
|
||||
@@ -22,7 +22,7 @@ This plugin accepts the following configuration options:
|
||||
|
||||
**YAML options** (in `quartz.config.yaml`):
|
||||
|
||||
- `title`: The title of the explorer. Defaults to `Explorer`.
|
||||
- `title`: The title of the explorer. Defaults to the localized "Explorer" (see [[i18n]]).
|
||||
- `folderClickBehavior`: The behavior when a folder is clicked. Can be `"link"` to navigate or `"collapse"` to toggle. Defaults to `link`.
|
||||
- `folderDefaultState`: The default state of folders. Can be `"collapsed"` or `"open"`. Defaults to `collapsed`.
|
||||
- `useSavedState`: Whether to use local storage to save the state of the explorer. Defaults to `true`.
|
||||
@@ -34,16 +34,20 @@ This plugin accepts the following configuration options:
|
||||
- `mapFn`: Custom map function to transform node properties (e.g. display names).
|
||||
- `order`: Array controlling the order of operations. Defaults to `["filter", "map", "sort"]`.
|
||||
|
||||
By default the explorer hides the `tags` folder (`filterFn`) and sorts folders before files, then alphabetically with numeric ordering (`sortFn`).
|
||||
|
||||
### Default options
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: github:quartz-community/explorer
|
||||
- source: "@quartz-community/explorer"
|
||||
enabled: true
|
||||
options:
|
||||
title: Explorer
|
||||
folderClickBehavior: link
|
||||
folderDefaultState: collapsed
|
||||
useSavedState: true
|
||||
layout:
|
||||
position: left
|
||||
priority: 50
|
||||
```
|
||||
|
||||
### TS override example
|
||||
@@ -67,4 +71,4 @@ See [[features/explorer#Advanced customization]] for more examples.
|
||||
- Category: Component
|
||||
- Function name: `ExternalPlugin.Explorer()`.
|
||||
- Source: [`quartz-community/explorer`](https://github.com/quartz-community/explorer)
|
||||
- Install: `npx quartz plugin add github:quartz-community/explorer`
|
||||
- Install: `npx quartz plugin add @quartz-community/explorer` (included in the default configuration)
|
||||
@@ -22,4 +22,4 @@ This plugin has no configuration options.
|
||||
- Category: Emitter
|
||||
- Function name: `ExternalPlugin.Favicon()`.
|
||||
- Source: [`quartz-community/favicon`](https://github.com/quartz-community/favicon)
|
||||
- Install: `npx quartz plugin add github:quartz-community/favicon`
|
||||
- Install: `npx quartz plugin add @quartz-community/favicon` (included in the default configuration)
|
||||
@@ -18,14 +18,27 @@ Example: [[advanced/|Advanced]]
|
||||
|
||||
This plugin accepts the following configuration options:
|
||||
|
||||
- `showFolderCount`: Whether to display the number of pages in the folder. Defaults to `true`.
|
||||
- `showSubfolders`: Whether to include pages from subfolders in the listing. Defaults to `true`.
|
||||
- `sort`: A function of type `(f1: QuartzPluginData, f2: QuartzPluginData) => number{:ts}` used to sort entries. Defaults to sorting by date and tie-breaking on lexographical order. Requires a TS override.
|
||||
- `prefixFolders`: If `true`, generated folder page titles are prefixed with "Folder: " (e.g. "Folder: notes"). Defaults to `false`.
|
||||
- `showFolderCount`: Whether to display the number of entries in the folder ("N items under this folder"). Defaults to `true`.
|
||||
- `showSubfolders`: Whether to list each direct subfolder as an entry of its own (linking to the subfolder's page). When `false`, only the pages directly inside the folder are listed. Defaults to `true`.
|
||||
- `prefixFolders`: If `true`, folder page titles that Quartz generates (and `index` notes without a title of their own) are prefixed with the localized "Folder" label (e.g. "Folder: notes"). Defaults to `false`.
|
||||
- `sort`: A function of type `(f1: QuartzPluginData, f2: QuartzPluginData) => number{:ts}` used to sort entries. Defaults to listing folders first, then pages by date (newest first), tie-breaking on lexicographical title order. Requires a TS override.
|
||||
|
||||
Folders are listed even when they hold only pages generated by other page types, such as `.base` or `.canvas` pages. Pages hidden with [[UnlistedPages]] are left out.
|
||||
|
||||
### Default options
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: "@quartz-community/folder-page"
|
||||
enabled: true
|
||||
options:
|
||||
showFolderCount: true
|
||||
showSubfolders: true
|
||||
prefixFolders: false
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
- Category: Page Type
|
||||
- Function name: `ExternalPlugin.FolderPage()`.
|
||||
- Source: [`quartz-community/folder-page`](https://github.com/quartz-community/folder-page)
|
||||
- Install: `npx quartz plugin add github:quartz-community/folder-page`
|
||||
- Install: `npx quartz plugin add @quartz-community/folder-page` (included in the default configuration)
|
||||
+29
-28
@@ -10,7 +10,7 @@ enabled: true
|
||||
required: false
|
||||
---
|
||||
|
||||
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 [Quartz Themes](https://github.com/saberzero1/quartz-themes), Google Fonts integration with automatic weight and italic loading, and falls back to Obsidian's default system font stacks.
|
||||
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.
|
||||
@@ -46,18 +46,18 @@ This plugin accepts the following configuration options:
|
||||
| Option | Type | Default | Description |
|
||||
| --------------- | ------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------- |
|
||||
| `title` | `FontSpecification` | `header` value | Font family for the site title. |
|
||||
| `body` | `FontSpecification` | Obsidian default | Font family for body text. |
|
||||
| `header` | `FontSpecification` | Obsidian default | Default font family for all headings (h1-h6). |
|
||||
| `code` | `FontSpecification` | Obsidian default | Font family for code and monospace elements. |
|
||||
| `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 [Quartz Themes](https://github.com/saberzero1/quartz-themes) as defaults when it is installed. |
|
||||
| `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
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: github:quartz-community/fonts
|
||||
- source: "@quartz-community/quartz-fonts"
|
||||
enabled: true
|
||||
options:
|
||||
useThemeFonts: true
|
||||
@@ -69,26 +69,31 @@ This plugin accepts the following configuration options:
|
||||
Fonts are resolved using a priority chain:
|
||||
|
||||
```
|
||||
User config (plugin options)
|
||||
→ Theme fonts (from Quartz Themes, if installed)
|
||||
→ Obsidian defaults (system font stacks)
|
||||
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 → header option → theme --h1-font → theme font → Obsidian default
|
||||
h1 option → theme --h1-font → header option → theme body font → resolved header font
|
||||
```
|
||||
|
||||
For the site title:
|
||||
|
||||
```
|
||||
title option → header option → theme font → Obsidian default
|
||||
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 [Quartz Themes](https://github.com/saberzero1/quartz-themes) is installed and 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.
|
||||
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).
|
||||
|
||||
@@ -97,23 +102,23 @@ Fonts must run **after** Quartz Themes. This is handled automatically by plugin
|
||||
|
||||
## Usage without Quartz Themes
|
||||
|
||||
Fonts works standalone. Without a theme, it falls back to Obsidian's default system font stacks. You can set fonts explicitly via the plugin options.
|
||||
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: github:quartz-community/fonts
|
||||
- source: "@quartz-community/quartz-fonts"
|
||||
enabled: true
|
||||
|
||||
# Override just the heading font
|
||||
- source: github:quartz-community/fonts
|
||||
- source: "@quartz-community/quartz-fonts"
|
||||
enabled: true
|
||||
options:
|
||||
header: '"Playfair Display", serif'
|
||||
|
||||
# Full control with per-heading fonts
|
||||
- source: github:quartz-community/fonts
|
||||
- source: "@quartz-community/quartz-fonts"
|
||||
enabled: true
|
||||
options:
|
||||
body: '"Inter", sans-serif'
|
||||
@@ -123,7 +128,7 @@ Fonts works standalone. Without a theme, it falls back to Obsidian's default sys
|
||||
h2: '"Lora", serif'
|
||||
|
||||
# Load from Google Fonts automatically
|
||||
- source: github:quartz-community/fonts
|
||||
- source: "@quartz-community/quartz-fonts"
|
||||
enabled: true
|
||||
options:
|
||||
fontOrigin: googleFonts
|
||||
@@ -132,7 +137,7 @@ Fonts works standalone. Without a theme, it falls back to Obsidian's default sys
|
||||
code: JetBrains Mono
|
||||
|
||||
# Google Fonts with weight/italic control
|
||||
- source: github:quartz-community/fonts
|
||||
- source: "@quartz-community/quartz-fonts"
|
||||
enabled: true
|
||||
options:
|
||||
fontOrigin: googleFonts
|
||||
@@ -148,7 +153,7 @@ Fonts works standalone. Without a theme, it falls back to Obsidian's default sys
|
||||
weights: [400]
|
||||
|
||||
# Custom title font (separate from header)
|
||||
- source: github:quartz-community/fonts
|
||||
- source: "@quartz-community/quartz-fonts"
|
||||
enabled: true
|
||||
options:
|
||||
fontOrigin: googleFonts
|
||||
@@ -158,7 +163,7 @@ Fonts works standalone. Without a theme, it falls back to Obsidian's default sys
|
||||
code: JetBrains Mono
|
||||
|
||||
# Self-hosted fonts (downloaded at build time, no external requests)
|
||||
- source: github:quartz-community/fonts
|
||||
- source: "@quartz-community/quartz-fonts"
|
||||
enabled: true
|
||||
options:
|
||||
fontOrigin: selfHosted
|
||||
@@ -167,7 +172,7 @@ Fonts works standalone. Without a theme, it falls back to Obsidian's default sys
|
||||
code: JetBrains Mono
|
||||
|
||||
# Ignore theme fonts entirely
|
||||
- source: github:quartz-community/fonts
|
||||
- source: "@quartz-community/quartz-fonts"
|
||||
enabled: true
|
||||
options:
|
||||
useThemeFonts: false
|
||||
@@ -185,15 +190,11 @@ At build time, the plugin:
|
||||
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
|
||||
|
||||
> [!note]
|
||||
> Self-hosted fonts require `baseUrl` to be set in your Quartz configuration, since font URLs in the CSS need an absolute path.
|
||||
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.
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
configuration:
|
||||
baseUrl: "example.com"
|
||||
|
||||
plugins:
|
||||
- source: github:quartz-community/fonts
|
||||
- source: "@quartz-community/quartz-fonts"
|
||||
enabled: true
|
||||
options:
|
||||
fontOrigin: selfHosted
|
||||
@@ -223,4 +224,4 @@ Validation warnings are logged to the console but do not block the build.
|
||||
- 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 github:quartz-community/fonts`
|
||||
- Install: `npx quartz plugin add @quartz-community/quartz-fonts` (included in the default configuration)
|
||||
@@ -18,7 +18,7 @@ This plugin renders a footer at the bottom of the page with a "Created with Quar
|
||||
|
||||
This plugin accepts the following configuration options:
|
||||
|
||||
- `links`: A map of link labels to their URLs to display in the footer. Defaults to `{}`.
|
||||
- `links`: A map of link labels to their URLs to display in the footer. Defaults to links to the Quartz GitHub repository and Discord community (see below); set `links: {}` for none.
|
||||
- `message`: Extra text shown below the "Created with Quartz" line, e.g. a license notice or contact details. HTML is allowed: `'Licensed under <a href="/license">CC BY 4.0</a>'`. Not set by default.
|
||||
|
||||
To change the footer further (styles, different markup), see [[customizing components]].
|
||||
@@ -26,12 +26,15 @@ To change the footer further (styles, different markup), see [[customizing compo
|
||||
### Default options
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: github:quartz-community/footer
|
||||
- source: "@quartz-community/footer"
|
||||
enabled: true
|
||||
options:
|
||||
links:
|
||||
GitHub: https://github.com/jackyzha0/quartz
|
||||
Discord Community: https://discord.gg/cRFFHYye7t
|
||||
layout:
|
||||
position: footer
|
||||
priority: 50
|
||||
```
|
||||
|
||||
## API
|
||||
@@ -39,4 +42,4 @@ To change the footer further (styles, different markup), see [[customizing compo
|
||||
- Category: Component
|
||||
- Function name: `ExternalPlugin.Footer()`.
|
||||
- Source: [`quartz-community/footer`](https://github.com/quartz-community/footer)
|
||||
- Install: `npx quartz plugin add github:quartz-community/footer`
|
||||
- Install: `npx quartz plugin add @quartz-community/footer` (included in the default configuration)
|
||||
@@ -24,7 +24,8 @@ Configure it under `configuration.frontmatter` in `quartz.config.yaml`:
|
||||
|
||||
- `delimiters`: the delimiters to use for the frontmatter. Can have one value (e.g. `"---"`) or separate values for opening and closing delimiters (e.g. `["---", "~~~"]`). Defaults to `"---"`.
|
||||
- `language`: the language to use for parsing the frontmatter. Can be `yaml` (default) or `toml`.
|
||||
- `enabled`: set to `false` to turn parsing off — only useful when a plugin replaces it (see [[built-in processing#Replacing a built-in]]).
|
||||
- `enabled`: set to `false` (or use the shorthand `frontmatter: false`) to turn parsing off — only useful when a plugin replaces it (see [[built-in processing#Replacing a built-in]]).
|
||||
- `order`: where parsing runs among the transformers. Defaults to `0` (first).
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
configuration:
|
||||
@@ -33,6 +34,11 @@ configuration:
|
||||
delimiters: "+++"
|
||||
```
|
||||
|
||||
> [!warning]
|
||||
> With [[ObsidianFlavoredMarkdown]]'s default `preset: "legacy"`, only YAML frontmatter between `---` lines is recognized as frontmatter by the Markdown parser; any other block would show up in the page. For TOML (`+++`) or custom delimiters, also set `preset: "strict"` on ObsidianFlavoredMarkdown.
|
||||
|
||||
Frontmatter is data, never code: JavaScript frontmatter (`---js`, `---javascript`) is refused with an error naming the file. Frontmatter that can't be parsed (broken YAML, or a single value or list instead of `key: value` properties) is reported as a problem in that file, so fix the file and build again.
|
||||
|
||||
> [!note]
|
||||
> These two options used to be set on the note-properties plugin. If they are still there, they are applied automatically; `npx quartz plugin doctor --fix` moves them.
|
||||
|
||||
@@ -45,13 +51,14 @@ The `note-properties` plugin accepts the following configuration options:
|
||||
|
||||
- `includeAll`: include all frontmatter properties in the properties panel. When `false`, only `includedProperties` are shown. Defaults to `false`.
|
||||
- `includedProperties`: properties to include when `includeAll` is `false`. Defaults to `["description", "tags", "aliases"]`.
|
||||
- `excludedProperties`: properties to always exclude from display, even when `includeAll` is `true`. Defaults to `[]`.
|
||||
- `excludedProperties`: properties to always exclude from display, whether they come from `includeAll` or `includedProperties`. Defaults to `[]`.
|
||||
- `hidePropertiesView`: hide the visual properties panel by default (it can still be shown per note, see [[#Per-note overrides]]). Defaults to `false`. To never show it, disable the plugin — frontmatter is parsed either way.
|
||||
- `collapsed`: start the panel collapsed (it can still be expanded, and set per note). Defaults to `false`.
|
||||
|
||||
### Default options
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: github:quartz-community/note-properties
|
||||
- source: "@quartz-community/note-properties"
|
||||
enabled: true
|
||||
options:
|
||||
includeAll: false
|
||||
@@ -61,6 +68,11 @@ The `note-properties` plugin accepts the following configuration options:
|
||||
- aliases
|
||||
excludedProperties: []
|
||||
hidePropertiesView: false
|
||||
order: 5
|
||||
layout:
|
||||
position: beforeBody
|
||||
priority: 15
|
||||
display: all
|
||||
```
|
||||
|
||||
## Properties panel
|
||||
@@ -120,4 +132,4 @@ Quartz supports the following frontmatter fields. Where multiple keys are listed
|
||||
- Parsing: built-in transformer, [`quartz/plugins/builtins/frontmatter.ts`](https://github.com/jackyzha0/quartz/blob/v5/quartz/plugins/builtins/frontmatter.ts)
|
||||
- Properties panel: Transformer, Component — `ExternalPlugin.NoteProperties()`.
|
||||
- Source: [`quartz-community/note-properties`](https://github.com/quartz-community/note-properties)
|
||||
- Install: `npx quartz plugin add github:quartz-community/note-properties`
|
||||
- Install: `npx quartz plugin add @quartz-community/note-properties` (included in the default configuration)
|
||||
@@ -19,11 +19,32 @@ In addition, this plugin adds optional features for typographic refinement (such
|
||||
This plugin accepts the following configuration options:
|
||||
|
||||
- `enableSmartyPants`: When true, enables typographic enhancements. Default is true.
|
||||
- `linkHeadings`: When true, automatically adds links to headings. Default is true.
|
||||
- `linkHeadings`: When true, gives headings their `id`s and adds a link to each heading. Default is true. Setting it to `false` also turns off heading ids, so links to headings (`[[page#Heading]]`) and section embeds no longer reach them (on pages with a [[table of contents]], TableOfContents still gives headings ids).
|
||||
|
||||
### Default options
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: "@quartz-community/github-flavored-markdown"
|
||||
enabled: true
|
||||
options:
|
||||
enableSmartyPants: true
|
||||
linkHeadings: true
|
||||
order: 30
|
||||
```
|
||||
|
||||
This plugin must run before [[ObsidianFlavoredMarkdown]] (order `30` and `40` in the default config). If you set `order` on either plugin, keep this one first.
|
||||
|
||||
## Heading ids
|
||||
|
||||
Heading ids are made from the heading as written, with the same slug function that links and the [[table of contents]] use, and match GitHub's:
|
||||
|
||||
- With SmartyPants on, a heading containing `--` keeps it in its id: `## Range 1--2` → `range-1--2` (before 5.1: `range-12`). Links that hard-code the old id need updating; `[[page#Range 1--2]]` keeps working.
|
||||
- Obsidian writes links to headings containing `:`, `|`, `^`, `#` or `\` with spaces instead (`[[note#Colon unspaced]]` for `## Colon:unspaced`). Such headings get an extra anchor (an empty `<span class="heading-alias">` with that id), so these links and section embeds reach them.
|
||||
- A same-page link written as a heading's text, such as `[x](<#My Heading>)`, points at the heading's id.
|
||||
|
||||
## API
|
||||
|
||||
- Category: Transformer
|
||||
- Function name: `ExternalPlugin.GitHubFlavoredMarkdown()`.
|
||||
- Source: [`quartz-community/github-flavored-markdown`](https://github.com/quartz-community/github-flavored-markdown)
|
||||
- Install: `npx quartz plugin add github:quartz-community/github-flavored-markdown`
|
||||
- Install: `npx quartz plugin add @quartz-community/github-flavored-markdown` (included in the default configuration)
|
||||
@@ -27,22 +27,22 @@ Both `localGraph` and `globalGraph` accept the following options:
|
||||
|
||||
- `drag`: Enable dragging nodes. Defaults to `true`.
|
||||
- `zoom`: Enable zooming. Defaults to `true`.
|
||||
- `depth`: The depth of the graph. Defaults to `1` for local and `-1` for global.
|
||||
- `depth`: The depth of the graph. Defaults to `1` for local and `-1` (all pages) for global.
|
||||
- `scale`: The initial scale of the graph. Defaults to `1.1` for local and `0.9` for global.
|
||||
- `repelForce`: The force that pushes nodes apart. Defaults to `0.5`.
|
||||
- `centerForce`: The force that pulls nodes to the center. Defaults to `0.3` for local and `0.2` for global.
|
||||
- `linkDistance`: The distance between linked nodes. Defaults to `30`.
|
||||
- `fontSize`: The font size of node labels. Defaults to `0.6`.
|
||||
- `opacityScale`: The scale of node opacity. Defaults to `1`.
|
||||
- `removeTags`: Tags to exclude from the graph. Defaults to `[]`.
|
||||
- `showTags`: Whether to show tags in the graph. Defaults to `true`.
|
||||
- `removeTags`: Tag nodes to leave out of the graph. Defaults to `[]`.
|
||||
- `showTags`: Whether to show tags as nodes in the graph. Defaults to `true`.
|
||||
- `enableRadial`: Whether to enable radial layout. Defaults to `false` for local and `true` for global.
|
||||
- `focusOnHover`: Whether to focus on the hovered node. Defaults to `false` for local and `true` for global.
|
||||
|
||||
### Default options
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: github:quartz-community/graph
|
||||
- source: "@quartz-community/graph"
|
||||
enabled: true
|
||||
options:
|
||||
localGraph:
|
||||
@@ -65,7 +65,7 @@ Both `localGraph` and `globalGraph` accept the following options:
|
||||
depth: -1
|
||||
scale: 0.9
|
||||
repelForce: 0.5
|
||||
centerForce: 0.3
|
||||
centerForce: 0.2
|
||||
linkDistance: 30
|
||||
fontSize: 0.6
|
||||
opacityScale: 1
|
||||
@@ -73,6 +73,9 @@ Both `localGraph` and `globalGraph` accept the following options:
|
||||
showTags: true
|
||||
focusOnHover: true
|
||||
enableRadial: true
|
||||
layout:
|
||||
position: right
|
||||
priority: 10
|
||||
```
|
||||
|
||||
## API
|
||||
@@ -80,4 +83,4 @@ Both `localGraph` and `globalGraph` accept the following options:
|
||||
- Category: Component
|
||||
- Function name: `ExternalPlugin.Graph()`.
|
||||
- Source: [`quartz-community/graph`](https://github.com/quartz-community/graph)
|
||||
- Install: `npx quartz plugin add github:quartz-community/graph`
|
||||
- Install: `npx quartz plugin add @quartz-community/graph` (included in the default configuration)
|
||||
@@ -24,4 +24,4 @@ This plugin has no configuration options.
|
||||
- Category: Transformer
|
||||
- Function name: `ExternalPlugin.HardLineBreaks()`.
|
||||
- Source: [`quartz-community/hard-line-breaks`](https://github.com/quartz-community/hard-line-breaks)
|
||||
- Install: `npx quartz plugin add github:quartz-community/hard-line-breaks`
|
||||
- Install: `npx quartz plugin add @quartz-community/hard-line-breaks`
|
||||
+16
-4
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Latex
|
||||
description: Renders LaTeX math expressions via KaTeX or Typst.
|
||||
description: Renders LaTeX math expressions via KaTeX, MathJax or Typst.
|
||||
tags:
|
||||
- plugin/transformer
|
||||
image:
|
||||
@@ -16,15 +16,27 @@ This plugin adds LaTeX support to Quartz. See [[features/Latex|Latex]] for more
|
||||
|
||||
This plugin accepts the following configuration options:
|
||||
|
||||
- `renderEngine`: the engine to use to render LaTeX equations. Can be `"katex"` for [KaTeX](https://katex.org/), `"mathjax"` for [MathJax](https://www.mathjax.org/) [SVG rendering](https://docs.mathjax.org/en/latest/output/svg.html), or `"typst"` for [Typst](https://typst.app/) (a new way to compose LaTeX equation). Defaults to KaTeX.
|
||||
- `customMacros`: custom macros for all LaTeX blocks. It takes the form of a key-value pair where the key is a new command name and the value is the expansion of the macro. For example: `{"\\R": "\\mathbb{R}"}`
|
||||
- `renderEngine`: the engine to use to render LaTeX equations. Can be `"katex"` for [KaTeX](https://katex.org/), `"mathjax"` for [MathJax](https://www.mathjax.org/) [SVG rendering](https://docs.mathjax.org/en/latest/output/svg.html), or `"typst"` for [Typst](https://typst.app/) (a new way to compose LaTeX equation). Defaults to `"katex"`.
|
||||
- `customMacros`: custom macros for all LaTeX blocks. It takes the form of a key-value pair where the key is a new command name and the value is the expansion of the macro. For example: `{"\\R": "\\mathbb{R}"}`. Used by KaTeX and MathJax; Typst ignores it.
|
||||
- `katexOptions`: Additional options passed to the KaTeX renderer. See the [KaTeX docs](https://katex.org/docs/options) for available options.
|
||||
- `mathJaxOptions`: Additional options passed to the MathJax renderer. See the [MathJax docs](https://docs.mathjax.org/en/latest/options/) for available options.
|
||||
- `typstOptions`: Additional options passed to the Typst renderer.
|
||||
|
||||
With KaTeX, the KaTeX stylesheet and its copy-tex script are loaded from jsDelivr.
|
||||
|
||||
### Default options
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: "@quartz-community/latex"
|
||||
enabled: true
|
||||
options:
|
||||
renderEngine: katex
|
||||
order: 80
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
- Category: Transformer
|
||||
- Function name: `ExternalPlugin.Latex()`.
|
||||
- Source: [`quartz-community/latex`](https://github.com/quartz-community/latex)
|
||||
- Install: `npx quartz plugin add github:quartz-community/latex`
|
||||
- Install: `npx quartz plugin add @quartz-community/latex` (included in the default configuration)
|
||||
@@ -15,5 +15,5 @@ This plugin has no configuration options.
|
||||
## API
|
||||
|
||||
- Category: Page Type
|
||||
- Function name: `Plugin.NotFoundPage()` (internal plugin).
|
||||
- Internal plugin: always runs and has no entry in `quartz.config.yaml`. Its layout can be changed under `layout.byPageType.404` (see [[layout#Per-page-type overrides]]).
|
||||
- Source: [`quartz/plugins/pageTypes/404.ts`](https://github.com/jackyzha0/quartz/blob/v5/quartz/plugins/pageTypes/404.ts)
|
||||
@@ -2,6 +2,7 @@
|
||||
title: NoteProperties
|
||||
description: Displays frontmatter properties in a collapsible panel.
|
||||
tags:
|
||||
- plugin/transformer
|
||||
- plugin/component
|
||||
image:
|
||||
new-in-v5: true
|
||||
@@ -10,14 +11,14 @@ enabled: true
|
||||
required: false
|
||||
---
|
||||
|
||||
The NoteProperties plugin is documented under [[Frontmatter]].
|
||||
The NoteProperties plugin renders a note's frontmatter properties in a collapsible panel before the page body. Its options and the per-note overrides are documented under [[Frontmatter#Properties panel plugin (note-properties)|Frontmatter]].
|
||||
|
||||
> [!note]
|
||||
> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page.
|
||||
|
||||
## API
|
||||
|
||||
- Category: Component
|
||||
- Category: Transformer, Component
|
||||
- Function name: `ExternalPlugin.NoteProperties()`.
|
||||
- Source: [`quartz-community/note-properties`](https://github.com/quartz-community/note-properties)
|
||||
- Install: `npx quartz plugin add github:quartz-community/note-properties`
|
||||
- Install: `npx quartz plugin add @quartz-community/note-properties` (included in the default configuration)
|
||||
@@ -21,8 +21,8 @@ This plugin accepts the following configuration options:
|
||||
- `"strict"` parses CommonMark and GFM as specified, plus Obsidian's syntax, and keeps other plugins' syntax extensions working. Use it for TOML (`+++`) or custom frontmatter delimiters, or plugins that add Markdown syntax.
|
||||
- `strictLineBreaks`: Obsidian's "Strict line breaks" setting. `false` (the default under `preset: "legacy"`) renders a single line break inside a paragraph as a `<br>`, as in Obsidian's default reading view. `true` (the default under `preset: "strict"`) renders it as a space, as CommonMark does. This replaces the deprecated [[HardLineBreaks]] plugin.
|
||||
- `comments`: If `true` (default), enables parsing of `%%` style Obsidian comment blocks.
|
||||
- `highlight`: If `true` (default), enables parsing of `==` style highlights within content.
|
||||
- `wikilinks`:If `true` (default), turns [[wikilinks]] into regular links.
|
||||
- `highlight`: If `true` (default), enables parsing of `==` style highlights within content. A highlight that starts with a colour emoji (🔴 🟠 🟡 🟢 🔵 🟣, or the matching squares) is coloured as in Obsidian 1.14, e.g. `==🔴 urgent==`.
|
||||
- `wikilinks`: If `true` (default), turns [[wikilinks]] into regular links.
|
||||
- `callouts`: If `true` (default), adds support for [[callouts|callout]] blocks for emphasizing content.
|
||||
- `mermaid`: If `true` (default), enables [[Mermaid diagrams|Mermaid diagram]] parsing within Markdown files.
|
||||
- `diagramRenderer`: `"mermaid"` (default) or `"pele"`. Which engine draws Mermaid fences. [Pele](https://pele.run) is opt-in; Mermaid.js is deprecated.
|
||||
@@ -32,13 +32,32 @@ This plugin accepts the following configuration options:
|
||||
- `enableYouTubeEmbed`: If `true` (default), enables the embedding of YouTube videos and playlists using external image Markdown syntax.
|
||||
- `enableTweetEmbed`: If `true` (default), enables the embedding of tweets as static blockquotes from Twitter/X URLs.
|
||||
- `enableVideoEmbed`: If `true` (default), enables the embedding of video files.
|
||||
- `enableCheckbox`: If `true`, adds support for interactive checkboxes in content, including custom task characters (e.g. `- [?]`, `- [!]`, `- [/]`). Defaults to `false`.
|
||||
- `enableCheckbox`: If `true`, adds support for interactive checkboxes in content, including custom task characters (e.g. `- [?]`, `- [!]`, `- [/]`). Defaults to `false`; the default `quartz.config.yaml` turns it on.
|
||||
- `enableObsidianUri`: If `true` (default), marks `obsidian://` protocol links with a CSS class and data attribute for custom styling.
|
||||
|
||||
Inline footnotes (`text^[note]`) are numbered together with regular footnotes.
|
||||
Also supported:
|
||||
|
||||
- Inline footnotes (`text^[note]`) are numbered together with regular footnotes.
|
||||
- Obsidian's image size suffix on Markdown images: `` and `` set the width (and height).
|
||||
- An image embed without alt text (`![[pic.png]]`, `![[pic.png|100]]`) gets the path as alt text, as in Obsidian, which also names a missing image.
|
||||
- A block reference inside a wikilink (`[[note#^id]]`) only links to that block; at the end of a paragraph it no longer gives the paragraph that block id.
|
||||
- Inline tags only link to tag pages that exist.
|
||||
|
||||
This plugin must run after [[GitHubFlavoredMarkdown]] (order `40` and `30` in the default config): where both claim the same character (`~~` strikethrough, for example), the plugin registered later wins.
|
||||
|
||||
### Default options
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: "@quartz-community/obsidian-flavored-markdown"
|
||||
enabled: true
|
||||
options:
|
||||
enableInHtmlEmbed: false
|
||||
enableCheckbox: true
|
||||
order: 40
|
||||
```
|
||||
|
||||
> [!note]
|
||||
> The `disableBrokenWikilinks` option previously lived on this plugin. It has moved to the built-in [[CrawlLinks|link processing]] (`configuration.links.disableBrokenWikilinks`), which owns link resolution and can honor the configured `markdownLinkResolution` strategy when deciding whether a link is broken. Users upgrading from earlier Quartz v5 betas should move the option from `ObsidianFlavoredMarkdown` to `CrawlLinks`.
|
||||
> The `disableBrokenWikilinks` option previously lived on this plugin. It has moved to the built-in [[CrawlLinks|link processing]] as `configuration.links.disableBrokenWikilinks`, which owns link resolution and honors the configured `markdownLinkResolution` strategy when deciding whether a link is broken. If you upgrade from an earlier Quartz v5 beta, move the option from this plugin's `options` to `configuration.links`.
|
||||
|
||||
> [!warning]
|
||||
> Don't remove this plugin if you're using [[Obsidian compatibility|Obsidian]] to author the content!
|
||||
@@ -48,4 +67,4 @@ Inline footnotes (`text^[note]`) are numbered together with regular footnotes.
|
||||
- Category: Transformer
|
||||
- Function name: `ExternalPlugin.ObsidianFlavoredMarkdown()`.
|
||||
- Source: [`quartz-community/obsidian-flavored-markdown`](https://github.com/quartz-community/obsidian-flavored-markdown)
|
||||
- Install: `npx quartz plugin add github:quartz-community/obsidian-flavored-markdown`
|
||||
- Install: `npx quartz plugin add @quartz-community/obsidian-flavored-markdown` (included in the default configuration)
|
||||
@@ -0,0 +1,63 @@
|
||||
---
|
||||
title: ObsidianPluginExcalidraw
|
||||
description: Renders Obsidian Excalidraw drawings as interactive pages.
|
||||
tags:
|
||||
- plugin/pageType
|
||||
- plugin/filter
|
||||
- plugin/component
|
||||
image:
|
||||
new-in-v5: true
|
||||
repository: "[quartz-community/obsidian-plugin-excalidraw](https://github.com/quartz-community/obsidian-plugin-excalidraw)"
|
||||
enabled: false
|
||||
required: false
|
||||
---
|
||||
|
||||
This plugin is a page type plugin that renders drawings made with the [Obsidian Excalidraw plugin](https://github.com/zsviczian/obsidian-excalidraw-plugin) (`.excalidraw.md` and `.excalidraw` files) as full-page SVG drawings you can pan and zoom. Like [[CanvasPage]], it uses a page frame of its own (`"excalidraw"`): the drawing fills the page, with a togglable left sidebar.
|
||||
|
||||
> [!note]
|
||||
> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page.
|
||||
|
||||
A drawing gets a page at its file's path (`Drawings/Plan.excalidraw.md` → `/Drawings/Plan.excalidraw`), titled after the file and tagged `excalidraw`. A drawing stored as Markdown is taken out of the regular notes (so it isn't also rendered as text), but keeps its frontmatter: `publish`, `draft`, `password` and other filters apply to it as to a note. [[Bases]] list drawings with their real paths.
|
||||
|
||||
Supported:
|
||||
|
||||
- Shapes, text, arrows, lines and freedraw strokes in Excalidraw's hand-drawn style
|
||||
- Images, either stored in the drawing or embedded from the vault (matched by file name)
|
||||
- Embedded notes (`[[note]]`), rendered with their content, and embedded web pages (as sandboxed iframes)
|
||||
- Light and dark mode, using Excalidraw's own dark-mode colours
|
||||
- Both `json` and `compressed-json` drawing data
|
||||
|
||||
## Configuration
|
||||
|
||||
This plugin accepts the following configuration options:
|
||||
|
||||
- `enableInteraction`: Whether to enable pan and zoom (drag, scroll wheel, and zoom buttons). Defaults to `true`.
|
||||
- `darkMode`: `"auto"` (follows the site's light/dark mode), `"light"` or `"dark"`. Defaults to `"auto"`.
|
||||
- `exportPadding`: Padding around the drawing, in pixels. Defaults to `20`.
|
||||
|
||||
### Default options
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: "@quartz-community/obsidian-plugin-excalidraw"
|
||||
enabled: true
|
||||
options:
|
||||
enableInteraction: true
|
||||
darkMode: auto
|
||||
exportPadding: 20
|
||||
```
|
||||
|
||||
To use the standard three-column layout instead of the full-page frame:
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
layout:
|
||||
byPageType:
|
||||
excalidraw:
|
||||
template: default
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
- Category: Page Type, Filter, Component
|
||||
- Function name: `ExternalPlugin.ExcalidrawPage()`.
|
||||
- Source: [`quartz-community/obsidian-plugin-excalidraw`](https://github.com/quartz-community/obsidian-plugin-excalidraw)
|
||||
- Install: `npx quartz plugin add @quartz-community/obsidian-plugin-excalidraw`
|
||||
@@ -0,0 +1,81 @@
|
||||
---
|
||||
title: ObsidianPluginTtrpgToolsMaps
|
||||
description: Renders maps made with the Obsidian plugin TTRPG Tools - Maps (zoom-map) as interactive, read-only maps.
|
||||
tags:
|
||||
- plugin/transformer
|
||||
- plugin/emitter
|
||||
- plugin/component
|
||||
image:
|
||||
new-in-v5: true
|
||||
repository: "[quartz-community/obsidian-plugin-ttrpg-tools-maps](https://github.com/quartz-community/obsidian-plugin-ttrpg-tools-maps)"
|
||||
enabled: false
|
||||
required: false
|
||||
---
|
||||
|
||||
This plugin renders maps made with the Obsidian plugin [TTRPG Tools: Maps (zoom-map)](https://github.com/Jareika/zoom-map) by Jareika as interactive, read-only maps, from the same `zoommap` code blocks and marker files, without any migration. It does not edit maps: author them in Obsidian with the original plugin.
|
||||
|
||||
> [!note]
|
||||
> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page.
|
||||
|
||||
## Usage
|
||||
|
||||
Embed a map in a note with a `zoommap` code block, as in Obsidian:
|
||||
|
||||
````markdown
|
||||
```zoommap
|
||||
imageBases:
|
||||
- path: assets/world-map.webp
|
||||
name: Forbidden Lands
|
||||
markers: assets/world-map.webp.markers.json
|
||||
minZoom: 0.3
|
||||
maxZoom: 20
|
||||
height: 480px
|
||||
width: 100%
|
||||
```
|
||||
````
|
||||
|
||||
Marker data can also be stored in the note itself (`storage: note`), in a `%%`-comment block:
|
||||
|
||||
````markdown
|
||||
```zoommap
|
||||
image: assets/world-map.webp
|
||||
storage: note
|
||||
id: map-1
|
||||
```
|
||||
|
||||
%%
|
||||
ZOOMMAP-DATA id=map-1
|
||||
{ "layers": [...], "markers": [...] }
|
||||
/ZOOMMAP-DATA
|
||||
%%
|
||||
````
|
||||
|
||||
The map images are copied to the site.
|
||||
|
||||
Supported: one or more base images (with a switcher), pan and zoom (mouse wheel, drag, double-click, pinch), markers with tooltips and links, layer toggles, per-marker zoom ranges, image overlays, square and hex grids, drawings and text layers. Not supported: editing, the ruler and travel-time tools, viewport frames and the canvas render mode.
|
||||
|
||||
## Configuration
|
||||
|
||||
This plugin accepts the following configuration options:
|
||||
|
||||
- `blockLanguage`: The code block language that holds a map. Defaults to `"zoommap"`.
|
||||
- `inlineBlockHeaderId`: The header of inline marker data blocks (`storage: note`). Defaults to `"ZOOMMAP-DATA"`.
|
||||
- `defaultIconKey`: Accepted, but currently not used: a marker without an icon is always drawn as a red pin. Defaults to `"pin-red"`.
|
||||
- `maxInlineDataBytes`: Reserved; marker data is always inlined into the page. Defaults to `0`.
|
||||
|
||||
### Default options
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: "@quartz-community/obsidian-plugin-ttrpg-tools-maps"
|
||||
enabled: true
|
||||
options:
|
||||
blockLanguage: zoommap
|
||||
inlineBlockHeaderId: ZOOMMAP-DATA
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
- Category: Transformer, Emitter, Component
|
||||
- Function names: `ExternalPlugin.TTRPGMapTransformer()` (transformer), `ExternalPlugin.TTRPGMapEmitter()` (emitter, copies the map images).
|
||||
- Source: [`quartz-community/obsidian-plugin-ttrpg-tools-maps`](https://github.com/quartz-community/obsidian-plugin-ttrpg-tools-maps)
|
||||
- Install: `npx quartz plugin add @quartz-community/obsidian-plugin-ttrpg-tools-maps`
|
||||
@@ -16,8 +16,8 @@ This plugin provides support for [ox-hugo](https://github.com/kaushalmodi/ox-hug
|
||||
|
||||
This plugin accepts the following configuration options:
|
||||
|
||||
- `wikilinks`: If `true` (default), converts Hugo `{{ relref }}` shortcodes to Quartz [[wikilinks]].
|
||||
- `removePredefinedAnchor`: If `true` (default), strips predefined anchors from headings.
|
||||
- `wikilinks`: If `true` (default), converts Hugo `{{< relref >}}` links (`[text]({{< relref "page" >}})`) to regular Markdown links (`[text](page)`).
|
||||
- `removePredefinedAnchor`: If `true` (default), strips predefined anchors (`{#id}`) from headings.
|
||||
- `removeHugoShortcode`: If `true` (default), removes Hugo shortcode syntax (`{{}}`) from the content.
|
||||
- `replaceFigureWithMdImg`: If `true` (default), replaces `<figure/>` with `![]()`.
|
||||
- `replaceOrgLatex`: If `true` (default), converts Org-mode [[features/Latex|Latex]] fragments to Quartz-compatible LaTeX wrapped in `$` (for inline) and `$$` (for block equations).
|
||||
@@ -27,9 +27,25 @@ This plugin accepts the following configuration options:
|
||||
>
|
||||
> If you use `toml` frontmatter, make sure to set `configuration.frontmatter` accordingly (see [[Frontmatter]]). See [[OxHugo compatibility]] for an example.
|
||||
|
||||
### Default options
|
||||
|
||||
The default config has a disabled entry for this plugin. Set `enabled: true` to use it:
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: "@quartz-community/ox-hugo"
|
||||
enabled: true
|
||||
options:
|
||||
wikilinks: true
|
||||
removePredefinedAnchor: true
|
||||
removeHugoShortcode: true
|
||||
replaceFigureWithMdImg: true
|
||||
replaceOrgLatex: true
|
||||
order: 91
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
- Category: Transformer
|
||||
- Function name: `ExternalPlugin.OxHugoFlavoredMarkdown()`.
|
||||
- Function name: `ExternalPlugin.OxHugoFlavouredMarkdown()` (British spelling).
|
||||
- Source: [`quartz-community/ox-hugo`](https://github.com/quartz-community/ox-hugo)
|
||||
- Install: `npx quartz plugin add github:quartz-community/ox-hugo`
|
||||
- Install: `npx quartz plugin add @quartz-community/ox-hugo`
|
||||
@@ -21,4 +21,4 @@ This plugin has no configuration options. The displayed title is controlled by t
|
||||
- Category: Component
|
||||
- Function name: `ExternalPlugin.PageTitle()`.
|
||||
- Source: [`quartz-community/page-title`](https://github.com/quartz-community/page-title)
|
||||
- Install: `npx quartz plugin add github:quartz-community/page-title`
|
||||
- Install: `npx quartz plugin add @quartz-community/page-title` (included in the default configuration)
|
||||
@@ -19,15 +19,19 @@ See [[reader mode]] for detailed usage information.
|
||||
|
||||
## Configuration
|
||||
|
||||
This plugin accepts the following configuration options:
|
||||
This plugin has no options. Use the entry's `enabled` field to turn it on or off, and `layout` to place the toggle button.
|
||||
|
||||
- `enabled`: Whether to enable reader mode. Defaults to `true`.
|
||||
On [[layout#Per-page-type overrides|folder and tag pages]] the default config leaves the button out (`layout.byPageType.folder.exclude: [reader-mode]`).
|
||||
|
||||
### Default options
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: github:quartz-community/reader-mode
|
||||
- source: "@quartz-community/reader-mode"
|
||||
enabled: true
|
||||
layout:
|
||||
position: left
|
||||
priority: 35
|
||||
group: toolbar
|
||||
```
|
||||
|
||||
## API
|
||||
@@ -35,4 +39,4 @@ This plugin accepts the following configuration options:
|
||||
- Category: Component
|
||||
- Function name: `ExternalPlugin.ReaderMode()`.
|
||||
- Source: [`quartz-community/reader-mode`](https://github.com/quartz-community/reader-mode)
|
||||
- Install: `npx quartz plugin add github:quartz-community/reader-mode`
|
||||
- Install: `npx quartz plugin add @quartz-community/reader-mode` (included in the default configuration)
|
||||
@@ -9,7 +9,7 @@ enabled: false
|
||||
required: false
|
||||
---
|
||||
|
||||
Shows recently modified notes.
|
||||
Shows the most recent notes, newest first, by each page's default date (`defaultDateType` of [[CreatedModifiedDate]]: `modified` in the default config).
|
||||
|
||||
> [!note]
|
||||
> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page.
|
||||
@@ -20,23 +20,47 @@ See [[recent notes]] for detailed usage information.
|
||||
|
||||
This plugin accepts the following configuration options:
|
||||
|
||||
- `title`: The title of the recent notes section. Defaults to `Recent notes`.
|
||||
- `title`: The title of the recent notes section. Defaults to the localized "Recent Notes" (see [[i18n]]).
|
||||
- `limit`: The maximum number of recent notes to display. Defaults to `3`.
|
||||
- `showTags`: Whether to display the tags for each note. Defaults to `true`.
|
||||
- `linkToMore`: A slug to a page that shows more notes. Defaults to `false`.
|
||||
- `hideTagPages`: Whether to hide tag index pages from the list. Defaults to `false`.
|
||||
- `hideFolderPages`: Whether to hide folder index pages from the list. Defaults to `false`.
|
||||
- `linkToMore`: The slug of a page that lists more notes (e.g. `tags/` or a folder). When set and there are more notes than `limit`, a "See N more →" link is shown. Defaults to `false` (no link).
|
||||
- `hideTagPages`: Whether to hide tag pages from the list. Defaults to `false`.
|
||||
- `hideFolderPages`: Whether to hide folder pages from the list. Defaults to `false`.
|
||||
|
||||
Pages hidden with [[UnlistedPages]] are always left out.
|
||||
|
||||
**TS override options** (in `quartz.ts`, for callback functions that can't be expressed in YAML):
|
||||
|
||||
- `filter`: `(f: QuartzPluginData) => boolean{:ts}`, which pages to include. Defaults to all.
|
||||
- `sort`: `(f1: QuartzPluginData, f2: QuartzPluginData) => number{:ts}`. Defaults to newest first, tie-breaking on title.
|
||||
|
||||
### Default options
|
||||
|
||||
The default config has a disabled entry without a `layout`; the component then goes after the page body (`afterBody`, priority `50`). To enable it:
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: github:quartz-community/recent-notes
|
||||
- source: "@quartz-community/recent-notes"
|
||||
enabled: true
|
||||
options:
|
||||
limit: 3
|
||||
showTags: true
|
||||
linkToMore: false
|
||||
hideTagPages: false
|
||||
hideFolderPages: false
|
||||
layout:
|
||||
position: afterBody
|
||||
priority: 50
|
||||
```
|
||||
|
||||
### TS override example
|
||||
|
||||
```ts title="quartz.ts"
|
||||
import * as ExternalPlugin from "./.quartz/plugins"
|
||||
|
||||
// Must be placed before loadQuartzConfig()
|
||||
ExternalPlugin.RecentNotes({
|
||||
filter: (f) => f.slug?.startsWith("blog/") ?? false,
|
||||
})
|
||||
```
|
||||
|
||||
## API
|
||||
@@ -44,4 +68,4 @@ This plugin accepts the following configuration options:
|
||||
- Category: Component
|
||||
- Function name: `ExternalPlugin.RecentNotes()`.
|
||||
- Source: [`quartz-community/recent-notes`](https://github.com/quartz-community/recent-notes)
|
||||
- Install: `npx quartz plugin add github:quartz-community/recent-notes`
|
||||
- Install: `npx quartz plugin add @quartz-community/recent-notes`
|
||||
@@ -16,19 +16,30 @@ This plugin provides support for [Roam Research](https://roamresearch.com) compa
|
||||
|
||||
This plugin accepts the following configuration options:
|
||||
|
||||
- `orComponent`: If `true` (default), converts Roam `{{ or:ONE|TWO|THREE }}` shortcodes into HTML Dropdown options.
|
||||
- `orComponent`: If `true` (default), converts Roam `{{or:ONE|TWO|THREE}}` shortcodes into HTML dropdowns.
|
||||
- `TODOComponent`: If `true` (default), converts Roam `{{[[TODO]]}}` shortcodes into HTML check boxes.
|
||||
- `DONEComponent`: If `true` (default), converts Roam `{{[[DONE]]}}` shortcodes into checked HTML check boxes.
|
||||
- `videoComponent`: If `true` (default), converts Roam `{{[[video]]:URL}}` shortcodes into embedded HTML video.
|
||||
- `videoComponent`: If `true` (default), converts Roam `{{[[video]]:URL}}` shortcodes into embedded video (YouTube links become a YouTube embed).
|
||||
- `audioComponent`: If `true` (default), converts Roam `{{[[audio]]:URL}}` shortcodes into embedded HTML audio.
|
||||
- `pdfComponent`: If `true` (default), converts Roam `{{[[pdf]]:URL}}` shortcodes into embedded HTML PDF viewer.
|
||||
- `blockquoteComponent`: If `true` (default), converts Roam `{{[[>]]}}` shortcodes into Quartz blockquotes.
|
||||
- `tableComponent`: If `true` (default), converts Roam table syntax into HTML tables.
|
||||
- `attributeComponent`: If `true` (default), converts Roam attribute syntax into rendered attributes.
|
||||
- `pdfComponent`: If `true` (default), converts Roam `{{[[pdf]]:URL}}` shortcodes into an embedded PDF viewer.
|
||||
- `blockquoteComponent`: If `true` (default), converts Roam `[[>]] text` blockquotes into HTML blockquotes.
|
||||
- `tableComponent`, `attributeComponent`: accepted, but currently not used by the plugin.
|
||||
|
||||
Roam's `^^highlight^^` and `__italic__` syntax is always converted (to a highlight and to emphasis).
|
||||
|
||||
### Default options
|
||||
|
||||
The default config has a disabled entry for this plugin. Set `enabled: true` to use it:
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: "@quartz-community/roam"
|
||||
enabled: true
|
||||
order: 92
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
- Category: Transformer
|
||||
- Function name: `ExternalPlugin.RoamFlavoredMarkdown()`.
|
||||
- Source: [`quartz-community/roam`](https://github.com/quartz-community/roam)
|
||||
- Install: `npx quartz plugin add github:quartz-community/roam`
|
||||
- Install: `npx quartz plugin add @quartz-community/roam`
|
||||
@@ -26,7 +26,7 @@ This plugin accepts the following configuration options:
|
||||
### Default options
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: github:quartz-community/search
|
||||
- source: "@quartz-community/search"
|
||||
enabled: true
|
||||
options:
|
||||
enablePreview: true
|
||||
@@ -41,4 +41,4 @@ This plugin accepts the following configuration options:
|
||||
- Category: Component
|
||||
- Function name: `ExternalPlugin.Search()`.
|
||||
- Source: [`quartz-community/search`](https://github.com/quartz-community/search)
|
||||
- Install: `npx quartz plugin add github:quartz-community/search`
|
||||
- Install: `npx quartz plugin add @quartz-community/search` (included in the default configuration)
|
||||
@@ -22,4 +22,4 @@ This plugin has no configuration options.
|
||||
- Category: Component
|
||||
- Function name: `ExternalPlugin.Spacer()`.
|
||||
- Source: [`quartz-community/spacer`](https://github.com/quartz-community/spacer)
|
||||
- Install: `npx quartz plugin add github:quartz-community/spacer`
|
||||
- Install: `npx quartz plugin add @quartz-community/spacer` (included in the default configuration)
|
||||
@@ -1,56 +1,58 @@
|
||||
---
|
||||
title: StackedPages
|
||||
description: Andy Matuschak-style stacked sliding panes.
|
||||
description: Binder-style tabs of the pages you visited, beside the page.
|
||||
tags:
|
||||
- plugin/component
|
||||
image:
|
||||
new-in-v5: true
|
||||
repository: "[quartz-community/stacked-pages](https://github.com/quartz-community/stacked-pages)"
|
||||
enabled: true
|
||||
enabled: false
|
||||
required: false
|
||||
---
|
||||
|
||||
Andy Matuschak-style stacked pages (sliding panes). Clicking internal links opens pages side by side in a horizontal stack, allowing you to trace your path through your notes. Each pane shows a full page and can be individually scrolled or closed.
|
||||
Binder-style stacked pages: every page you open is added as a tab, and the tabs are shown as strips beside the page content, like the tabs of a ring binder. Pages you came from sit on the left of the current page, pages you went back from on the right, so you can retrace your path through your notes.
|
||||
|
||||
> [!note]
|
||||
> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page.
|
||||
|
||||
## Usage
|
||||
|
||||
Once enabled, clicking any internal link on a page opens the linked page as a new pane to the right instead of navigating away. The URL updates with a `#stacked=slug1,slug2` hash encoding your current stack, so you can share or bookmark a specific trail of pages.
|
||||
Once enabled, navigation works as usual: links are not intercepted, so heading anchors, [[popover previews]] and [[SPA Routing]] keep working. After each navigation the page is added as a tab right after the current one (or, if it already has a tab, that tab becomes current). The binder appears once there are at least two tabs.
|
||||
|
||||
Stacked pages are disabled on mobile by default (below 800px) since horizontal panning doesn't work well on small screens. On mobile, links navigate normally.
|
||||
The tabs are kept in the browser's `sessionStorage`: they survive reloads and navigation within the tab, but are not part of the URL and are not shared between browser tabs.
|
||||
|
||||
Below `mobileBreakpoint` (800px by default) the binder is hidden.
|
||||
|
||||
### Interactions
|
||||
|
||||
- **Click a link**: Opens the target page in a new pane to the right. If the maximum number of panes is reached, the leftmost pane is removed.
|
||||
- **Close a pane**: Click the × button in the pane header to remove it from the stack.
|
||||
- **Collapsed spines**: When panes overflow the viewport, earlier panes collapse to a thin vertical spine showing the page title. Click a spine to bring that pane back into focus.
|
||||
- **Browser back/forward**: The full stack state is stored in the URL hash and integrated with browser history, so back/forward navigation works as expected.
|
||||
- **Click a tab**: navigates to that page.
|
||||
- **Close a tab**: click its × button. Closing the current tab navigates to the nearest remaining one.
|
||||
- **Tab limit**: with more than `maxTabs` tabs, the oldest tab furthest from the current one is dropped.
|
||||
|
||||
## Configuration
|
||||
|
||||
This plugin accepts the following configuration options:
|
||||
|
||||
- `maxTabs`: Maximum number of stacked panes visible at once. Defaults to `8`.
|
||||
- `mobileBreakpoint`: Viewport width (in pixels) below which stacked pages are disabled and links navigate normally. Defaults to `800`.
|
||||
- `showSpines`: Whether to show collapsed spine headers when panes overflow the viewport. Defaults to `true`.
|
||||
- `animateTransitions`: Whether to animate pane open/close transitions. Defaults to `true`.
|
||||
- `maxTabs`: Maximum number of tabs kept. Defaults to `8`.
|
||||
- `mobileBreakpoint`: Viewport width (in pixels) below which the binder is hidden. Defaults to `800`.
|
||||
- `showSpines`: Whether to draw the coloured spine accent on each tab. Defaults to `true`.
|
||||
- `animateTransitions`: Accepted, but currently has no effect. Defaults to `true`.
|
||||
|
||||
### Default options
|
||||
|
||||
The default config has a disabled entry for this plugin. Set `enabled: true` to use it:
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: github:quartz-community/stacked-pages
|
||||
- source: "@quartz-community/stacked-pages"
|
||||
enabled: true
|
||||
layout:
|
||||
position: afterBody
|
||||
priority: 50
|
||||
display: all
|
||||
options:
|
||||
maxTabs: 8
|
||||
mobileBreakpoint: 800
|
||||
showSpines: true
|
||||
animateTransitions: true
|
||||
layout:
|
||||
position: afterBody
|
||||
priority: 50
|
||||
display: all
|
||||
```
|
||||
|
||||
## API
|
||||
@@ -58,4 +60,4 @@ This plugin accepts the following configuration options:
|
||||
- Category: Component
|
||||
- Function name: `ExternalPlugin.StackedPages()`.
|
||||
- Source: [`quartz-community/stacked-pages`](https://github.com/quartz-community/stacked-pages)
|
||||
- Install: `npx quartz plugin add github:quartz-community/stacked-pages`
|
||||
- Install: `npx quartz plugin add @quartz-community/stacked-pages`
|
||||
@@ -18,5 +18,5 @@ This plugin has no configuration options.
|
||||
## API
|
||||
|
||||
- Category: Emitter
|
||||
- Function name: `Plugin.Static()` (internal plugin).
|
||||
- Internal plugin: always runs and has no entry in `quartz.config.yaml`.
|
||||
- Source: [`quartz/plugins/emitters/static.ts`](https://github.com/jackyzha0/quartz/blob/v5/quartz/plugins/emitters/static.ts).
|
||||
@@ -16,16 +16,31 @@ This plugin is used to add syntax highlighting to code blocks in Quartz. See [[s
|
||||
|
||||
This plugin accepts the following configuration options:
|
||||
|
||||
- `theme`: a separate id of one of the [themes bundled with Shikiji](https://shikiji.netlify.app/themes). One for light mode and one for dark mode. Defaults to `theme: { light: "github-light", dark: "github-dark" }`.
|
||||
- `keepBackground`: If set to `true`, the background of the Shikiji theme will be used. With `false` (default) the Quartz theme color for background will be used instead.
|
||||
- `theme`: a separate id of one of the [themes bundled with Shiki](https://shiki.style/themes). One for light mode and one for dark mode. Defaults to `theme: { light: "github-light", dark: "github-dark" }`.
|
||||
- `keepBackground`: If set to `true`, the background of the Shiki theme will be used. With `false` (default) the Quartz theme color for background will be used instead.
|
||||
- `clipboard`: Whether to add a copy-to-clipboard button to code blocks. Defaults to `true`.
|
||||
- `tokenClassification`: Whether to add semantic token classification CSS classes to code tokens. Defaults to `true`.
|
||||
- `tokenClassification`: Whether to add a `data-token-type` attribute to each highlighted token (`keyword`, `string`, `comment`, `function`, `property`, …), so themes and custom CSS can restyle tokens by kind, e.g. `span[data-token-type="keyword"]`. The theme's own colours are kept. Defaults to `true`.
|
||||
|
||||
Highlighting is done with [rehype-pretty-code](https://rehype-pretty.pages.dev/), so its other options (such as `defaultLang`) can be passed too.
|
||||
|
||||
In addition, you can further override the colours in the `quartz/styles/syntax.scss` file.
|
||||
|
||||
### Default options
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: "@quartz-community/syntax-highlighting"
|
||||
enabled: true
|
||||
options:
|
||||
theme:
|
||||
light: github-light
|
||||
dark: github-dark
|
||||
keepBackground: false
|
||||
order: 20
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
- Category: Transformer
|
||||
- Function name: `ExternalPlugin.SyntaxHighlighting()`.
|
||||
- Source: [`quartz-community/syntax-highlighting`](https://github.com/quartz-community/syntax-highlighting)
|
||||
- Install: `npx quartz plugin add github:quartz-community/syntax-highlighting`
|
||||
- Install: `npx quartz plugin add @quartz-community/syntax-highlighting` (included in the default configuration)
|
||||
@@ -18,17 +18,35 @@ This plugin generates a table of contents (TOC) for Markdown documents. See [[ta
|
||||
This plugin accepts the following configuration options:
|
||||
|
||||
- `maxDepth`: Limits the depth of headings included in the TOC, ranging from `1` (top level headings only) to `6` (all heading levels). Default is `3`.
|
||||
- `minEntries`: The minimum number of heading entries required for the TOC to be displayed. Default is `1`.
|
||||
- `showByDefault`: If `true` (default), the TOC should be displayed by default. Can be overridden by frontmatter settings.
|
||||
- `minEntries`: The TOC is only shown when it has more than this many entries. Default is `1` (a page needs at least two headings).
|
||||
- `showByDefault`: If `true` (default), the TOC should be displayed by default. Can be overridden per page with the `enableToc` frontmatter key.
|
||||
- `collapseByDefault`: If `true`, the TOC will start in a collapsed state. Default is `false`.
|
||||
- `layout`: The visual layout of the TOC component. Can be `"modern"` or `"legacy"`. Default is `"modern"`.
|
||||
|
||||
> [!warning]
|
||||
> This plugin needs the `Plugin.TableOfContents` component in `quartz.config.yaml` to determine where to display the TOC. Without it, nothing will be displayed. They should always be added or removed together.
|
||||
As in Obsidian's outline, headings inside blockquotes and callouts are left out. Entries link to the heading ids that [[GitHubFlavoredMarkdown]] gives the headings (read from the rendered headings, with the same slug function as a fallback), so they always match, including for repeated headings (`-1`, `-2`).
|
||||
|
||||
One plugin entry provides both the transformer that collects the headings and the component that displays them; its `layout` places the component:
|
||||
|
||||
### Default options
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: "@quartz-community/table-of-contents"
|
||||
enabled: true
|
||||
options:
|
||||
maxDepth: 3
|
||||
minEntries: 1
|
||||
showByDefault: true
|
||||
collapseByDefault: false
|
||||
layout: modern
|
||||
order: 50
|
||||
layout:
|
||||
position: right
|
||||
priority: 30
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
- Category: Transformer, Component
|
||||
- Function name: `ExternalPlugin.TableOfContentsTransformer()`.
|
||||
- Function names: `ExternalPlugin.TableOfContents()` (component), `ExternalPlugin.TableOfContentsTransformer()` (transformer).
|
||||
- Source: [`quartz-community/table-of-contents`](https://github.com/quartz-community/table-of-contents)
|
||||
- Install: `npx quartz plugin add github:quartz-community/table-of-contents`
|
||||
- Install: `npx quartz plugin add @quartz-community/table-of-contents` (included in the default configuration)
|
||||
@@ -21,4 +21,4 @@ This plugin has no configuration options.
|
||||
- Category: Component
|
||||
- Function name: `ExternalPlugin.TagList()`.
|
||||
- Source: [`quartz-community/tag-list`](https://github.com/quartz-community/tag-list)
|
||||
- Install: `npx quartz plugin add github:quartz-community/tag-list`
|
||||
- Install: `npx quartz plugin add @quartz-community/tag-list`
|
||||
+16
-4
@@ -16,13 +16,25 @@ This plugin is a page type plugin that emits dedicated pages for each tag used i
|
||||
|
||||
This plugin accepts the following configuration options:
|
||||
|
||||
- `numPages`: The maximum number of pages to display per tag before showing a "see more" link. Defaults to `10`.
|
||||
- `sort`: A function of type `(f1: QuartzPluginData, f2: QuartzPluginData) => number{:ts}` used to sort entries. Defaults to sorting by date and tie-breaking on lexographical order. Requires a TS override.
|
||||
- `prefixTags`: If `true`, generated tag page titles are prefixed with "Tag: " (e.g. "Tag: recipes"). Defaults to `false`.
|
||||
- `numPages`: On the tag index page (`/tags`), the maximum number of pages listed under each tag; the tag's own page lists all of them. Defaults to `10`.
|
||||
- `prefixTags`: If `true`, generated tag page titles are prefixed with the localized "Tag" label (e.g. "Tag: recipes"). Defaults to `false`.
|
||||
- `sort`: A function of type `(f1: QuartzPluginData, f2: QuartzPluginData) => number{:ts}` used to sort entries. Defaults to sorting by date (newest first) and tie-breaking on lexicographical title order. Requires a TS override.
|
||||
|
||||
A page with a nested tag such as `#project/alpha` is listed under both `project/alpha` and `project`. Writing a note at `tags/<tag>.md` adds your own text above the generated listing.
|
||||
|
||||
### Default options
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: "@quartz-community/tag-page"
|
||||
enabled: true
|
||||
options:
|
||||
numPages: 10
|
||||
prefixTags: false
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
- Category: Page Type
|
||||
- Function name: `ExternalPlugin.TagPage()`.
|
||||
- Source: [`quartz-community/tag-page`](https://github.com/quartz-community/tag-page)
|
||||
- Install: `npx quartz plugin add github:quartz-community/tag-page`
|
||||
- Install: `npx quartz plugin add @quartz-community/tag-page` (included in the default configuration)
|
||||
@@ -0,0 +1,66 @@
|
||||
---
|
||||
title: ThemesCore
|
||||
aliases:
|
||||
- QuartzThemes
|
||||
- Quartz Themes
|
||||
description: Obsidian community themes for Quartz, with per-aspect mix-and-match.
|
||||
tags:
|
||||
- plugin/transformer
|
||||
image:
|
||||
new-in-v5: true
|
||||
repository: "[quartz-themes/core](https://github.com/quartz-themes/core)"
|
||||
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.
|
||||
|
||||
> [!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`).
|
||||
|
||||
## Configuration
|
||||
|
||||
This plugin accepts the following configuration options:
|
||||
|
||||
- `theme`: The theme's id, e.g. `tokyo-night`, `catppuccin`, `minimal`. Defaults to `"tokyo-night"`.
|
||||
- `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`.
|
||||
|
||||
### Default options
|
||||
|
||||
The default config has a disabled entry for this plugin. Set `enabled: true` to use it:
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: "@quartz-themes/core"
|
||||
enabled: true
|
||||
options:
|
||||
theme: tokyo-night
|
||||
mode: both
|
||||
```
|
||||
|
||||
Mixing aspects:
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
- source: "@quartz-themes/core"
|
||||
enabled: true
|
||||
options:
|
||||
theme: tokyo-night
|
||||
mode: both
|
||||
aspects:
|
||||
callouts: anuppuccin
|
||||
tables: minimal
|
||||
code: false
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
- Category: Transformer
|
||||
- Function name: `ExternalPlugin.QuartzTheme()`.
|
||||
- Source: [`quartz-themes/core`](https://github.com/quartz-themes/core)
|
||||
- Install: `npx quartz plugin add @quartz-themes/core`
|
||||
Loaded 100 of 103 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user