diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8915143c4..9b1622cb8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -45,3 +45,9 @@ jobs: - name: Ensure Quartz builds, check bundle info run: npx quartz build --bundleInfo + + - name: Create release tag + uses: Klemensas/action-autotag@stable + with: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + tag_prefix: "v" diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..1d9e5915f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM node:20-slim as builder +WORKDIR /usr/src/app +COPY package.json . +COPY package-lock.json* . +RUN npm ci + +FROM node:20-slim +WORKDIR /usr/src/app +COPY --from=builder /usr/src/app/ /usr/src/app/ +COPY . . +CMD ["npx", "quartz", "build", "--serve"] diff --git a/docs/advanced/making plugins.md b/docs/advanced/making plugins.md index 1f1616f42..d0934ad81 100644 --- a/docs/advanced/making plugins.md +++ b/docs/advanced/making plugins.md @@ -247,7 +247,7 @@ If you are creating an emitter plugin that needs to render components, there are - Your component should use `getQuartzComponents` to declare a list of `QuartzComponents` that it uses to construct the page. See the page on [[creating components]] for more information. - You can use the `renderPage` function defined in `quartz/components/renderPage.tsx` to render Quartz components into HTML. -- If you need to render an HTML AST to JSX, you can use the `toJsxRuntime` function from `hast-util-to-jsx-runtime` library. An example of this can be found in `quartz/components/pages/Content.tsx`. +- If you need to render an HTML AST to JSX, you can use the `htmlToJsx` function from `quartz/util/jsx.ts`. An example of this can be found in `quartz/components/pages/Content.tsx`. For example, the following is a simplified version of the content page plugin that renders every single page. diff --git a/docs/features/Docker Support.md b/docs/features/Docker Support.md new file mode 100644 index 000000000..cf73b7fcc --- /dev/null +++ b/docs/features/Docker Support.md @@ -0,0 +1,7 @@ +Quartz comes shipped with a Docker image that will allow you to preview your Quartz locally without installing Node. + +You can run the below one-liner to run Quartz in Docker. + +```sh +docker run --rm -itp 8080:8080 $(docker build -q .) +``` diff --git a/docs/features/explorer.md b/docs/features/explorer.md index 8937b25c0..fd656a888 100644 --- a/docs/features/explorer.md +++ b/docs/features/explorer.md @@ -196,7 +196,7 @@ Component.Explorer({ } } }, -}}) +}) ``` ### Putting it all together diff --git a/docs/features/private pages.md b/docs/features/private pages.md index 5c3940bc7..638c628b6 100644 --- a/docs/features/private pages.md +++ b/docs/features/private pages.md @@ -12,9 +12,17 @@ There may be some notes you want to avoid publishing as a website. Quartz suppor If you'd like to only publish a select number of notes, you can instead use `Plugin.ExplicitPublish` which will filter out all notes except for any that have `publish: true` in the frontmatter. +> [!warning] +> Regardless of the filter plugin used, **all non-markdown files will be emitted and available publically in the final build.** This includes files such as images, voice recordings, PDFs, etc. One way to prevent this and still be able to embed local images is to create a folder specifically for public media and add the following two patterns to the ignorePatterns array. +> +> `"!(PublicMedia)**/!(*.md)", "!(*.md)"` + ## `ignorePatterns` -This is a field in `quartz.config.ts` under the main [[configuration]] which allows you to specify a list of patterns to effectively exclude from parsing all together. Any valid [glob](https://github.com/mrmlnc/fast-glob#pattern-syntax) pattern works here. +This is a field in `quartz.config.ts` under the main [[configuration]] which allows you to specify a list of patterns to effectively exclude from parsing all together. Any valid [fast-glob](https://github.com/mrmlnc/fast-glob#pattern-syntax) pattern works here. + +> [!note] +> Bash's glob syntax is slightly different from fast-glob's and using bash's syntax may lead to unexpected results. Common examples include: 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`. diff --git a/docs/index.md b/docs/index.md index 05de2bae9..85afee1f0 100644 --- a/docs/index.md +++ b/docs/index.md @@ -6,7 +6,7 @@ Quartz is a fast, batteries-included static-site generator that transforms Markd ## 🪴 Get Started -Quartz requires **at least [Node](https://nodejs.org/) v18.14** to function correctly. Ensure you have this installed on your machine before continuing. +Quartz requires **at least [Node](https://nodejs.org/) v18.14** and `npm` v9.3.1 to function correctly. Ensure you have this installed on your machine before continuing. Then, in your terminal of choice, enter the following commands line by line: @@ -30,7 +30,7 @@ This will guide you through initializing your Quartz with content. Once you've d ## 🔧 Features -- [[Obsidian compatibility]], [[full-text search]], [[graph view]], note transclusion, [[wikilinks]], [[backlinks]], [[Latex]], [[syntax highlighting]], [[popover previews]], and [many more](./features) right out of the box +- [[Obsidian compatibility]], [[full-text search]], [[graph view]], note transclusion, [[wikilinks]], [[backlinks]], [[Latex]], [[syntax highlighting]], [[popover previews]], [[Docker Support]], 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 diff --git a/docs/showcase.md b/docs/showcase.md index 7dbc6e99b..3774fe3b6 100644 --- a/docs/showcase.md +++ b/docs/showcase.md @@ -9,7 +9,6 @@ Want to see what Quartz can do? Here are some cool community gardens: - [Brandon Boswell's Garden](https://brandonkboswell.com) - [Scaling Synthesis - A hypertext research notebook](https://scalingsynthesis.com/) - [AWAGMI Intern Notes](https://notes.awagmi.xyz/) -- [Course notes for Information Technology Advanced Theory](https://a2itnotes.github.io/quartz/) - [Data Dictionary 🧠](https://glossary.airbyte.com/) - [sspaeti.com's Second Brain](https://brain.sspaeti.com/) - [oldwinter の数字花园](https://garden.oldwinter.top/) @@ -19,5 +18,6 @@ Want to see what Quartz can do? Here are some cool community gardens: - [Pelayo Arbues' Notes](https://pelayoarbues.github.io/) - [Vince Imbat's Talahardin](https://vinceimbat.com/) - [🧠🌳 Chad's Mind Garden](https://www.chadly.net/) +- [Pedro MC Fernandes's Topo da Mente](https://www.pmcf.xyz/topo-da-mente/) 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/package.json b/package.json index 11a68d3ad..3fa8c2315 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "profile": "0x -D prof ./quartz/bootstrap-cli.mjs build --concurrency=1" }, "engines": { + "npm": ">=9.3.1", "node": ">=18.14" }, "keywords": [ diff --git a/quartz/cli/handlers.js b/quartz/cli/handlers.js index bc3da73f3..48a44ec9f 100644 --- a/quartz/cli/handlers.js +++ b/quartz/cli/handlers.js @@ -1,4 +1,4 @@ -import { promises, readFileSync } from "fs" +import { promises } from "fs" import path from "path" import esbuild from "esbuild" import chalk from "chalk" diff --git a/quartz/components/ArticleTitle.tsx b/quartz/components/ArticleTitle.tsx index b8d58c6b3..a52b2a466 100644 --- a/quartz/components/ArticleTitle.tsx +++ b/quartz/components/ArticleTitle.tsx @@ -1,9 +1,9 @@ import { QuartzComponentConstructor, QuartzComponentProps } from "./types" -function ArticleTitle({ fileData }: QuartzComponentProps) { +function ArticleTitle({ fileData, displayClass }: QuartzComponentProps) { const title = fileData.frontmatter?.title if (title) { - return