You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/advanced/making plugins.md
+26-11Lines changed: 26 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,10 +25,11 @@ The following sections will go into detail for what methods can be implemented f
25
25
- `BuildCtx` is defined in `quartz/ctx.ts`. It consists of
26
26
- `argv`: The command line arguments passed to the Quartz [[build]] command
27
27
- `cfg`: The full Quartz [[configuration]]
28
-
- `allSlugs`: a list of all the valid content slugs (see [[paths]] for more information on what a `ServerSlug` is)
28
+
- `allSlugs`: a list of all the valid content slugs (see [[paths]] for more information on what a slug is)
29
29
- `StaticResources` is defined in `quartz/resources.tsx`. It consists of
30
-
- `css`: a list of URLs for stylesheets that should be loaded
30
+
- `css`: a list of CSS style definitions that should be loaded. A CSS style is described with the `CSSResource` type which is also defined in `quartz/resources.tsx`. It accepts either a source URL or the inline content of the stylesheet.
31
31
- `js`: a list of scripts that should be loaded. A script is described with the `JSResource` type which is also defined in `quartz/resources.tsx`. 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.
32
+
- `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.
32
33
33
34
## Transformers
34
35
@@ -37,7 +38,7 @@ Transformers **map** over content, taking a Markdown file and outputting modifie
An emitter plugin must define a `name` field, an `emit` function, and a `getQuartzComponents` function. `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.
239
+
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.
240
+
241
+
- `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.
242
+
- `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.
243
+
- `getQuartzComponents` declares which Quartz components the emitter uses to construct its pages.
229
244
230
245
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/plugins/emitters/helpers.ts` if you are creating files that contain text. `write` has the following signature:
231
246
@@ -234,7 +249,7 @@ export type WriteOptions = (data: {
234
249
// the build context
235
250
ctx:BuildCtx
236
251
// the name of the file to emit (not including the file extension)
Copy file name to clipboardExpand all lines: docs/configuration.md
+30-5Lines changed: 30 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,7 @@ const config: QuartzConfig = {
21
21
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:
22
22
23
23
-`pageTitle`: title of the site. This is also used when generating the [[RSS Feed]] for your site.
24
+
-`pageTitleSuffix`: a string added to the end of the page title. This only applies to the browser tab title, not the title shown at the top of the page.
24
25
-`enableSPA`: whether to enable [[SPA Routing]] on your site.
25
26
-`enablePopovers`: whether to enable [[popover previews]] on your site.
26
27
-`analytics`: what to use for analytics on your site. Values can be
@@ -32,18 +33,20 @@ This part of the configuration concerns anything that can affect the whole site.
32
33
-`{ provider: 'posthog', apiKey: '<your-posthog-project-apiKey>', host: '<your-posthog-host>' }`: use [Posthog](https://posthog.com/);
33
34
-`{ provider: 'tinylytics', siteId: '<your-site-id>' }`: use [Tinylytics](https://tinylytics.app/);
34
35
-`{ provider: 'cabin' }` or `{ provider: 'cabin', host: 'https://cabin.example.com' }` (custom domain): use [Cabin](https://withcabin.com);
36
+
-`{provider: 'clarity', projectId: '<your-clarity-id-code' }`: use [Microsoft clarity](https://clarity.microsoft.com/). The project id can be found on top of the overview page.
35
37
-`locale`: used for [[i18n]] and date formatting
36
38
-`baseUrl`: this is used for sitemaps and RSS feeds that require an absolute URL to know where the canonical 'home' of your site lives. This is normally the deployed URL of your site (e.g. `quartz.jzhao.xyz` for this site). Do not include the protocol (i.e. `https://`) or any leading or trailing slashes.
37
39
- This should also include the subpath if you are [[hosting]] on GitHub pages without a custom domain. For example, if my repository is `jackyzha0/quartz`, GitHub pages would deploy to `https://jackyzha0.github.io/quartz` and the `baseUrl` would be `jackyzha0.github.io/quartz`.
38
40
- Note that Quartz 4 will avoid using this as much as possible and use relative URLs whenever it can to make sure your site works no matter _where_ you end up actually deploying it.
39
41
-`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.
40
42
-`defaultDateType`: whether to use created, modified, or published as the default date to display on pages and page listings.
41
43
-`theme`: configure how the site looks.
42
-
-`cdnCaching`: If`true` (default), use Google CDN to cache the fonts. This will generally will be faster. Disable (`false`) this if you want Quartz to download the fonts to be self-contained.
44
+
-`cdnCaching`: if`true` (default), use Google CDN to cache the fonts. This will generally be faster. Disable (`false`) this if you want Quartz to download the fonts to be self-contained.
43
45
-`typography`: what fonts to use. Any font available on [Google Fonts](https://fonts.google.com/) works here.
44
-
-`header`: Font to use for headers
45
-
-`code`: Font for inline and block quotes.
46
-
-`body`: Font for everything
46
+
-`title`: font for the title of the site (optional, same as `header` by default)
47
+
-`header`: font to use for headers
48
+
-`code`: font for inline and block quotes
49
+
-`body`: font for everything
47
50
-`colors`: controls the theming of the site.
48
51
-`light`: page background
49
52
-`lightgray`: borders
@@ -101,8 +104,30 @@ transformers: [
101
104
]
102
105
```
103
106
104
-
Some plugins are included by default in the[`quartz.config.ts`](https://github.com/jackyzha0/quartz/blob/v4/quartz.config.ts), but there are more available.
107
+
Some plugins are included by default in the[`quartz.config.ts`](https://github.com/jackyzha0/quartz/blob/v4/quartz.config.ts), but there are more available.
105
108
106
109
You can see a list of all plugins and their configuration options [[tags/plugin|here]].
107
110
108
111
If you'd like to make your own plugins, see the [[making plugins|making custom plugins]] guide.
112
+
113
+
## Fonts
114
+
115
+
Fonts can be specified as a `string` or a `FontSpecification`:
Quartz uses [rehype-citation](https://github.com/timlrx/rehype-citation) to support parsing of a BibTex bibliography file.
8
+
9
+
Under the default configuration, a citation key `[@templeton2024scaling]` will be exported as `(Templeton et al., 2024)`.
10
+
11
+
> [!example]- BibTex file
12
+
>
13
+
> ```bib title="bibliography.bib"
14
+
> @article{templeton2024scaling,
15
+
> title={Scaling Monosemanticity: Extracting Interpretable Features from Claude 3 Sonnet},
16
+
> author={Templeton, Adly and Conerly, Tom and Marcus, Jonathan and Lindsey, Jack and Bricken, Trenton and Chen, Brian and Pearce, Adam and Citro, Craig and Ameisen, Emmanuel and Jones, Andy and Cunningham, Hoagy and Turner, Nicholas L and McDougall, Callum and MacDiarmid, Monte and Freeman, C. Daniel and Sumers, Theodore R. and Rees, Edward and Batson, Joshua and Jermyn, Adam and Carter, Shan and Olah, Chris and Henighan, Tom},
> By default, the references will be included at the end of the file. To control where the references to be included, uses `[^ref]`
26
+
>
27
+
> Refer to `rehype-citation` docs for more information.
28
+
29
+
## Customization
30
+
31
+
Citation parsing is a functionality of the [[plugins/Citations|Citation]] plugin. **This plugin is not enabled by default**. See the plugin page for customization options.
0 commit comments