From f66d2c23aca2944abcb1a6e3d83977a9b2edf37a Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Sun, 8 Oct 2023 09:15:06 -0700 Subject: [PATCH 01/33] fix: ctrl+click with spa enabled --- quartz/components/scripts/spa.inline.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quartz/components/scripts/spa.inline.ts b/quartz/components/scripts/spa.inline.ts index bd2260831..fc5aa7400 100644 --- a/quartz/components/scripts/spa.inline.ts +++ b/quartz/components/scripts/spa.inline.ts @@ -92,7 +92,7 @@ function createRouter() { if (typeof window !== "undefined") { window.addEventListener("click", async (event) => { const { url } = getOpts(event) ?? {} - if (!url) return + if (!url || event.ctrlKey || event.metaKey) return event.preventDefault() try { navigate(url, false) From da0a062c05db18d8c1521661ac0ab735abff3c3f Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Sun, 8 Oct 2023 09:59:18 -0700 Subject: [PATCH 02/33] feat: docker support for v4 (closes #530) --- Dockerfile | 11 +++++++++++ docs/features/Docker Support.md | 7 +++++++ docs/index.md | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100644 docs/features/Docker Support.md 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/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/index.md b/docs/index.md index f846cc7ea..85afee1f0 100644 --- a/docs/index.md +++ b/docs/index.md @@ -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 From af9ddadc4de513f2bbaf75f70079970215ed6406 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Sat, 14 Oct 2023 13:45:56 -0700 Subject: [PATCH 03/33] fix(css): import base from custom instead of the other way around (#536) --- quartz/cli/handlers.js | 2 +- quartz/plugins/emitters/componentResources.ts | 2 +- quartz/styles/base.scss | 3 +-- quartz/styles/custom.scss | 2 ++ 4 files changed, 5 insertions(+), 4 deletions(-) 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/plugins/emitters/componentResources.ts b/quartz/plugins/emitters/componentResources.ts index 1290a3548..5cb34804f 100644 --- a/quartz/plugins/emitters/componentResources.ts +++ b/quartz/plugins/emitters/componentResources.ts @@ -7,7 +7,7 @@ import spaRouterScript from "../../components/scripts/spa.inline" import plausibleScript from "../../components/scripts/plausible.inline" // @ts-ignore import popoverScript from "../../components/scripts/popover.inline" -import styles from "../../styles/base.scss" +import styles from "../../styles/custom.scss" import popoverStyle from "../../components/styles/popover.scss" import { BuildCtx } from "../../util/ctx" import { StaticResources } from "../../util/resources" diff --git a/quartz/styles/base.scss b/quartz/styles/base.scss index 7645baddd..51694cb4e 100644 --- a/quartz/styles/base.scss +++ b/quartz/styles/base.scss @@ -1,7 +1,6 @@ -@use "./custom.scss"; +@use "./variables.scss" as *; @use "./syntax.scss"; @use "./callouts.scss"; -@use "./variables.scss" as *; html { scroll-behavior: smooth; diff --git a/quartz/styles/custom.scss b/quartz/styles/custom.scss index b908314b1..b0c09dcb9 100644 --- a/quartz/styles/custom.scss +++ b/quartz/styles/custom.scss @@ -1 +1,3 @@ +@use "./base.scss"; + // put your custom CSS here! From ed971800c0a683f7096922fee0a6901250e239ae Mon Sep 17 00:00:00 2001 From: freenandes <42041153+freenandes@users.noreply.github.com> Date: Tue, 17 Oct 2023 16:58:28 +0100 Subject: [PATCH 04/33] Update showcase.md (#539) --- docs/showcase.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/showcase.md b/docs/showcase.md index 7dbc6e99b..5d945755d 100644 --- a/docs/showcase.md +++ b/docs/showcase.md @@ -19,5 +19,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/notes/) 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)! From 86d16b12a224d125ba469f91e885eedf97a9dfe8 Mon Sep 17 00:00:00 2001 From: Thomas <65691606+NotTacoz@users.noreply.github.com> Date: Wed, 18 Oct 2023 10:43:20 +0800 Subject: [PATCH 05/33] docs(explorer): Fixed small typo with extra } in explorer.md (#541) --- docs/features/explorer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 54e722a55d58f4bab86184ffc970159628fa6967 Mon Sep 17 00:00:00 2001 From: freenandes <42041153+freenandes@users.noreply.github.com> Date: Wed, 18 Oct 2023 03:43:41 +0100 Subject: [PATCH 06/33] docs: Update showcase.md (#540) changed URL --- docs/showcase.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/showcase.md b/docs/showcase.md index 5d945755d..6814dd06d 100644 --- a/docs/showcase.md +++ b/docs/showcase.md @@ -19,6 +19,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/notes/) +- [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)! From 1e357ef5ac85ab55ad19f832513f5ca7a7e54a52 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Sat, 21 Oct 2023 20:09:49 -0700 Subject: [PATCH 07/33] fix(style): prioritize base and custom scss over component css --- quartz/plugins/emitters/componentResources.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quartz/plugins/emitters/componentResources.ts b/quartz/plugins/emitters/componentResources.ts index 5cb34804f..116e4e3e0 100644 --- a/quartz/plugins/emitters/componentResources.ts +++ b/quartz/plugins/emitters/componentResources.ts @@ -164,7 +164,7 @@ export const ComponentResources: QuartzEmitterPlugin = (opts?: Partial< addGlobalPageResources(ctx, resources, componentResources) - const stylesheet = joinStyles(ctx.cfg.configuration.theme, styles, ...componentResources.css) + const stylesheet = joinStyles(ctx.cfg.configuration.theme, ...componentResources.css, styles) const prescript = joinScripts(componentResources.beforeDOMLoaded) const postscript = joinScripts(componentResources.afterDOMLoaded) const fps = await Promise.all([ From dc834015d02adcc7edb119fb5224a2a86c614142 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Sat, 21 Oct 2023 20:27:49 -0700 Subject: [PATCH 08/33] fix(style): tag float orientation for long tags on page listing --- quartz/components/TagList.tsx | 8 +++++--- quartz/components/styles/listPage.scss | 5 ----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/quartz/components/TagList.tsx b/quartz/components/TagList.tsx index c763b14ba..e39186e5f 100644 --- a/quartz/components/TagList.tsx +++ b/quartz/components/TagList.tsx @@ -28,11 +28,13 @@ function TagList({ fileData, displayClass }: QuartzComponentProps) { TagList.css = ` .tags { list-style: none; - display:flex; - flex-wrap: wrap; + display: flex; padding-left: 0; gap: 0.4rem; margin: 1rem 0; + flex-wrap: wrap; + justify-content: flex-end; + justify-self: end; } .tags > li { @@ -42,7 +44,7 @@ TagList.css = ` overflow-wrap: normal; } -a.tag-link { +a.internal.tag-link { border-radius: 8px; background-color: var(--highlight); padding: 0.2rem 0.4rem; diff --git a/quartz/components/styles/listPage.scss b/quartz/components/styles/listPage.scss index 7105a1e86..c8fc9e957 100644 --- a/quartz/components/styles/listPage.scss +++ b/quartz/components/styles/listPage.scss @@ -19,11 +19,6 @@ li.section-li { } } - & > .tags { - justify-self: end; - margin-left: 1rem; - } - & > .desc > h3 > a { background-color: transparent; } From 60b3bc34cb07b5bec87cbd667ea9f804ff14cf3c Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Sat, 21 Oct 2023 21:05:46 -0700 Subject: [PATCH 09/33] fix: catch html to jsx errors (closes #547) --- docs/advanced/making plugins.md | 2 +- quartz/components/TagList.tsx | 5 ++++- quartz/components/pages/Content.tsx | 8 +++----- quartz/components/pages/FolderContent.tsx | 6 ++---- quartz/components/pages/TagContent.tsx | 6 ++---- quartz/util/jsx.ts | 15 +++++++++++++++ quartz/util/trace.ts | 8 ++------ 7 files changed, 29 insertions(+), 21 deletions(-) create mode 100644 quartz/util/jsx.ts 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/quartz/components/TagList.tsx b/quartz/components/TagList.tsx index e39186e5f..cb1c121cf 100644 --- a/quartz/components/TagList.tsx +++ b/quartz/components/TagList.tsx @@ -33,9 +33,12 @@ TagList.css = ` gap: 0.4rem; margin: 1rem 0; flex-wrap: wrap; - justify-content: flex-end; justify-self: end; } + +.section-ul .tags { + justify-content: flex-end; +} .tags > li { display: inline-block; diff --git a/quartz/components/pages/Content.tsx b/quartz/components/pages/Content.tsx index 7490a7ea7..76cecc38c 100644 --- a/quartz/components/pages/Content.tsx +++ b/quartz/components/pages/Content.tsx @@ -1,10 +1,8 @@ +import { htmlToJsx } from "../../util/jsx" import { QuartzComponentConstructor, QuartzComponentProps } from "../types" -import { Fragment, jsx, jsxs } from "preact/jsx-runtime" -import { toJsxRuntime } from "hast-util-to-jsx-runtime" -function Content({ tree }: QuartzComponentProps) { - // @ts-ignore (preact makes it angry) - const content = toJsxRuntime(tree, { Fragment, jsx, jsxs, elementAttributeNameCase: "html" }) +function Content({ fileData, tree }: QuartzComponentProps) { + const content = htmlToJsx(fileData.filePath!, tree) return
{content}
} diff --git a/quartz/components/pages/FolderContent.tsx b/quartz/components/pages/FolderContent.tsx index a766d4b0b..765f84657 100644 --- a/quartz/components/pages/FolderContent.tsx +++ b/quartz/components/pages/FolderContent.tsx @@ -1,6 +1,4 @@ import { QuartzComponentConstructor, QuartzComponentProps } from "../types" -import { Fragment, jsx, jsxs } from "preact/jsx-runtime" -import { toJsxRuntime } from "hast-util-to-jsx-runtime" import path from "path" import style from "../styles/listPage.scss" @@ -8,6 +6,7 @@ import { PageList } from "../PageList" import { _stripSlashes, simplifySlug } from "../../util/path" import { Root } from "hast" import { pluralize } from "../../util/lang" +import { htmlToJsx } from "../../util/jsx" function FolderContent(props: QuartzComponentProps) { const { tree, fileData, allFiles } = props @@ -29,8 +28,7 @@ function FolderContent(props: QuartzComponentProps) { const content = (tree as Root).children.length === 0 ? fileData.description - : // @ts-ignore - toJsxRuntime(tree, { Fragment, jsx, jsxs, elementAttributeNameCase: "html" }) + : htmlToJsx(fileData.filePath!, tree) return (
diff --git a/quartz/components/pages/TagContent.tsx b/quartz/components/pages/TagContent.tsx index 9907e3fc3..205ba8958 100644 --- a/quartz/components/pages/TagContent.tsx +++ b/quartz/components/pages/TagContent.tsx @@ -1,12 +1,11 @@ import { QuartzComponentConstructor, QuartzComponentProps } from "../types" -import { Fragment, jsx, jsxs } from "preact/jsx-runtime" -import { toJsxRuntime } from "hast-util-to-jsx-runtime" import style from "../styles/listPage.scss" import { PageList } from "../PageList" import { FullSlug, getAllSegmentPrefixes, simplifySlug } from "../../util/path" import { QuartzPluginData } from "../../plugins/vfile" import { Root } from "hast" import { pluralize } from "../../util/lang" +import { htmlToJsx } from "../../util/jsx" const numPages = 10 function TagContent(props: QuartzComponentProps) { @@ -26,8 +25,7 @@ function TagContent(props: QuartzComponentProps) { const content = (tree as Root).children.length === 0 ? fileData.description - : // @ts-ignore - toJsxRuntime(tree, { Fragment, jsx, jsxs, elementAttributeNameCase: "html" }) + : htmlToJsx(fileData.filePath!, tree) if (tag === "") { const tags = [...new Set(allFiles.flatMap((data) => data.frontmatter?.tags ?? []))] diff --git a/quartz/util/jsx.ts b/quartz/util/jsx.ts new file mode 100644 index 000000000..8cba485ab --- /dev/null +++ b/quartz/util/jsx.ts @@ -0,0 +1,15 @@ +import { toJsxRuntime } from "hast-util-to-jsx-runtime" +import { QuartzPluginData } from "../plugins/vfile" +import { Node, Root } from "hast" +import { Fragment, jsx, jsxs } from "preact/jsx-runtime" +import { trace } from "./trace" +import { type FilePath } from "./path" + +export function htmlToJsx(fp: FilePath, tree: Node) { + try { + // @ts-ignore (preact makes it angry) + return toJsxRuntime(tree as Root, { Fragment, jsx, jsxs, elementAttributeNameCase: "html" }) + } catch (e) { + trace(`Failed to parse Markdown in \`${fp}\` into JSX`, e as Error) + } +} diff --git a/quartz/util/trace.ts b/quartz/util/trace.ts index c7f3cc339..a33135d64 100644 --- a/quartz/util/trace.ts +++ b/quartz/util/trace.ts @@ -4,7 +4,7 @@ import { isMainThread } from "workerpool" const rootFile = /.*at file:/ export function trace(msg: string, err: Error) { - const stack = err.stack + let stack = err.stack ?? "" const lines: string[] = [] @@ -12,15 +12,11 @@ export function trace(msg: string, err: Error) { lines.push( "\n" + chalk.bgRed.black.bold(" ERROR ") + - "\n" + + "\n\n" + chalk.red(` ${msg}`) + (err.message.length > 0 ? `: ${err.message}` : ""), ) - if (!stack) { - return - } - let reachedEndOfLegibleTrace = false for (const line of stack.split("\n").slice(1)) { if (reachedEndOfLegibleTrace) { From b7ae7a99dbd40ffc852642202031b29e98304c1f Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Sat, 21 Oct 2023 21:12:11 -0700 Subject: [PATCH 10/33] fix: styling for nested popover tag in page list --- quartz/components/TagList.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quartz/components/TagList.tsx b/quartz/components/TagList.tsx index cb1c121cf..b39b19947 100644 --- a/quartz/components/TagList.tsx +++ b/quartz/components/TagList.tsx @@ -36,7 +36,7 @@ TagList.css = ` justify-self: end; } -.section-ul .tags { +.section-li > .section > .tags { justify-content: flex-end; } From 7c01e8dde06abb1a80118b5eddce3e238830ede0 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Sun, 22 Oct 2023 09:54:12 -0700 Subject: [PATCH 11/33] feat: openLinksInNewTab option for link transformer --- quartz/components/scripts/spa.inline.ts | 1 + quartz/plugins/transformers/links.ts | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/quartz/components/scripts/spa.inline.ts b/quartz/components/scripts/spa.inline.ts index fc5aa7400..31ae14fcb 100644 --- a/quartz/components/scripts/spa.inline.ts +++ b/quartz/components/scripts/spa.inline.ts @@ -20,6 +20,7 @@ const isLocalUrl = (href: string) => { const getOpts = ({ target }: Event): { url: URL; scroll?: boolean } | undefined => { if (!isElement(target)) return + if (target.attributes.getNamedItem("target")?.value === "_blank") return const a = target.closest("a") if (!a) return if ("routerIgnore" in a.dataset) return diff --git a/quartz/plugins/transformers/links.ts b/quartz/plugins/transformers/links.ts index e050e00ad..8d16136f3 100644 --- a/quartz/plugins/transformers/links.ts +++ b/quartz/plugins/transformers/links.ts @@ -18,11 +18,13 @@ interface Options { markdownLinkResolution: TransformOptions["strategy"] /** Strips folders from a link so that it looks nice */ prettyLinks: boolean + openLinksInNewTab: boolean } const defaultOptions: Options = { markdownLinkResolution: "absolute", prettyLinks: true, + openLinksInNewTab: false, } export const CrawlLinks: QuartzTransformerPlugin | undefined> = (userOpts) => { @@ -52,6 +54,10 @@ export const CrawlLinks: QuartzTransformerPlugin | undefined> = node.properties.className ??= [] node.properties.className.push(isAbsoluteUrl(dest) ? "external" : "internal") + if (opts.openLinksInNewTab) { + node.properties.target = "_blank" + } + // don't process external links or intra-document anchors const isInternal = !(isAbsoluteUrl(dest) || dest.startsWith("#")) if (isInternal) { From 01fc8e46409ee0fb7311f212726113d35aced82d Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Wed, 25 Oct 2023 09:40:43 -0700 Subject: [PATCH 12/33] fix: disable semi-broken flexsearch cache --- quartz/components/scripts/search.inline.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/quartz/components/scripts/search.inline.ts b/quartz/components/scripts/search.inline.ts index a1c3e6ca2..eff4eb1b9 100644 --- a/quartz/components/scripts/search.inline.ts +++ b/quartz/components/scripts/search.inline.ts @@ -303,7 +303,6 @@ document.addEventListener("nav", async (e: unknown) => { // setup index if it hasn't been already if (!index) { index = new Document({ - cache: true, charset: "latin:extra", optimize: true, encode: encoder, From 06ccb89cd7d5a3cade1eb5c2155b9b06e5395b0b Mon Sep 17 00:00:00 2001 From: Blue Rose <134471273+bluerosegarden@users.noreply.github.com> Date: Tue, 31 Oct 2023 15:53:49 -0500 Subject: [PATCH 13/33] docs: clarifications about globs (#559) * Add note about fast-glob * Add warning about non-markdown files Also added a glob pattern to filter out all non-markdown files outside of a specified folder. * run npm format --------- Co-authored-by: wych --- docs/features/private pages.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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: From 05a1c34c6f6973eebcbcc50f50b64c2a0d62e8fa Mon Sep 17 00:00:00 2001 From: Florence <59734957+Pydes-boop@users.noreply.github.com> Date: Wed, 1 Nov 2023 17:57:32 +0100 Subject: [PATCH 14/33] docs: remove dead link (#561) --- docs/showcase.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/showcase.md b/docs/showcase.md index 6814dd06d..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/) From 923b72fb67cf3ee9842df630feaed72644470074 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Wed, 1 Nov 2023 10:03:45 -0700 Subject: [PATCH 15/33] feat: auto-tag releases (closes #560) --- .github/workflows/ci.yaml | 6 ++++++ 1 file changed, 6 insertions(+) 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" From a62a97c7abcabea4509760e5af957eed66fa0755 Mon Sep 17 00:00:00 2001 From: Emil Rofors Date: Fri, 3 Nov 2023 16:40:43 -0700 Subject: [PATCH 16/33] 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 17/33] 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 (
-