diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 56107cf..8c3b526 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,6 +7,7 @@ on: push: branches: - v4 + workflow_dispatch: jobs: build-and-test: @@ -18,17 +19,17 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Setup Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18 - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.npm key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} @@ -47,22 +48,22 @@ jobs: run: npx quartz build --bundleInfo publish-tag: - if: ${{ github.repository == 'jackyzha0/quartz' }} + if: ${{ github.repository == 'jackyzha0/quartz' && github.ref == 'refs/heads/v4' }} runs-on: ubuntu-latest permissions: contents: write steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Setup Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18 - name: Get package version run: node -p -e '`PACKAGE_VERSION=${require("./package.json").version}`' >> $GITHUB_ENV - name: Create release tag - uses: pkgdeps/git-tag-action@v2 + uses: pkgdeps/git-tag-action@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} github_repo: ${{ github.repository }} diff --git a/docs/advanced/creating components.md b/docs/advanced/creating components.md index 27369ab..628d5aa 100644 --- a/docs/advanced/creating components.md +++ b/docs/advanced/creating components.md @@ -129,11 +129,11 @@ export default (() => { return } - YourComponent.beforeDOM = ` + YourComponent.beforeDOMLoaded = ` console.log("hello from before the page loads!") ` - YourComponent.afterDOM = ` + YourComponent.afterDOMLoaded = ` document.getElementById('btn').onclick = () => { alert('button clicked!') } @@ -180,7 +180,7 @@ export default (() => { return } - YourComponent.afterDOM = script + YourComponent.afterDOMLoaded = script return YourComponent }) satisfies QuartzComponentConstructor ``` diff --git a/docs/advanced/paths.md b/docs/advanced/paths.md index 9455b98..16f6388 100644 --- a/docs/advanced/paths.md +++ b/docs/advanced/paths.md @@ -48,4 +48,4 @@ Here are the main types of slugs with a rough description of each type of path: - `SimpleSlug`: cannot be relative and shouldn't have `/index` as an ending or a file extension. It _can_ however have a trailing slash to indicate a folder 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/path.test.ts`. +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`. diff --git a/docs/configuration.md b/docs/configuration.md index 1408f71..e97d8df 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -28,8 +28,10 @@ This part of the configuration concerns anything that can affect the whole site. - `{ provider: 'google', tagId: '' }`: use Google Analytics; - `{ provider: 'plausible' }` (managed) or `{ provider: 'plausible', host: '' }` (self-hosted): use [Plausible](https://plausible.io/); - `{ provider: 'umami', host: '', websiteId: '' }`: use [Umami](https://umami.is/); - - `{ provider: 'goatcounter', websiteId: 'my-goatcounter-id' }` (managed) or `{ provider: 'goatcounter', websiteId: 'my-goatcounter-id', host: 'my-goatcounter-domain.com', scriptSrc: 'https://my-url.to/counter.js' }` (self-hosted) use [GoatCounter](https://goatcounter.com) + - `{ provider: 'goatcounter', websiteId: 'my-goatcounter-id' }` (managed) or `{ provider: 'goatcounter', websiteId: 'my-goatcounter-id', host: 'my-goatcounter-domain.com', scriptSrc: 'https://my-url.to/counter.js' }` (self-hosted) use [GoatCounter](https://goatcounter.com); - `{ provider: 'posthog', apiKey: '', host: '' }`: use [Posthog](https://posthog.com/); + - `{ provider: 'tinylytics', siteId: '' }`: use [Tinylytics](https://tinylytics.app/); + - `{ provider: 'cabin' }` or `{ provider: 'cabin', host: 'https://cabin.example.com' }` (custom domain): use [Cabin](https://withcabin.com); - `locale`: used for [[i18n]] and date formatting - `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`. diff --git a/docs/features/recent notes.md b/docs/features/recent notes.md index 9236b7c..75406e5 100644 --- a/docs/features/recent notes.md +++ b/docs/features/recent notes.md @@ -9,6 +9,7 @@ Quartz can generate a list of recent notes based on some filtering and sorting c - Changing the title from "Recent notes": pass in an additional parameter to `Component.RecentNotes({ title: "Recent writing" })` - Changing the number of recent notes: pass in an additional parameter to `Component.RecentNotes({ limit: 5 })` +- Display the note's tags (defaults to true): `Component.RecentNotes({ showTags: false })` - Show a 'see more' link: pass in an additional parameter to `Component.RecentNotes({ linkToMore: "tags/components" })`. This field should be a full slug to a page that exists. - Customize filtering: pass in an additional parameter to `Component.RecentNotes({ filter: someFilterFunction })`. The filter function should be a function that has the signature `(f: QuartzPluginData) => boolean`. - Customize sorting: pass in an additional parameter to `Component.RecentNotes({ sort: someSortFunction })`. By default, Quartz will sort by date and then tie break lexographically. The sort function should be a function that has the signature `(f1: QuartzPluginData, f2: QuartzPluginData) => number`. See `byDateAndAlphabetical` in `quartz/components/PageList.tsx` for an example. diff --git a/docs/features/syntax highlighting.md b/docs/features/syntax highlighting.md index 16fef25..bf9baae 100644 --- a/docs/features/syntax highlighting.md +++ b/docs/features/syntax highlighting.md @@ -95,6 +95,16 @@ const [age, setAge] = useState(50) const [name, setName] = useState("Taylor") ``` +### Inline Highlighting + +Append {:lang} to the end of inline code to highlight it like a regular code block. + +``` +This is an array `[1, 2, 3]{:js}` of numbers 1 through 3. +``` + +This is an array `[1, 2, 3]{:js}` of numbers 1 through 3. + ### Line numbers Syntax highlighting has line numbers configured automatically. If you want to start line numbers at a specific number, use `showLineNumbers{number}`: diff --git a/docs/hosting.md b/docs/hosting.md index e5ef9a6..8e9cb75 100644 --- a/docs/hosting.md +++ b/docs/hosting.md @@ -57,18 +57,16 @@ jobs: build: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # Fetch all history for git info - - uses: actions/setup-node@v3 - with: - node-version: 18.14 + - uses: actions/setup-node@v4 - name: Install Dependencies run: npm ci - name: Build Quartz run: npx quartz build - name: Upload artifact - uses: actions/upload-pages-artifact@v2 + uses: actions/upload-pages-artifact@v3 with: path: public @@ -81,7 +79,7 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v2 + uses: actions/deploy-pages@v4 ``` Then: @@ -182,35 +180,31 @@ Using `docs.example.com` is an example of a subdomain. They're a simple way of c ## GitLab Pages -In your local Quartz, create a new file `.gitlab-ci.yaml`. +In your local Quartz, create a new file `.gitlab-ci.yml`. -```yaml title=".gitlab-ci.yaml" +```yaml title=".gitlab-ci.yml" stages: - build - deploy -variables: - NODE_VERSION: "18.14" +image: node:18 +cache: # Cache modules in between jobs + key: $CI_COMMIT_REF_SLUG + paths: + - .npm/ build: stage: build rules: - if: '$CI_COMMIT_REF_NAME == "v4"' before_script: - - apt-get update -q && apt-get install -y nodejs npm - - npm install -g n - - n $NODE_VERSION - hash -r - - npm ci + - npm ci --cache .npm --prefer-offline script: - npx quartz build artifacts: paths: - public - cache: - paths: - - ~/.npm/ - key: "${CI_COMMIT_REF_SLUG}-node-${CI_COMMIT_REF_NAME}" tags: - docker diff --git a/docs/showcase.md b/docs/showcase.md index 4860e0b..9cff3a5 100644 --- a/docs/showcase.md +++ b/docs/showcase.md @@ -27,5 +27,7 @@ Want to see what Quartz can do? Here are some cool community gardens: - [sspaeti.com's Second Brain](https://brain.sspaeti.com/) - [🪴Aster's notebook](https://notes.asterhu.com) - [🥷🏻🌳🍃 Computer Science & Thinkering Garden](https://notes.yxy.ninja) +- [A Pattern Language - Christopher Alexander (Architecture)](https://patternlanguage.cc/) +- [Gatekeeper Wiki](https://www.gatekeeper.wiki) If you want to see your own on here, submit a [Pull Request adding yourself to this file](https://github.com/jackyzha0/quartz/blob/v4/docs/showcase.md)! diff --git a/quartz.config.ts b/quartz.config.ts index aad2e13..f1d0b51 100644 --- a/quartz.config.ts +++ b/quartz.config.ts @@ -54,7 +54,6 @@ const config: QuartzConfig = { Plugin.CreatedModifiedDate({ priority: ["frontmatter", "filesystem"], }), - Plugin.Latex({ renderEngine: "katex" }), Plugin.SyntaxHighlighting({ theme: { light: "github-light", @@ -68,6 +67,7 @@ const config: QuartzConfig = { Plugin.TableOfContents(), Plugin.CrawlLinks({ markdownLinkResolution: "shortest" }), Plugin.Description(), + Plugin.Latex({ renderEngine: "katex" }), ], filters: [Plugin.RemoveDrafts()], emitters: [ diff --git a/quartz/cfg.ts b/quartz/cfg.ts index 09905e9..574ceb1 100644 --- a/quartz/cfg.ts +++ b/quartz/cfg.ts @@ -30,6 +30,14 @@ export type Analytics = apiKey: string host?: string } + | { + provider: "tinylytics" + siteId: string + } + | { + provider: "cabin" + host?: string + } export interface GlobalConfiguration { pageTitle: string diff --git a/quartz/components/ExplorerNode.tsx b/quartz/components/ExplorerNode.tsx index 2968a03..e57d677 100644 --- a/quartz/components/ExplorerNode.tsx +++ b/quartz/components/ExplorerNode.tsx @@ -168,10 +168,8 @@ export function ExplorerNode({ node, opts, fullPath, fileData }: ExplorerNodePro const isDefaultOpen = opts.folderDefaultState === "open" // Calculate current folderPath - let folderPath = "" - if (node.name !== "") { - folderPath = joinSegments(fullPath ?? "", node.name) - } + const folderPath = node.name !== "" ? joinSegments(fullPath ?? "", node.name) : "" + const href = resolveRelative(fileData.slug!, folderPath as SimpleSlug) + "/" return ( <> @@ -205,11 +203,7 @@ export function ExplorerNode({ node, opts, fullPath, fileData }: ExplorerNodePro {/* render tag if folderBehavior is "link", otherwise render