From 79e828696a9e53357f61bd89c36e41555575c2c2 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Fri, 11 Aug 2023 22:47:50 -0700 Subject: [PATCH] feature docs --- content/advanced/architecture.md | 6 +-- content/advanced/creating components.md | 12 ++--- content/authoring content.md | 12 ++--- content/build.md | 8 +--- content/configuration.md | 59 ++++--------------------- content/features/Latex.md | 2 +- content/features/RSS Feed.md | 5 +++ content/features/SPA Routing.md | 8 +++- content/features/backlinks.md | 2 +- content/features/darkmode.md | 14 ++++++ content/features/full-text search.md | 2 +- content/features/graph view.md | 4 +- content/features/table of contents.md | 19 ++++++++ content/features/upcoming features.md | 9 ++-- content/features/wikilinks.md | 18 ++++++++ content/hosting.md | 3 ++ content/index.md | 18 +++++--- content/layout.md | 42 ++++++++++++++++++ content/philosophy.md | 5 ++- content/upgrading.md | 6 +-- 20 files changed, 160 insertions(+), 94 deletions(-) create mode 100644 content/features/darkmode.md create mode 100644 content/layout.md diff --git a/content/advanced/architecture.md b/content/advanced/architecture.md index 06a670b6c..33da89d90 100644 --- a/content/advanced/architecture.md +++ b/content/advanced/architecture.md @@ -8,11 +8,11 @@ This question is best answered by tracing what happens when a user (you!) runs ` ## On the server -1. After running `npx quartz build`, npm will look at `package.json` to find the `bin.quartz` entry which points at `./quartz/bootstrap-cli.mjs`. +1. After running `npx quartz build`, npm will look at `package.json` to find the `bin` entry for `quartz` which points at `./quartz/bootstrap-cli.mjs`. 2. This file has a [shebang]() line at the top which tells npm to execute it using Node. 3. `bootstrap-cli.mjs` is responsible for a few things: 1. Parsing the command-line arguments using [yargs](http://yargs.js.org/). - 2. Transpiling and bundling the rest of Quartz (which is in Typescript) to regular JavaScript using [esbuild](https://esbuild.github.io/). The `esbuild` configuration here is slightly special as it also handles `.scss` file imports using [esbuild-sass-plugin v2](https://www.npmjs.com/package/esbuild-sass-plugin). Additionally, we bundle 'inline' client-side scripts (any `.inline.ts` file) that components declare using a custom `esbuild` plugin that runs another instance of `esbuild` that bundles for the browser instead of `node`. Modules of both types are imported as plain text. + 2. Transpiling and bundling the rest of Quartz (which is in Typescript) to regular JavaScript using [esbuild](https://esbuild.github.io/). The `esbuild` configuration here is slightly special as it also handles `.scss` file imports using [esbuild-sass-plugin v2](https://www.npmjs.com/package/esbuild-sass-plugin). Additionally, we bundle 'inline' client-side scripts (any `.inline.ts` file) that components declare using a custom `esbuild` plugin that runs another instance of `esbuild` which bundles for the browser instead of `node`. Modules of both types are imported as plain text. 3. Running the local preview server if `--serve` is set. This starts two servers: 1. A WebSocket server on port 3001 to handle hot-reload signals. This tracks all inbound connections and sends a 'rebuild' message a server-side change is detected (either content or configuration). 2. An HTTP file-server on a user defined port (normally 8080) to serve the actual website files. @@ -35,7 +35,7 @@ This question is best answered by tracing what happens when a user (you!) runs ` 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.layout.ts`, 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: + 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.layout.ts`, 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. 2. Scripts are split into `beforeDOMLoaded` and `afterDOMLoaded` and are inserted in the `` and `` respectively. 3. Finally, each emitter plugin is responsible for emitting and writing it's own emitted files to disk. diff --git a/content/advanced/creating components.md b/content/advanced/creating components.md index e9f138535..1496b15b2 100644 --- a/content/advanced/creating components.md +++ b/content/advanced/creating components.md @@ -14,9 +14,9 @@ Normally on the web, we write layout code using HTML which looks something like ``` -This piece of HTML represents an article with a leading header that says "An article header" and a paragraph that contains the text "Some content". This is normally combined with CSS to style the page and JavaScript to add interactivity. +This piece of HTML represents an article with a leading header that says "An article header" and a paragraph that contains the text "Some content". This is combined with CSS to style the page and JavaScript to add interactivity. -However, HTML doesn't let you create reusable templates. If you wanted to create a new page, you would need to copy and paste the above snippet and edit the header and content yourself. This isn't great if we have a lot of content on our site that shares a lot of similar layout. The smart people who created React also had similar thoughts, inventing the concept of JSX Components to solve the code duplication problem. +However, HTML doesn't let you create reusable templates. If you wanted to create a new page, you would need to copy and paste the above snippet and edit the header and content yourself. This isn't great if we have a lot of content on our site that shares a lot of similar layout. The smart people who created React also had similar complaints and invented the concept of Components -- JavaScript functions that return JSX -- to solve the code duplication problem. In effect, components allow you to write a JavaScript function that takes some data and produces HTML as an output. **While Quartz doesn't use React, it uses the same component concept to allow you to easily express layout templates in your Quartz site.** @@ -26,7 +26,7 @@ In effect, components allow you to write a JavaScript function that takes some d Component files are written in `.tsx` files that live in the `quartz/components` folder. These are re-exported in `quartz/components/index.ts` so you can use them in layouts and other components more easily. -Each component file should have a default export that satisfies the `QuartzComponentConstructor` function signature. It is a function that takes in a single optional parameter `opts` and returns a Quartz Component. The type of the parameters `ops` is defined by the interface `Options` which you as the component creator also decide. +Each component file should have a default export that satisfies the `QuartzComponentConstructor` function signature. It's a function that takes in a single optional parameter `opts` and returns a Quartz Component. The type of the parameters `opts` is defined by the interface `Options` which you as the component creator also decide. In your component, you can use the values from the configuration option to change the rendering behaviour inside of your component. For example, the component in the code snippet below will not render if the `favouriteNumber` option is below 0. @@ -57,7 +57,7 @@ export default ((userOpts?: Options) => { The Quartz component itself (lines 11-17 highlighted above) looks like a React component. It takes in properties (sometimes called [props](https://react.dev/learn/passing-props-to-a-component)) and returns JSX. -All Quartz components accept the same set of props which are defined in `QuartzComponentProps`: +All Quartz components accept the same set of props: ```tsx title="quartz/components/types.ts" // simplified for sake of demonstration @@ -82,7 +82,7 @@ export type QuartzComponentProps = { Quartz components can also define a `.css` property on the actual function component which will get picked up by Quartz. This is expected to be a CSS string which can either be inlined or imported from a `.scss` file. -Note that inlined styles **must** be plain vanilla CSS. +Note that inlined styles **must** be plain vanilla CSS: ```tsx {6-10} title="quartz/components/YourComponent.tsx" export default (() => { @@ -100,7 +100,7 @@ export default (() => { }) satisfies QuartzComponentConstructor ``` -Imported styles, however, can be from SCSS files. +Imported styles, however, can be from SCSS files: ```tsx {1-2,9} title="quartz/components/YourComponent.tsx" // assuming your stylesheet is in quartz/components/styles/YourComponent.scss diff --git a/content/authoring content.md b/content/authoring content.md index b5b154c0f..4e3c3c833 100644 --- a/content/authoring content.md +++ b/content/authoring content.md @@ -4,15 +4,15 @@ title: Authoring Content All of the content in your Quartz should go in the `/content` folder. The content for the home page of your Quartz lives in `content/index.md`. If you've [[index#🪴 Get Started|setup Quartz]] already, this folder should already be initailized. Any Markdown in this folder will get processed by Quartz. -It is recommended that you use [Obsidian](https://obsidian.md/) as a way to edit and maintain your Quartz. It comes with a nice editor and graphical interface to preview all of your local files and allow you to easily edit and link across files. +It is recommended that you use [Obsidian](https://obsidian.md/) as a way to edit and maintain your Quartz. It comes with a nice editor and graphical interface to preview, edit, and link your local files and attachments. Got everything setup? Let's [[build]] and preview your Quartz locally! ## Syntax -As Quartz uses Markdown files as the main way of writing content, it fully supports Markdown syntax along with a few 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) (footnotes, strikethrough, tables, tasklists) and [Obsidian Flavored Markdown](https://help.obsidian.md/Editing+and+formatting/Obsidian+Flavored+Markdown) ([[callouts]], [[wikilinks]]). -Additionally, Quartz also allows you to specify additional metadata in your notes called **frontmatter** using YAML. +Additionally, Quartz also allows you to specify additional metadata in your notes called **frontmatter**. ```md title="content/note.md" --- @@ -27,7 +27,7 @@ The rest of your content lives here. You can use **Markdown** here :) Some common frontmatter fields that are natively supported by Quartz: -- `title`: Quartz will use the name of the file as the title if this isn't provided. If it is provided, it should be a string. -- `draft`: Whether to publish the page or not. This is one way to make [[private pages|pages private]] in Quartz. +- `title`: Title of the page. If it isn't provided, Quartz will use the name of the file as the title. - `aliases`: Other names for this note. This is a list of strings. -- `date`: A string representing the day the note was published. Normally uses `YYYY-MM-DD` format but other formats _may_ work. +- `draft`: Whether to publish the page or not. This is one way to make [[private pages|pages private]] in Quartz. +- `date`: A string representing the day the note was published. Normally uses `YYYY-MM-DD` format. diff --git a/content/build.md b/content/build.md index bce9d5463..144768757 100644 --- a/content/build.md +++ b/content/build.md @@ -2,17 +2,13 @@ title: "Building your Quartz" --- -Once you've [[index#🪴 Get Started|initialized]] Quartz, let's see what it looks like locally. +Once you've [[index#🪴 Get Started|initialized]] Quartz, let's see what it looks like locally: ```bash npx quartz build --serve ``` -Then, open a web browser and visit `http://localhost:8080/` to view it. - -Want to change how Quartz looks? You can edit `quartz.config.ts` to customize and configure your Quartz, including styles, layout, and more. Read the [[configuration]] page for more information on what each field in the configuration does. - -Once you're happy with it, let's see how to [[hosting|deploy Quartz to the web]]! +This will start a local web server to run your Quartz on your computer. Open a web browser and visit `http://localhost:8080/` to view it. > [!hint] Flags and options > For full help options, you can run `npx quartz build --help`. diff --git a/content/configuration.md b/content/configuration.md index cdf4459e2..182a87b26 100644 --- a/content/configuration.md +++ b/content/configuration.md @@ -2,12 +2,12 @@ title: Configuration --- -Quartz is meant to be extremely configurable, even if you don't know any coding. Most of the configuration you should need can be done by just editing `quartz.config.ts`. +Quartz is meant to be extremely configurable, even if you don't know any coding. Most of the configuration you should need can be done by just editing `quartz.config.ts` or changing [[layout|the layout]] in `quartz.layout.ts`. > [!tip] -> If you edit this file using a text-editor that has TypeScript language support like VSCode, it will warn you when you you've made an error in your configuration, helping you avoid configuration mistakes! +> If you edit Quartz configuration using a text-editor that has TypeScript language support like VSCode, it will warn you when you you've made an error in your configuration, helping you avoid configuration mistakes! -This configuration can be broken down into two main parts: +The configuration of Quartz can be broken down into two main parts: ```ts title="quartz.config.ts" const config: QuartzConfig = { @@ -20,15 +20,17 @@ const config: QuartzConfig = { 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: -- `pageTitle`: used as an anchor to return to the home page. This is also used when generating the [[RSS Feed]] for your site. +- `pageTitle`: title of the site. This is also used when generating the [[RSS Feed]] for your site. - `enableSPA`: whether to enable [[SPA Routing]] on your site. - `enablePopovers`: whether to enable [[popover previews]] on your site. - `analytics`: what to use for analytics on your site. Values can be - `null`: don't use analytics; - `{ provider: 'plausible' }`: use [Plausible](https://plausible.io/), a privacy-friendly alternative to Google Analytics; or - `{ provider: 'google', tagId: }`: use Google Analytics -- `caononicalUrl`: sometimes called `baseURL` in other site generators. 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. `https://quartz.jzhao.xyz/` for this site). 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. -- `ignorePatterns`: a list of [glob]() patterns that Quartz should ignore and not search through when looking for files inside the `content` folder. +- `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. + - 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` + - 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. +- `ignorePatterns`: a list of [glob]() 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. - `typography`: what fonts to use. Any font available on [Google Fonts](https://fonts.google.com/) works here. - `header`: Font to use for headers @@ -77,48 +79,3 @@ transformers: [ ``` If you'd like to make your own plugins, read the guide on [[making plugins]] for more information. - -### Layout - -Certain emitters may also output [HTML](https://developer.mozilla.org/en-US/docs/Web/HTML) files. To enable easy customization, these emitters allow you to fully rearrange the layout of the page. The default page layouts can be found in `quartz.layout.ts`. - -Each page is composed of multiple different sections which contain `QuartzComponents`. The following code snippet lists all of the valid sections that you can add components to: - -```typescript title="quartz/cfg.ts" -export interface FullPageLayout { - head: QuartzComponent // single component - header: QuartzComponent[] // laid out horizontally - beforeBody: QuartzComponent[] // laid out vertically - pageBody: QuartzComponent // single component - left: QuartzComponent[] // vertical on desktop, horizontal on mobile - right: QuartzComponent[] // vertical on desktop, horizontal on mobile - footer: QuartzComponent // single component -} -``` - -These correspond to following parts of the page: - -![[quartz-layout.png|800]] - -> [!note] -> There are two additional layout fields that are _not_ shown in the above diagram. -> -> 1. `head` is a single component that renders the `` [tag](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/head) in the HTML. This doesn't appear visually on the page and is only is responsible for metadata about the document like the tab title, scripts, and styles. -> 2. `header` is a set of components that are laid out horizontally and appears _before_ the `beforeBody` section. This enables you to replicate the old Quartz 3 header bar where the title, search bar, and dark mode toggle. By default, Quartz 4 doesn't place any components in the `header`. - -Quartz **components**, like plugins, can take in additional properties as configuration options. If you're familiar with React terminology, you can think of them as Higher-order Components. - -See [a list of all the components](./tags/component) for all available components along with their configuration options. - -### Style - -Most meaningful style changes like colour scheme and font can be done simply through the [[#General Configuration|general configuration]] options above. - -However, if you'd like to make more involved style changes, you can do this by writing your own styles. Quartz 4, like Quartz 3, uses [Sass](https://sass-lang.com/guide/) for styling. - -You can see the base style sheet in `quartz/styles/base.scss` and write your own in `quartz/styles/custom.scss`. - -> [!note] -> Some components may provide their own styling as well! For example, `quartz/components/Darkmode.tsx` imports styles from `quartz/components/styles/darkmode.scss`. If you'd like to customize styling for a specific component, double check the component definition to see how its styles are defined. - -When you're ready, see how [[build|build and preview]] Quartz locally. diff --git a/content/features/Latex.md b/content/features/Latex.md index 91cc952ed..3c8f6ff1f 100644 --- a/content/features/Latex.md +++ b/content/features/Latex.md @@ -5,7 +5,7 @@ tags: Quartz uses [Katex](https://katex.org/) by default to typeset both inline and block math expressions at build time. -## Formatting +## Syntax ### Block Math diff --git a/content/features/RSS Feed.md b/content/features/RSS Feed.md index e69de29bb..c519f8771 100644 --- a/content/features/RSS Feed.md +++ b/content/features/RSS Feed.md @@ -0,0 +1,5 @@ +Quartz creates an RSS feed for all the content on your site by generating an `index.xml` file that RSS readers can subscribe to. Because of the RSS spec, this requires the `baseUrl` property in your [[configuration]] to be set properly for RSS readers to pick it up properly. + +## Configuration + +- Remove RSS feed: set the `enableRSS` field of `Plugin.ContentIndex` in `quartz.config.ts` to be `false`. diff --git a/content/features/SPA Routing.md b/content/features/SPA Routing.md index 91249939b..3004af977 100644 --- a/content/features/SPA Routing.md +++ b/content/features/SPA Routing.md @@ -1 +1,7 @@ -Single-page-app style rendering. This prevents flashes of unstyled content and improves smoothness of Quartz +Single-page-app style rendering. This prevents flashes of unstyled content and improves the smoothness of Quartz. + +Under the hood, this is done by hijacking page navigations and instead fetching the HTML via a `GET` request and then diffing and selectively replacing parts of the page using [micromorph](https://github.com/natemoo-re/micromorph). This allows us to change the content of the page without fully refreshing the page, reducing the amount of content that the browser needs to load. + +## Configuration + +- Disable SPA Routing: set the `enableSPA` field of the [[configuration]] in `quartz.config.ts` to be `false`. diff --git a/content/features/backlinks.md b/content/features/backlinks.md index 4df7fd178..f558f4a5d 100644 --- a/content/features/backlinks.md +++ b/content/features/backlinks.md @@ -8,7 +8,7 @@ A backlink for a note is a link from another note to that note. Links in the bac ## Customization -- Removing backlinks: delete all usages of `Component.Backlinks()` from `quartz.config.ts`. +- Removing backlinks: delete all usages of `Component.Backlinks()` from `quartz.layout.ts`. - Component: `quartz/components/Backlinks.tsx` - Style: `quartz/components/styles/backlinks.scss` - Script: `quartz/components/scripts/search.inline.ts` diff --git a/content/features/darkmode.md b/content/features/darkmode.md new file mode 100644 index 000000000..dfa231409 --- /dev/null +++ b/content/features/darkmode.md @@ -0,0 +1,14 @@ +--- +title: "Darkmode" +tags: + - component +--- + +Quartz supports darkmode out of the box that respects the user's theme preference. Any future manual toggles of the darkmode switch will be saved in the browser's local storage so it can be persisted across future page loads. + +## Customization + +- Removing darkmode: delete all usages of `Component.Darkmode()` from `quartz.layout.ts`. +- Component: `quartz/components/Darkmode.tsx` +- Style: `quartz/components/styles/darkmode.scss` +- Script: `quartz/components/scripts/darkmode.inline.ts` diff --git a/content/features/full-text search.md b/content/features/full-text search.md index cb0567f35..ce3d88f93 100644 --- a/content/features/full-text search.md +++ b/content/features/full-text search.md @@ -21,7 +21,7 @@ It properly tokenizes Chinese, Korean, and Japenese characters and constructs se ## Customization -- Removing search: delete all usages of `Component.Search()` from `quartz.config.ts`. +- Removing search: delete all usages of `Component.Search()` from `quartz.layout.ts`. - Component: `quartz/components/Search.tsx` - Style: `quartz/components/styles/search.scss` - Script: `quartz/components/scripts/search.inline.ts` diff --git a/content/features/graph view.md b/content/features/graph view.md index 9fb31be71..c7ddb03e0 100644 --- a/content/features/graph view.md +++ b/content/features/graph view.md @@ -22,7 +22,7 @@ Most configuration can be done by passing in options to `Component.Graph()`. For example, here's what the default configuration looks like: -```typescript title="quartz.config.ts" +```typescript title="quartz.layout.ts" Component.Graph({ localGraph: { drag: true, // whether to allow panning the view around @@ -53,7 +53,7 @@ When passing in your own options, you can omit any or all of these fields if you Want to customize it even more? -- Removing graph view: delete all usages of `Component.Graph()` from `quartz.config.ts`. +- Removing graph view: delete all usages of `Component.Graph()` from `quartz.layout.ts`. - Component: `quartz/components/Graph.tsx` - Style: `quartz/components/styles/graph.scss` - Script: `quartz/components/scripts/graph.inline.ts` diff --git a/content/features/table of contents.md b/content/features/table of contents.md index 70191157e..ecc36fdc2 100644 --- a/content/features/table of contents.md +++ b/content/features/table of contents.md @@ -2,4 +2,23 @@ title: "Table of Contents" tags: - component + - plugins/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. + +By default, it will show all headers from H1 (`# Title`) all the way to H3 (`### Title`) and will only show the table of contents if there is more than 1 header on the page. + +> [!info] +> This feature requires both `Plugin.TableOfContents` in your `quartz.config.ts` and `Component.TableOfContents` in your `quartz.layout.ts` to function correctly. + +## Customization + +- Removing table of contents: remove all instances of `Plugin.TableOfContents()` from `quartz.config.ts`. and `Component.TableOfContents()` from `quartz.layout.ts` +- Changing the max depth: pass in a parameter to `Plugin.TableOfContents({ maxDepth: 4 })` +- Changing the minimum number of entries in the Table of Contents before it renders: pass in a parameter to `Plugin.TableOfContents({ minEntries: 3 })` +- Component: `quartz/components/TableOfContents.tsx` +- Style: + - Modern (default): `quartz/components/styles/toc.scss` + - Legacy Quartz 3 style: `quartz/components/styles/legacyToc.scss` +- Script: `quartz/components/scripts/toc.inline.ts` diff --git a/content/features/upcoming features.md b/content/features/upcoming features.md index ebfd62574..424f02818 100644 --- a/content/features/upcoming features.md +++ b/content/features/upcoming features.md @@ -4,6 +4,9 @@ draft: true ## todo +- wikilink to anchors in the same document +- folders, tags, and content emit overlapping (e.g. for tags/component) +- 404 using base url - nested tags showing duplicate - tag page markdown file for description not being rendered - back button with anchors / popovers + spa is broken @@ -13,12 +16,6 @@ draft: true - dereference symlink for npx quartz sync - test/fix with subpath - fix docs with deploy from github -- write feature docs - - rss - - spa-routing - - table of contents - - darkmode - - frontmatter parsing ## high priority backlog diff --git a/content/features/wikilinks.md b/content/features/wikilinks.md index e69de29bb..4d197157d 100644 --- a/content/features/wikilinks.md +++ b/content/features/wikilinks.md @@ -0,0 +1,18 @@ +--- +title: Wikilinks +--- + +Wikilinks were pioneered by earlier internet wikis to make it easier to write links across pages without needing to write Markdown or HTML links each time. + +Quartz supports Wikilinks by default and these links are resolved by Quartz using `Plugin.CrawlLinks`. 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. + +## Syntax + +- `[[Path to file]]`: produces a link to `Path to file` with the text `Path to file` +- `[[Path to file | Here's the title override]]`: produces a link to `Path to file` with the text `Here's the title override` +- `[[Path to file#Anchor]]`: produces a link to the anchor `Anchor` in the file `Path to file` + +> [!warning] +> Currently, Quartz does not support block references or note embed syntax. diff --git a/content/hosting.md b/content/hosting.md index 5d09500c4..0ed2335d9 100644 --- a/content/hosting.md +++ b/content/hosting.md @@ -6,6 +6,9 @@ Quartz effectively turns your Markdown files and other resources into a bundle o However, if you'd like to publish your site to the world, you need a way to host it online. This guide will detail how to deploy with either GitHub Pages or Cloudflare pages but any service that allows you to deploy static HTML should work as well (e.g. Netlify, Replit, etc.) +> [!hint] +> Some Quartz features (like [[RSS Feed]] and sitemap generation) require `baseUrl` to be configured properly in your [[configuration]] to work properly. Make sure you set this before deploying! + ## Cloudflare Pages 1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/) and select your account. diff --git a/content/index.md b/content/index.md index 32f012c2e..cf97d31fd 100644 --- a/content/index.md +++ b/content/index.md @@ -18,21 +18,29 @@ npm i npx quartz create ``` -This will guide you through initializing your Quartz with content. Once you've done so, see how to [[authoring content|author content]] or how to [[build]] and [[hosting|host]] Quartz. +This will guide you through initializing your Quartz with content. Once you've done so, see how to: + +1. [[authoring content|Author content]] in Quartz +2. [[configuration|Configure]] Quartz's behaviour +3. Change Quartz's [[layout]] +4. [[build|Build and preview]] Quartz +5. [[hosting|Host]] Quartz online > [!info] > Coming from Quartz 3? See the [[migrating from Quartz 3|migration guide]] for the differences between Quartz 3 and Quartz 4 and how to migrate. ## 🔧 Features -- [[Obsidian compatibility]], [[full-text search]], [[graph view]], [[wikilinks]], [[backlinks]], [[Latex]], [[syntax highlighting]], [[popover previews]], and many more right out of the box +- [[Obsidian compatibility]], [[full-text search]], [[graph view]], [[wikilinks]], [[backlinks]], [[Latex]], [[syntax highlighting]], [[popover previews]], and [many more](./features) right out of the box - Hot-reload for both configuration and content -- Simple JSX [[creating components|layouts and page components]] +- Simple JSX layouts and [[creating components|page components]] - [[SPA Routing|Ridiculously fast page loads]] and tiny bundle sizes - Fully-customizable parsing, filtering, and page generation through [[making plugins|plugins]] For a comprehensive list of features, visit the [features page](/features). You can read more the _why_ behind these features on the [[philosophy]] page and a technical overview on the [[architecture]] page. -### 🚧 Troubleshooting +### 🚧 Troubleshooting + Updating -Having trouble with Quartz? Try searching for your issue using the search feature. 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). +Having trouble with Quartz? Try searching for your issue using the search feature. 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). diff --git a/content/layout.md b/content/layout.md new file mode 100644 index 000000000..801710073 --- /dev/null +++ b/content/layout.md @@ -0,0 +1,42 @@ +--- +title: Layout +--- + +Certain emitters may also output [HTML](https://developer.mozilla.org/en-US/docs/Web/HTML) files. To enable easy customization, these emitters allow you to fully rearrange the layout of the page. The default page layouts can be found in `quartz.layout.ts`. + +Each page is composed of multiple different sections which contain `QuartzComponents`. The following code snippet lists all of the valid sections that you can add components to: + +```typescript title="quartz/cfg.ts" +export interface FullPageLayout { + head: QuartzComponent // single component + header: QuartzComponent[] // laid out horizontally + beforeBody: QuartzComponent[] // laid out vertically + pageBody: QuartzComponent // single component + left: QuartzComponent[] // vertical on desktop, horizontal on mobile + right: QuartzComponent[] // vertical on desktop, horizontal on mobile + footer: QuartzComponent // single component +} +``` + +These correspond to following parts of the page: + +![[quartz-layout.png|800]] + +> [!note] +> There are two additional layout fields that are _not_ shown in the above diagram. +> +> 1. `head` is a single component that renders the `` [tag](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/head) in the HTML. This doesn't appear visually on the page and is only is responsible for metadata about the document like the tab title, scripts, and styles. +> 2. `header` is a set of components that are laid out horizontally and appears _before_ the `beforeBody` section. This enables you to replicate the old Quartz 3 header bar where the title, search bar, and dark mode toggle. By default, Quartz 4 doesn't place any components in the `header`. + +Quartz **components**, like plugins, can take in additional properties as configuration options. If you're familiar with React terminology, you can think of them as Higher-order Components. + +See [a list of all the components](./tags/component) for all available components along with their configuration options. You can also checkout the guide on [[creating components]] if you're interested in further customizing the behaviour of Quartz. + +### Style + +Most meaningful style changes like colour scheme and font can be done simply through the [[configuration#General Configuration|general configuration]] options. However, if you'd like to make more involved style changes, you can do this by writing your own styles. Quartz 4, like Quartz 3, uses [Sass](https://sass-lang.com/guide/) for styling. + +You can see the base style sheet in `quartz/styles/base.scss` and write your own in `quartz/styles/custom.scss`. + +> [!note] +> Some components may provide their own styling as well! For example, `quartz/components/Darkmode.tsx` imports styles from `quartz/components/styles/darkmode.scss`. If you'd like to customize styling for a specific component, double check the component definition to see how its styles are defined. diff --git a/content/philosophy.md b/content/philosophy.md index ecd856b9a..ad9a14f77 100644 --- a/content/philosophy.md +++ b/content/philosophy.md @@ -6,7 +6,7 @@ title: Philosophy of Quartz > The garden is the web as topology. Every walk through the garden creates new paths, new meanings, and when we add things to the garden we add them in a way that allows many future, unpredicted relationships. > -> (The Garden and the Stream) +> _(The Garden and the Stream)_ The problem with the file cabinet is that it focuses on efficiency of access and interoperability rather than generativity and creativity. Thinking is not linear, nor is it hierarchical. In fact, not many things are linear or hierarchical at all. Then why is it that most tools and thinking strategies assume a nice chronological or hierarchical order for my thought processes? The ideal tool for thought for me would embrace the messiness of my mind, and organically help insights emerge from chaos instead of forcing an artificial order. A rhizomatic, not arboresecent, form of note taking. @@ -22,6 +22,7 @@ The goal of digital gardening should be to tap into your network’s collective Quartz is designed first and foremost as a tool for publishing [digital gardens](https://jzhao.xyz/posts/networked-thought/) to the web. To me, digital gardening is not just passive knowledge collection. It’s a form of expression and sharing. -> “[One] who works with the door open gets all kinds of interruptions, but [they] also occasionally gets clues as to what the world is and what might be important.” — Richard Hamming +> “[One] who works with the door open gets all kinds of interruptions, but [they] also occasionally gets clues as to what the world is and what might be important.” +> — Richard Hamming **The goal of Quartz is to make sharing your digital garden free and simple.** At its core, Quartz is designed to be easy to use enough for non-technical people to get going but also powerful enough that senior developers can tweak it to work how they'd like it to work. diff --git a/content/upgrading.md b/content/upgrading.md index f9f0c399e..abe916c63 100644 --- a/content/upgrading.md +++ b/content/upgrading.md @@ -5,12 +5,12 @@ title: "Upgrading Quartz" > [!note] > This is specifically a guide for upgrading Quartz 4 version to a more recent update. If you are coming from Quartz 3, check out the [[migrating from Quartz 3|migration guide]] for more info. -To fetch the latest Quartz updates, simply do +To fetch the latest Quartz updates, simply run -``` +```bash npx quartz upgrade ``` -As Quartz uses [git](https://git-scm.com/) under the hood for versioning, updating effectively 'pulls' in the updates from the official Quartz GitHub repository. If you have local changes that might conflict with the updates, you may need to resolve these manually yourself. +As Quartz uses [git](https://git-scm.com/) under the hood for versioning, updating effectively 'pulls' in the updates from the official Quartz GitHub repository. If you have local changes that might conflict with the updates, you may need to resolve these manually yourself (or, pull manually using `git pull origin upstream`). If you have the [GitHub desktop app](https://desktop.github.com/), this will automatically open to help you resolve the conflicts. Otherwise, you will need to resolve this in a text editor like VSCode. For more help on resolving conflicts manually, check out the [GitHub guide on resolving merge conflicts](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-using-the-command-line#competing-line-change-merge-conflicts).