From a62a97c7abcabea4509760e5af957eed66fa0755 Mon Sep 17 00:00:00 2001 From: Emil Rofors Date: Fri, 3 Nov 2023 16:40:43 -0700 Subject: [PATCH 1/4] docs: add GitLab pages CI (#549) * add .gitlab-ci.yml * move GitLab CI to hosting.md * remove extra folder name Co-authored-by: Jacky Zhao * remove test from gitlab instructions * run prettier --------- Co-authored-by: Jacky Zhao --- docs/hosting.md | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/docs/hosting.md b/docs/hosting.md index 01d130fd3..a4ca1ea98 100644 --- a/docs/hosting.md +++ b/docs/hosting.md @@ -166,3 +166,56 @@ Using `docs.example.com` is an example of a subdomain. They're a simple way of c 3. Go to the [Vercel Dashboard](https://vercel.com/dashboard) and select your Quartz project. 4. Go to the Settings tab and then click Domains in the sidebar 5. Enter your subdomain into the field and press Add + +## GitLab Pages + +You can configure GitLab CI to build and deploy a Quartz 4 project. + +In your local Quartz, create a new file `.gitlab-ci.yaml`. + +```yaml title=".gitlab-ci.yaml" +stages: + - build + - deploy + +variables: + NODE_VERSION: "18.14" + +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 + script: + - npx prettier --write . + - npm run check + - npx quartz build + artifacts: + paths: + - public + cache: + paths: + - ~/.npm/ + key: "${CI_COMMIT_REF_SLUG}-node-${CI_COMMIT_REF_NAME}" + tags: + - docker + +pages: + stage: deploy + rules: + - if: '$CI_COMMIT_REF_NAME == "v4"' + script: + - echo "Deploying to GitLab Pages..." + artifacts: + paths: + - public +``` + +When `.gitlab-ci.yaml` is commited, GitLab will build and deploy the website as a GitLab Page. You can find the url under `Deploy` -> `Pages` in the sidebar. + +By default, the page is private and only visible when logged in to a GitLab account with access to the repository but can be opened in the settings under `Deploy` -> `Pages`. From 101e9946bddd053a42d269e19e35feae46fe4305 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Sat, 4 Nov 2023 12:11:42 -0700 Subject: [PATCH 2/4] feat: add collapseByDefault option to TableOfContents (closes #566) --- docs/features/table of contents.md | 1 + quartz/components/TableOfContents.tsx | 4 ++-- quartz/components/scripts/toc.inline.ts | 3 ++- quartz/plugins/transformers/toc.ts | 4 ++++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/features/table of contents.md b/docs/features/table of contents.md index a66c85017..f169b22d2 100644 --- a/docs/features/table of contents.md +++ b/docs/features/table of contents.md @@ -18,6 +18,7 @@ You can also hide the table of contents on a page by adding `showToc: false` to - 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 })` +- Collapse the table of content by default: pass in a parameter to `Plugin.TableOfContents({ collapseByDefault: true })` - Component: `quartz/components/TableOfContents.tsx` - Style: - Modern (default): `quartz/components/styles/toc.scss` diff --git a/quartz/components/TableOfContents.tsx b/quartz/components/TableOfContents.tsx index 384772684..1c55f0740 100644 --- a/quartz/components/TableOfContents.tsx +++ b/quartz/components/TableOfContents.tsx @@ -20,7 +20,7 @@ function TableOfContents({ fileData, displayClass }: QuartzComponentProps) { return (
-