Skip to content

Commit fb0ab8f

Browse files
committed
basic
2 parents 067adce + fbc4554 commit fb0ab8f

File tree

173 files changed

+9052
-3245
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+9052
-3245
lines changed

.github/dependabot.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
1-
# To get started with Dependabot version updates, you'll need to specify which
2-
# package ecosystems to update and where the package manifests are located.
3-
# Please see the documentation for all configuration options:
4-
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5-
61
version: 2
72
updates:
83
- package-ecosystem: "npm"
94
directory: "/"
105
schedule:
116
interval: "weekly"
7+
groups:
8+
production-dependencies:
9+
applies-to: "version-updates"
10+
patterns:
11+
- "*"
12+
- package-ecosystem: "github-actions"
13+
directory: "/"
14+
schedule:
15+
interval: "weekly"
16+
groups:
17+
ci-dependencies:
18+
applies-to: "version-updates"
19+
patterns:
20+
- "*"

.github/workflows/ci.yaml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Build and Test
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- v4
7+
push:
8+
branches:
9+
- v4
10+
workflow_dispatch:
11+
12+
jobs:
13+
build-and-test:
14+
if: ${{ github.repository == 'jackyzha0/quartz' }}
15+
strategy:
16+
matrix:
17+
os: [windows-latest, macos-latest, ubuntu-latest]
18+
runs-on: ${{ matrix.os }}
19+
permissions:
20+
contents: write
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Setup Node
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: 20
30+
31+
- name: Cache dependencies
32+
uses: actions/cache@v4
33+
with:
34+
path: ~/.npm
35+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
36+
restore-keys: |
37+
${{ runner.os }}-node-
38+
39+
- run: npm ci
40+
41+
- name: Check types and style
42+
run: npm run check
43+
44+
- name: Test
45+
run: npm test
46+
47+
- name: Ensure Quartz builds, check bundle info
48+
run: npx quartz build --bundleInfo
49+
50+
publish-tag:
51+
if: ${{ github.repository == 'jackyzha0/quartz' && github.ref == 'refs/heads/v4' }}
52+
runs-on: ubuntu-latest
53+
permissions:
54+
contents: write
55+
steps:
56+
- uses: actions/checkout@v4
57+
with:
58+
fetch-depth: 0
59+
- name: Setup Node
60+
uses: actions/setup-node@v4
61+
with:
62+
node-version: 20
63+
- name: Get package version
64+
run: node -p -e '`PACKAGE_VERSION=${require("./package.json").version}`' >> $GITHUB_ENV
65+
- name: Create release tag
66+
uses: pkgdeps/git-tag-action@v3
67+
with:
68+
github_token: ${{ secrets.GITHUB_TOKEN }}
69+
github_repo: ${{ github.repository }}
70+
version: ${{ env.PACKAGE_VERSION }}
71+
git_commit_sha: ${{ github.sha }}
72+
git_tag_prefix: "v"
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Docker build & push image
2+
3+
on:
4+
push:
5+
branches: [v4]
6+
tags: ["v*"]
7+
pull_request:
8+
branches: [v4]
9+
paths:
10+
- .github/workflows/docker-build-push.yaml
11+
- quartz/**
12+
workflow_dispatch:
13+
14+
jobs:
15+
build:
16+
if: ${{ github.repository == 'jackyzha0/quartz' }} # Comment this out if you want to publish your own images on a fork!
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Set lowercase repository owner environment variable
20+
run: |
21+
echo "OWNER_LOWERCASE=${OWNER,,}" >> ${GITHUB_ENV}
22+
env:
23+
OWNER: "${{ github.repository_owner }}"
24+
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 1
27+
- name: Inject slug/short variables
28+
uses: rlespinasse/[email protected]
29+
- name: Set up QEMU
30+
uses: docker/setup-qemu-action@v3
31+
- name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v3
33+
with:
34+
install: true
35+
driver-opts: |
36+
image=moby/buildkit:master
37+
network=host
38+
- name: Install cosign
39+
if: github.event_name != 'pull_request'
40+
uses: sigstore/[email protected]
41+
- name: Login to GitHub Container Registry
42+
uses: docker/login-action@v3
43+
if: github.event_name != 'pull_request'
44+
with:
45+
registry: ghcr.io
46+
username: ${{ github.actor }}
47+
password: ${{ secrets.GITHUB_TOKEN }}
48+
49+
- name: Extract metadata tags and labels on PRs
50+
if: github.event_name == 'pull_request'
51+
id: meta-pr
52+
uses: docker/metadata-action@v5
53+
with:
54+
images: ghcr.io/${{ env.OWNER_LOWERCASE }}/quartz
55+
tags: |
56+
type=raw,value=sha-${{ env.GITHUB_SHA_SHORT }}
57+
labels: |
58+
org.opencontainers.image.source="https://github.com/${{ github.repository_owner }}/quartz"
59+
- name: Extract metadata tags and labels for main, release or tag
60+
if: github.event_name != 'pull_request'
61+
id: meta
62+
uses: docker/metadata-action@v5
63+
with:
64+
flavor: |
65+
latest=auto
66+
images: ghcr.io/${{ env.OWNER_LOWERCASE }}/quartz
67+
tags: |
68+
type=semver,pattern={{version}}
69+
type=semver,pattern={{major}}.{{minor}}
70+
type=semver,pattern={{major}}.{{minor}}.{{patch}}
71+
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
72+
type=raw,value=sha-${{ env.GITHUB_SHA_SHORT }}
73+
labels: |
74+
maintainer=${{ github.repository_owner }}
75+
org.opencontainers.image.source="https://github.com/${{ github.repository_owner }}/quartz"
76+
77+
- name: Build and push Docker image
78+
id: build-and-push
79+
uses: docker/build-push-action@v6
80+
with:
81+
push: ${{ github.event_name != 'pull_request' }}
82+
build-args: |
83+
GIT_SHA=${{ env.GITHUB_SHA }}
84+
DOCKER_LABEL=sha-${{ env.GITHUB_SHA_SHORT }}
85+
tags: ${{ steps.meta.outputs.tags || steps.meta-pr.outputs.tags }}
86+
labels: ${{ steps.meta.outputs.labels || steps.meta-pr.outputs.labels }}
87+
cache-from: type=gha
88+
cache-to: type=gha

.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v20.9.0

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:20-slim as builder
1+
FROM node:20-slim AS builder
22
WORKDIR /usr/src/app
33
COPY package.json .
44
COPY package-lock.json* .

docs/advanced/creating components.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ export default (() => {
129129
return <button id="btn">Click me</button>
130130
}
131131

132-
YourComponent.beforeDOM = `
132+
YourComponent.beforeDOMLoaded = `
133133
console.log("hello from before the page loads!")
134134
`
135135

136-
YourComponent.afterDOM = `
136+
YourComponent.afterDOMLoaded = `
137137
document.getElementById('btn').onclick = () => {
138138
alert('button clicked!')
139139
}
@@ -180,7 +180,7 @@ export default (() => {
180180
return <button id="btn">Click me</button>
181181
}
182182

183-
YourComponent.afterDOM = script
183+
YourComponent.afterDOMLoaded = script
184184
return YourComponent
185185
}) satisfies QuartzComponentConstructor
186186
```

docs/advanced/making plugins.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ The following sections will go into detail for what methods can be implemented f
2727
- `cfg`: The full Quartz [[configuration]]
2828
- `allSlugs`: a list of all the valid content slugs (see [[paths]] for more information on what a `ServerSlug` is)
2929
- `StaticResources` is defined in `quartz/resources.tsx`. It consists of
30-
- `css`: a list of URLs for stylesheets that should be loaded
30+
- `css`: a list of CSS style definitions that should be loaded. A CSS style is described with the `CSSResource` type which is also defined in `quartz/resources.tsx`. It accepts either a source URL or the inline content of the stylesheet.
3131
- `js`: a list of scripts that should be loaded. A script is described with the `JSResource` type which is also defined in `quartz/resources.tsx`. It allows you to define a load time (either before or after the DOM has been loaded), whether it should be a module, and either the source URL or the inline content of the script.
3232
3333
## Transformers
@@ -85,8 +85,10 @@ export const Latex: QuartzTransformerPlugin<Options> = (opts?: Options) => {
8585
if (engine === "katex") {
8686
return {
8787
css: [
88-
// base css
89-
"https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/katex.min.css",
88+
{
89+
// base css
90+
content: "https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/katex.min.css",
91+
},
9092
],
9193
js: [
9294
{
@@ -260,19 +262,19 @@ export const ContentPage: QuartzEmitterPlugin = () => {
260262
...defaultContentPageLayout,
261263
pageBody: Content(),
262264
}
263-
const { head, header, beforeBody, pageBody, left, right, footer } = layout
265+
const { head, header, beforeBody, pageBody, afterBody, left, right, footer } = layout
264266
return {
265267
name: "ContentPage",
266268
getQuartzComponents() {
267-
return [head, ...header, ...beforeBody, pageBody, ...left, ...right, footer]
269+
return [head, ...header, ...beforeBody, pageBody, ...afterBody, ...left, ...right, footer]
268270
},
269271
async emit(ctx, content, resources, emit): Promise<FilePath[]> {
270272
const cfg = ctx.cfg.configuration
271273
const fps: FilePath[] = []
272274
const allFiles = content.map((c) => c[1].data)
273275
for (const [tree, file] of content) {
274276
const slug = canonicalizeServer(file.data.slug!)
275-
const externalResources = pageResources(slug, resources)
277+
const externalResources = pageResources(slug, file.data, resources)
276278
const componentData: QuartzComponentProps = {
277279
fileData: file.data,
278280
externalResources,

docs/advanced/paths.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ Here are the main types of slugs with a rough description of each type of path:
4848
- `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.
4949
- `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.
5050

51-
To get a clearer picture of how these relate to each other, take a look at the path tests in `quartz/path.test.ts`.
51+
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`.

docs/authoring content.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Some common frontmatter fields that are natively supported by Quartz:
2929

3030
- `title`: Title of the page. If it isn't provided, Quartz will use the name of the file as the title.
3131
- `description`: Description of the page used for link previews.
32+
- `permalink`: A custom URL for the page that will remain constant even if the path to the file changes.
3233
- `aliases`: Other names for this note. This is a list of strings.
3334
- `tags`: Tags for this note.
3435
- `draft`: Whether to publish the page or not. This is one way to make [[private pages|pages private]] in Quartz.

docs/build.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ This will start a local web server to run your Quartz on your computer. Open a w
2121
> - `--serve`: run a local hot-reloading server to preview your Quartz
2222
> - `--port`: what port to run the local preview server on
2323
> - `--concurrency`: how many threads to use to parse notes
24+
25+
> [!warning] Not to be used for production
26+
> Serve mode is intended for local previews only.
27+
> For production workloads, see the page on [[hosting]].

0 commit comments

Comments
 (0)