Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update plugin documentation #888

Merged
merged 39 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
c530dbe
docs: first few plugins documented
eikowagenknecht Feb 18, 2024
149c8c8
docs: move plugin info
eikowagenknecht Feb 19, 2024
ff49866
docs: move plugin docs to tag based system
eikowagenknecht Feb 19, 2024
c28a053
docs: update latex example code snippet
eikowagenknecht Feb 19, 2024
d8d2b09
docs: fix spelling of latex in title
eikowagenknecht Feb 19, 2024
2c91937
docs: add missing linebreak
eikowagenknecht Feb 19, 2024
cb1c1c0
docs: remove plugin tag from feature pages
eikowagenknecht Feb 19, 2024
5a41958
docs: shorten titles
eikowagenknecht Feb 19, 2024
624dd36
docs: refine wording
eikowagenknecht Feb 19, 2024
082b175
docs: move plugin details for frontmatter
eikowagenknecht Feb 19, 2024
0cb7100
docs: add features/* tags
eikowagenknecht Feb 19, 2024
503aaf2
docs: update latex example
eikowagenknecht Feb 19, 2024
4e7912b
docs: make references more explicit
eikowagenknecht Feb 19, 2024
467d669
docs: add stubs for the remaining plugins
eikowagenknecht Feb 19, 2024
7dd589f
docs: more descriptions
eikowagenknecht Feb 20, 2024
260bfb2
docs: fix feature tags
eikowagenknecht Feb 20, 2024
eb9b1af
docs: descriptions
eikowagenknecht Feb 20, 2024
c715df7
docs: new plugin pages
eikowagenknecht Feb 20, 2024
23a0011
docs: update configuration page
eikowagenknecht Feb 20, 2024
de8d32e
docs: more plugin work
eikowagenknecht Feb 20, 2024
6cd13d5
docs: run prettier
eikowagenknecht Feb 20, 2024
4edc4fe
Merge branch 'v4' into feature/docs
eikowagenknecht Feb 20, 2024
8d4dff3
docs: remove comments in config file and add link to docs
eikowagenknecht Feb 20, 2024
9a29c7c
docs: minor fixes
eikowagenknecht Feb 20, 2024
04a36ba
docs: run prettier
eikowagenknecht Feb 20, 2024
08e7180
docs: spelling
eikowagenknecht Feb 20, 2024
f777836
docs: update docs/plugins/AliasRedirects.md
eikowagenknecht Feb 20, 2024
665d03f
docs: update docs/plugins/Assets.md
eikowagenknecht Feb 20, 2024
2b3e38d
docs: update docs/plugins/CNAME.md
eikowagenknecht Feb 20, 2024
4d293a8
docs: update docs/plugins/Static.md
eikowagenknecht Feb 20, 2024
6783740
docs: update docs
eikowagenknecht Feb 20, 2024
acc678a
docs: update docs/features/Mermaid diagrams.md
eikowagenknecht Feb 20, 2024
d4ad8e3
docs: update docs/plugins/RemoveDrafts.md
eikowagenknecht Feb 23, 2024
ef6fcce
docs: update docs/plugins/Assets.md
eikowagenknecht Feb 23, 2024
c575790
docs: update docs/configuration.md
eikowagenknecht Feb 23, 2024
bc0784d
docs: update docs/configuration.md
eikowagenknecht Feb 23, 2024
d6c577c
docs: update docs/configuration.md
eikowagenknecht Feb 23, 2024
3ffd89c
docs: some updates
eikowagenknecht Feb 23, 2024
c21db0c
docs: work in review comments
eikowagenknecht Feb 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions docs/advanced/making plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ All transformer plugins must define at least a `name` field to register the plug

Normally for both `remark` and `rehype`, you can find existing plugins that you can use to . 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 [[Latex]] plugin:
A good example of a transformer plugin that borrows from the `remark` and `rehype` ecosystems is the [[plugins/Latex|Latex]] plugin:

```ts title="quartz/plugins/transformers/latex.ts"
import remarkMath from "remark-math"
import rehypeKatex from "rehype-katex"
import rehypeMathjax from "rehype-mathjax/svg.js"
import rehypeMathjax from "rehype-mathjax/svg"
import { QuartzTransformerPlugin } from "../types"

interface Options {
Expand All @@ -74,8 +74,6 @@ export const Latex: QuartzTransformerPlugin<Options> = (opts?: Options) => {
},
htmlPlugins() {
if (engine === "katex") {
// if you need to pass options into a plugin, you
// can use a tuple of [plugin, options]
eikowagenknecht marked this conversation as resolved.
Show resolved Hide resolved
return [[rehypeKatex, { output: "html" }]]
} else {
return [rehypeMathjax]
Expand All @@ -84,10 +82,14 @@ export const Latex: QuartzTransformerPlugin<Options> = (opts?: Options) => {
externalResources() {
if (engine === "katex") {
return {
css: ["https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/katex.min.css"],
css: [
// base css
"https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.css",
],
js: [
{
src: "https://cdn.jsdelivr.net/npm/katex@0.16.7/dist/contrib/copy-tex.min.js",
// fix copy behaviour: https://github.com/KaTeX/KaTeX/blob/main/contrib/copy-tex/README.md
src: "https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/contrib/copy-tex.min.js",
loadTime: "afterDOMReady",
contentType: "external",
},
Expand Down
4 changes: 4 additions & 0 deletions docs/authoring content.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ Some common frontmatter fields that are natively supported by Quartz:

When your Quartz is at a point you're happy with, you can save your changes to GitHub.
First, make sure you've [[setting up your GitHub repository|already setup your GitHub repository]] and then do `npx quartz sync`.

## Customization

Frontmatter parsing for `title`, `tags`, `aliases` and `cssclasses` is a functionality of the [[Frontmatter]] plugin. Frontmatter parsing for `date` is a functionality of the [[CreatedModifiedDate]] plugin. See the plugin pages for customization options.
aarnphm marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 4 additions & 2 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ By adding, removing, and reordering plugins from the `tranformers`, `filters`, a
> [!note]
> Each node is modified by every transformer _in order_. Some transformers are position-sensitive so you may need to take special note of whether it needs come before or after any other particular plugins.

Additionally, plugins may also have their own configuration settings that you can pass in. For example, the [[Latex]] plugin allows you to pass in a field specifying the `renderEngine` to choose between Katex and MathJax.
Additionally, plugins may also have their own configuration settings that you can pass in. For example, the [[plugins/Latex|Latex]] plugin allows you to pass in a field specifying the `renderEngine` to choose between Katex and MathJax. If you do not pass in a configuration, the plugin will use its default settings.

```ts
transformers: [
Expand All @@ -82,4 +82,6 @@ transformers: [
]
```

If you'd like to make your own plugins, read the guide on [[making plugins]] for more information.
The current default plugins can be found [here](https://github.com/jackyzha0/quartz/blob/v4/quartz.config.ts). For a list of all plugins and the available configuration options, visit the [[plugin]] tag overview.

If you'd like to make your own plugins, read the guide on [[making plugins|making custom plugins]] for more information.
6 changes: 2 additions & 4 deletions docs/features/Latex.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
tags:
- plugin/transformer
title: LaTeX
---

Quartz uses [Katex](https://katex.org/) by default to typeset both inline and block math expressions at build time.
Expand Down Expand Up @@ -59,5 +58,4 @@ In `quartz.config.ts`, you can configure Quartz to use [MathJax SVG rendering](h

## Customization

- Removing Latex support: remove all instances of `Plugin.Latex()` from `quartz.config.ts`.
- Plugin: `quartz/plugins/transformers/latex.ts`
Latex parsing is a functionality of the [[plugins/Latex|Latex]] plugin. See the plugin page for customization options.
2 changes: 0 additions & 2 deletions docs/features/Obsidian compatibility.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
tags:
- plugin/transformer
eikowagenknecht marked this conversation as resolved.
Show resolved Hide resolved
---

Quartz was originally designed as a tool to publish Obsidian vaults as websites. Even as the scope of Quartz has widened over time, it hasn't lost the ability to seamlessly interoperate with Obsidian.
Expand Down
2 changes: 0 additions & 2 deletions docs/features/OxHugo compatibility.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
tags:
- plugin/transformer
---

[org-roam](https://www.orgroam.com/) is a plain-text personal knowledge management system for [emacs](https://en.wikipedia.org/wiki/Emacs). [ox-hugo](https://github.com/kaushalmodi/ox-hugo) is org exporter backend that exports `org-mode` files to [Hugo](https://gohugo.io/) compatible Markdown.
Expand Down
2 changes: 0 additions & 2 deletions docs/features/callouts.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
title: Callouts
tags:
- plugin/transformer
---

Quartz supports the same Admonition-callout syntax as Obsidian.
Expand Down
2 changes: 0 additions & 2 deletions docs/features/folder and tag listings.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
title: Folder and Tag Listings
tags:
- plugin/emitter
---

Quartz creates listing pages for any folders and tags you have.
Expand Down
2 changes: 0 additions & 2 deletions docs/features/private pages.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
title: Private Pages
tags:
- plugin/filter
---

There may be some notes you want to avoid publishing as a website. Quartz supports this through two mechanisms which can be used in conjunction:
Expand Down
6 changes: 1 addition & 5 deletions docs/features/syntax highlighting.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
title: Syntax Highlighting
tags:
- plugin/transformer
---

Syntax highlighting in Quartz is completely done at build-time. This means that Quartz only ships pre-calculated CSS to highlight the right words so there is no heavy client-side bundle that does the syntax highlighting.
Expand Down Expand Up @@ -130,6 +128,4 @@ const [name, setName] = useState('Taylor');

## Customization

- Removing syntax highlighting: delete all usages of `Plugin.SyntaxHighlighting()` from `quartz.config.ts`.
- Style: By default, Quartz uses derivatives of the GitHub light and dark themes. You can customize the colours in the `quartz/styles/syntax.scss` file.
- Plugin: `quartz/plugins/transformers/syntax.ts`
Syntax highlighting is a functionality of the [[SyntaxHighlighting]] plugin. See the plugin page for customization options.
1 change: 0 additions & 1 deletion docs/features/table of contents.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
title: "Table of Contents"
tags:
- component
- plugin/transformer
---

Quartz can automatically generate a table of contents from a list of headings on each page. It will also show you your current scroll position on the site by marking headings you've scrolled through with a different colour.
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ If you prefer instructions in a video format you can try following Nicole van de

## 🔧 Features

- [[Obsidian compatibility]], [[full-text search]], [[graph view]], note transclusion, [[wikilinks]], [[backlinks]], [[Latex]], [[syntax highlighting]], [[popover previews]], [[Docker Support]], [[i18n|internationalization]] and [many more](./features) right out of the box
- [[Obsidian compatibility]], [[full-text search]], [[graph view]], note transclusion, [[wikilinks]], [[backlinks]], [[features/Latex|Latex]], [[syntax highlighting]], [[popover previews]], [[Docker Support]], [[i18n|internationalization]] and [many more](./features) right out of the box
- Hot-reload for both configuration and content
- Simple JSX layouts and [[creating components|page components]]
- [[SPA Routing|Ridiculously fast page loads]] and tiny bundle sizes
Expand Down
17 changes: 17 additions & 0 deletions docs/plugins/CreatedModifiedDate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: "CreatedModifiedDate"
tags:
- plugin/transformer
---

This plugin determines the created, modified, and published dates for a document using three potential data sources: front matter metadata, Git history, and the filesystem.

If it encounters invalid date formats, it defaults to the current date.

- To remove dates from all pages, delete all usages of `Plugin.CreatedModifiedDate()` from `quartz.config.ts`.
- To customize date parsing, use the configuration options of the plugin:
- `priority`: the data sources to consult for date information. Highest priority first. Possible values are `"frontmatter"`, `"git"`, and `"filesystem"`. Defaults to `"frontmatter", "git", "filesystem"]`.

The source of this plugin can be found in [`quartz/plugins/transformers/lastmod.ts`](https://github.com/jackyzha0/quartz/blob/v4/quartz/plugins/transformers/lastmod.ts).

See the backlinks for functionalities where this plugin is used.
16 changes: 16 additions & 0 deletions docs/plugins/Frontmatter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: "Frontmatter"
tags:
- plugin/transformer
---

This plugin parses the frontmatter of the page using the [gray-matter](https://github.com/jonschlinkert/gray-matter) library.

- This plugin (`Plugin.Frontmatter()`) should not be removed from `quartz.config.ts`, otherwise Quartz will break.
- To customize frontmatter parsing, use the configuration options of the plugin:
- `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`.

The source of this plugin can be found in [`quartz/plugins/transformers/frontmatter.ts`](https://github.com/jackyzha0/quartz/blob/v4/quartz/plugins/transformers/frontmatter.ts).

See the backlinks for functionalities where this plugin is used.
13 changes: 13 additions & 0 deletions docs/plugins/Latex.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: "Latex"
tags:
- plugin/transformer
---
eikowagenknecht marked this conversation as resolved.
Show resolved Hide resolved

- To remove Latex support, delete all usages of `Plugin.Latex()` from `quartz.config.ts`.
- To customize Latex support, use the configuration options of the plugin:
- `renderEngine`: the engine to use to render LaTeX equations. Can be `"katex"` for KaTeX or `"mathjax"` for MathJax. Defaults to KaTeX.

The source of this plugin can be found in [`quartz/plugins/transformers/latex.ts`](https://github.com/jackyzha0/quartz/blob/v4/quartz/plugins/transformers/latex.ts).

See the backlinks for functionalities where this plugin is used.
15 changes: 15 additions & 0 deletions docs/plugins/SyntaxHighlighting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: "SyntaxHighlighting"
tags:
- plugin/transformer
---

- To remove syntax highlighting, delete all usages of `Plugin.SyntaxHighlighting()` from `quartz.config.ts`.
- To customize syntax highlighting, use the configuration options of the plugin:
- `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.
- In addition, you can further override the colours in the `quartz/styles/syntax.scss` file.

The source of this plugin can be found in [`quartz/plugins/transformers/syntax.ts`](https://github.com/jackyzha0/quartz/blob/v4/quartz/plugins/transformers/syntax.ts).

See the backlinks for functionalities where this plugin is used.
3 changes: 3 additions & 0 deletions docs/plugins/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Plugins
---
3 changes: 3 additions & 0 deletions docs/tags/plugin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Plugins
---