From 6be1ed1ea2ab6602f1d77d98cd9972aa391a5e7f Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Fri, 23 Feb 2024 17:45:41 -0800 Subject: [PATCH 01/35] docs(latex): mhchem --- docs/features/Latex.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/features/Latex.md b/docs/features/Latex.md index e019190e1..b2bdb2dfb 100644 --- a/docs/features/Latex.md +++ b/docs/features/Latex.md @@ -57,6 +57,15 @@ For example: - Incorrect: `I have $1 and you have $2` produces I have $1 and you have $2 - Correct: `I have \$1 and you have \$2` produces I have \$1 and you have \$2 +### Using mhchem + +Add the following import to the top of `quartz/plugins/transformers/latex.ts` (before all the other +imports): + +```ts title="quartz/plugins/transformers/latex.ts" +import "katex/contrib/mhchem" +``` + ## Customization Latex parsing is a functionality of the [[plugins/Latex|Latex]] plugin. See the plugin page for customization options. From a6417c447af8f0ff203ffb8730e53e4a7dfafb23 Mon Sep 17 00:00:00 2001 From: kabirgh <15871468+kabirgh@users.noreply.github.com> Date: Sat, 24 Feb 2024 02:40:42 +0000 Subject: [PATCH 02/35] fix(fast rebuild): handle added an deleted markdown correctly (#921) * Handle added files correctly * Handle deletes properly * addGraph renamed to mergeGraph --- quartz/build.ts | 33 +++++++++++++++++++++------------ quartz/depgraph.test.ts | 22 ++++++++++++++++++++++ quartz/depgraph.ts | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+), 12 deletions(-) diff --git a/quartz/build.ts b/quartz/build.ts index 3d95f315f..d72b8ddf4 100644 --- a/quartz/build.ts +++ b/quartz/build.ts @@ -185,9 +185,14 @@ async function partialRebuildFromEntrypoint( const emitterGraph = (await emitter.getDependencyGraph?.(ctx, processedFiles, staticResources)) ?? null - // emmiter may not define a dependency graph. nothing to update if so if (emitterGraph) { - dependencies[emitter.name]?.updateIncomingEdgesForNode(emitterGraph, fp) + const existingGraph = dependencies[emitter.name] + if (existingGraph !== null) { + existingGraph.mergeGraph(emitterGraph) + } else { + // might be the first time we're adding a mardown file + dependencies[emitter.name] = emitterGraph + } } } break @@ -224,7 +229,6 @@ async function partialRebuildFromEntrypoint( // EMIT perf.addEvent("rebuild") let emittedFiles = 0 - const destinationsToDelete = new Set() for (const emitter of cfg.plugins.emitters) { const depGraph = dependencies[emitter.name] @@ -264,11 +268,6 @@ async function partialRebuildFromEntrypoint( // and supply [a.md, b.md] to the emitter const upstreams = [...depGraph.getLeafNodeAncestors(fp)] as FilePath[] - if (action === "delete" && upstreams.length === 1) { - // if there's only one upstream, the destination is solely dependent on this file - destinationsToDelete.add(upstreams[0]) - } - const upstreamContent = upstreams // filter out non-markdown files .filter((file) => contentMap.has(file)) @@ -291,14 +290,24 @@ async function partialRebuildFromEntrypoint( console.log(`Emitted ${emittedFiles} files to \`${argv.output}\` in ${perf.timeSince("rebuild")}`) // CLEANUP - // delete files that are solely dependent on this file - await rimraf([...destinationsToDelete]) + const destinationsToDelete = new Set() for (const file of toRemove) { // remove from cache contentMap.delete(file) - // remove the node from dependency graphs - Object.values(dependencies).forEach((depGraph) => depGraph?.removeNode(file)) + Object.values(dependencies).forEach((depGraph) => { + // remove the node from dependency graphs + depGraph?.removeNode(file) + // remove any orphan nodes. eg if a.md is deleted, a.html is orphaned and should be removed + const orphanNodes = depGraph?.removeOrphanNodes() + orphanNodes?.forEach((node) => { + // only delete files that are in the output directory + if (node.startsWith(argv.output)) { + destinationsToDelete.add(node) + } + }) + }) } + await rimraf([...destinationsToDelete]) toRemove.clear() release() diff --git a/quartz/depgraph.test.ts b/quartz/depgraph.test.ts index 43eb4024f..062f13e35 100644 --- a/quartz/depgraph.test.ts +++ b/quartz/depgraph.test.ts @@ -39,6 +39,28 @@ describe("DepGraph", () => { }) }) + describe("mergeGraph", () => { + test("merges two graphs", () => { + const graph = new DepGraph() + graph.addEdge("A.md", "A.html") + + const other = new DepGraph() + other.addEdge("B.md", "B.html") + + graph.mergeGraph(other) + + const expected = { + nodes: ["A.md", "A.html", "B.md", "B.html"], + edges: [ + ["A.md", "A.html"], + ["B.md", "B.html"], + ], + } + + assert.deepStrictEqual(graph.export(), expected) + }) + }) + describe("updateIncomingEdgesForNode", () => { test("merges when node exists", () => { // A.md -> B.md -> B.html diff --git a/quartz/depgraph.ts b/quartz/depgraph.ts index 1efad0770..3d048cd83 100644 --- a/quartz/depgraph.ts +++ b/quartz/depgraph.ts @@ -39,12 +39,26 @@ export default class DepGraph { } } + // Remove node and all edges connected to it removeNode(node: T): void { if (this._graph.has(node)) { + // first remove all edges so other nodes don't have references to this node + for (const target of this._graph.get(node)!.outgoing) { + this.removeEdge(node, target) + } + for (const source of this._graph.get(node)!.incoming) { + this.removeEdge(source, node) + } this._graph.delete(node) } } + forEachNode(callback: (node: T) => void): void { + for (const node of this._graph.keys()) { + callback(node) + } + } + hasEdge(from: T, to: T): boolean { return Boolean(this._graph.get(from)?.outgoing.has(to)) } @@ -92,6 +106,15 @@ export default class DepGraph { // DEPENDENCY ALGORITHMS + // Add all nodes and edges from other graph to this graph + mergeGraph(other: DepGraph): void { + other.forEachEdge(([source, target]) => { + this.addNode(source) + this.addNode(target) + this.addEdge(source, target) + }) + } + // For the node provided: // If node does not exist, add it // If an incoming edge was added in other, it is added in this graph @@ -112,6 +135,24 @@ export default class DepGraph { }) } + // Remove all nodes that do not have any incoming or outgoing edges + // A node may be orphaned if the only node pointing to it was removed + removeOrphanNodes(): Set { + let orphanNodes = new Set() + + this.forEachNode((node) => { + if (this.inDegree(node) === 0 && this.outDegree(node) === 0) { + orphanNodes.add(node) + } + }) + + orphanNodes.forEach((node) => { + this.removeNode(node) + }) + + return orphanNodes + } + // Get all leaf nodes (i.e. destination paths) reachable from the node provided // Eg. if the graph is A -> B -> C // D ---^ From 2c74b05d1be573ca953f5331ab8f99c70dbf3a59 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Fri, 23 Feb 2024 18:48:19 -0800 Subject: [PATCH 03/35] fix(ci): autotag --- .github/workflows/ci.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9b1622cb8..9ef278667 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -47,7 +47,7 @@ jobs: run: npx quartz build --bundleInfo - name: Create release tag - uses: Klemensas/action-autotag@stable + uses: phish108/autotag-action@v1.1.55 with: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - tag_prefix: "v" + github-token: ${{ secrets.GITHUB_TOKEN}} + with-v: "true" From ea7122dd5a45db6b749045a626de5a0096819edd Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Fri, 23 Feb 2024 18:52:28 -0800 Subject: [PATCH 04/35] pkg: bump to 4.2.3 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index dc020fc83..50ab83778 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@jackyzha0/quartz", - "version": "4.2.2", + "version": "4.2.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@jackyzha0/quartz", - "version": "4.2.2", + "version": "4.2.3", "license": "MIT", "dependencies": { "@clack/prompts": "^0.7.0", diff --git a/package.json b/package.json index 094e62ae4..787c37d70 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@jackyzha0/quartz", "description": "🌱 publish your digital garden and notes as a website", "private": true, - "version": "4.2.2", + "version": "4.2.3", "type": "module", "author": "jackyzha0 ", "license": "MIT", From d0c0daa4aa6fc4db4be2371f460f22eb3764c457 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Fri, 23 Feb 2024 19:00:47 -0800 Subject: [PATCH 05/35] ci: fix autotag --- .github/workflows/ci.yaml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9ef278667..1037f5e79 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -46,8 +46,14 @@ jobs: - name: Ensure Quartz builds, check bundle info run: npx quartz build --bundleInfo + - name: Get package version + run: node -p -e '`PACKAGE_VERSION=${require("./package.json").version}`' >> $GITHUB_ENV + - name: Create release tag - uses: phish108/autotag-action@v1.1.55 + uses: pkgdeps/git-tag-action@v2 with: - github-token: ${{ secrets.GITHUB_TOKEN}} - with-v: "true" + github_token: ${{ secrets.GITHUB_TOKEN }} + github_repo: ${{ github.repository }} + version: ${{ env.PACKAGE_VERSION }} + git_commit_sha: ${{ github.sha }} + git_tag_prefix: "v" From c53fd5b56fb5a4a09df0a6dc8ff115b510f25d25 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Fri, 23 Feb 2024 19:04:38 -0800 Subject: [PATCH 06/35] ci: tag as a separate step --- .github/workflows/ci.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1037f5e79..edd52b99a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -46,6 +46,12 @@ jobs: - name: Ensure Quartz builds, check bundle info run: npx quartz build --bundleInfo + publish-tag: + if: ${{ github.repository == 'jackyzha0/quartz' }} + run-on: ubuntu-latest + permissions: + contents: write + steps: - name: Get package version run: node -p -e '`PACKAGE_VERSION=${require("./package.json").version}`' >> $GITHUB_ENV From b88d3d292beaa0cd03e72a4fc1b84c7bc1d39e9e Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Fri, 23 Feb 2024 19:05:26 -0800 Subject: [PATCH 07/35] ci: fix typo in runs-on --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index edd52b99a..9bf34a9c7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -48,7 +48,7 @@ jobs: publish-tag: if: ${{ github.repository == 'jackyzha0/quartz' }} - run-on: ubuntu-latest + runs-on: ubuntu-latest permissions: contents: write steps: From 67647d9167c4f8aefc25a864f14248d88d33eac5 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Fri, 23 Feb 2024 19:08:39 -0800 Subject: [PATCH 08/35] ci: also checkout and install node before tagging --- .github/workflows/ci.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9bf34a9c7..56107cf49 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -52,9 +52,15 @@ jobs: permissions: contents: write steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup Node + uses: actions/setup-node@v3 + 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 with: From 2f10da776689a1dc83ed74d53af9d1615d705dc3 Mon Sep 17 00:00:00 2001 From: Aaron Pham <29749331+aarnphm@users.noreply.github.com> Date: Sun, 25 Feb 2024 12:00:26 -0500 Subject: [PATCH 09/35] docs: fix tag page oops (#925) --- docs/plugins/TagPage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/plugins/TagPage.md b/docs/plugins/TagPage.md index 4dabfd06c..cd7dee609 100644 --- a/docs/plugins/TagPage.md +++ b/docs/plugins/TagPage.md @@ -16,5 +16,5 @@ The pages are displayed using the `defaultListPageLayout` in `quartz.layouts.ts` ## API - Category: Emitter -- Function name: `Plugin.AliasRedirects()`. +- Function name: `Plugin.TagPage()`. - Source: [`quartz/plugins/emitters/tagPage.tsx`](https://github.com/jackyzha0/quartz/blob/v4/quartz/plugins/emitters/tagPage.tsx). From d6e79d1ea6ace4e70b1813a63c5060c89681a2ad Mon Sep 17 00:00:00 2001 From: Aaron Pham <29749331+aarnphm@users.noreply.github.com> Date: Sun, 25 Feb 2024 19:58:21 -0500 Subject: [PATCH 10/35] chore(types): update correct annotations for pages (#928) --- quartz/components/pages/404.tsx | 4 ++-- quartz/components/pages/Content.tsx | 4 ++-- quartz/components/pages/FolderContent.tsx | 4 ++-- quartz/components/pages/TagContent.tsx | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/quartz/components/pages/404.tsx b/quartz/components/pages/404.tsx index 276d5e561..4ef1b912c 100644 --- a/quartz/components/pages/404.tsx +++ b/quartz/components/pages/404.tsx @@ -1,7 +1,7 @@ import { i18n } from "../../i18n" -import { QuartzComponentConstructor, QuartzComponentProps } from "../types" +import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "../types" -function NotFound({ cfg }: QuartzComponentProps) { +const NotFound: QuartzComponent = ({ cfg }: QuartzComponentProps) => { return (

404

diff --git a/quartz/components/pages/Content.tsx b/quartz/components/pages/Content.tsx index 2e6416f66..8222d786e 100644 --- a/quartz/components/pages/Content.tsx +++ b/quartz/components/pages/Content.tsx @@ -1,7 +1,7 @@ import { htmlToJsx } from "../../util/jsx" -import { QuartzComponentConstructor, QuartzComponentProps } from "../types" +import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "../types" -function Content({ fileData, tree }: QuartzComponentProps) { +const Content: QuartzComponent = ({ fileData, tree }: QuartzComponentProps) => { const content = htmlToJsx(fileData.filePath!, tree) const classes: string[] = fileData.frontmatter?.cssclasses ?? [] const classString = ["popover-hint", ...classes].join(" ") diff --git a/quartz/components/pages/FolderContent.tsx b/quartz/components/pages/FolderContent.tsx index d3f28ddf1..55f1e427d 100644 --- a/quartz/components/pages/FolderContent.tsx +++ b/quartz/components/pages/FolderContent.tsx @@ -1,4 +1,4 @@ -import { QuartzComponentConstructor, QuartzComponentProps } from "../types" +import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "../types" import path from "path" import style from "../styles/listPage.scss" @@ -22,7 +22,7 @@ const defaultOptions: FolderContentOptions = { export default ((opts?: Partial) => { const options: FolderContentOptions = { ...defaultOptions, ...opts } - function FolderContent(props: QuartzComponentProps) { + const FolderContent: QuartzComponent = (props: QuartzComponentProps) => { const { tree, fileData, allFiles, cfg } = props const folderSlug = stripSlashes(simplifySlug(fileData.slug!)) const allPagesInFolder = allFiles.filter((file) => { diff --git a/quartz/components/pages/TagContent.tsx b/quartz/components/pages/TagContent.tsx index 22f6bb25d..1dd912471 100644 --- a/quartz/components/pages/TagContent.tsx +++ b/quartz/components/pages/TagContent.tsx @@ -1,4 +1,4 @@ -import { QuartzComponentConstructor, QuartzComponentProps } from "../types" +import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "../types" import style from "../styles/listPage.scss" import { PageList } from "../PageList" import { FullSlug, getAllSegmentPrefixes, simplifySlug } from "../../util/path" @@ -8,7 +8,7 @@ import { htmlToJsx } from "../../util/jsx" import { i18n } from "../../i18n" const numPages = 10 -function TagContent(props: QuartzComponentProps) { +const TagContent: QuartzComponent = (props: QuartzComponentProps) => { const { tree, fileData, allFiles, cfg } = props const slug = fileData.slug From 6b90d03ca66e9b4b7096dd04ff74b1503a9bb7ca Mon Sep 17 00:00:00 2001 From: Aaron Pham <29749331+aarnphm@users.noreply.github.com> Date: Mon, 26 Feb 2024 12:53:45 -0500 Subject: [PATCH 11/35] chore(type): export attribute for theme key (#933) Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com> --- quartz/util/theme.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/quartz/util/theme.ts b/quartz/util/theme.ts index bd0da5fb0..49cc9cce8 100644 --- a/quartz/util/theme.ts +++ b/quartz/util/theme.ts @@ -9,6 +9,11 @@ export interface ColorScheme { highlight: string } +interface Colors { + lightMode: ColorScheme + darkMode: ColorScheme +} + export interface Theme { typography: { header: string @@ -16,12 +21,11 @@ export interface Theme { code: string } cdnCaching: boolean - colors: { - lightMode: ColorScheme - darkMode: ColorScheme - } + colors: Colors } +export type ThemeKey = keyof Colors + const DEFAULT_SANS_SERIF = '-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif' const DEFAULT_MONO = "ui-monospace, SFMono-Regular, SF Mono, Menlo, monospace" From 4957eaa2d02c3987d825487f46e5a74bfbba7601 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Feb 2024 16:17:42 -0500 Subject: [PATCH 12/35] chore(deps): bump preact from 10.19.5 to 10.19.6 (#935) Bumps [preact](https://github.com/preactjs/preact) from 10.19.5 to 10.19.6. - [Release notes](https://github.com/preactjs/preact/releases) - [Commits](https://github.com/preactjs/preact/compare/10.19.5...10.19.6) --- updated-dependencies: - dependency-name: preact dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 50ab83778..9ee42ff4c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,7 +32,7 @@ "mdast-util-to-hast": "^13.1.0", "mdast-util-to-string": "^4.0.0", "micromorph": "^0.4.5", - "preact": "^10.19.5", + "preact": "^10.19.6", "preact-render-to-string": "^6.3.1", "pretty-bytes": "^6.1.1", "pretty-time": "^1.1.0", @@ -4459,9 +4459,9 @@ } }, "node_modules/preact": { - "version": "10.19.5", - "resolved": "https://registry.npmjs.org/preact/-/preact-10.19.5.tgz", - "integrity": "sha512-OPELkDmSVbKjbFqF9tgvOowiiQ9TmsJljIzXRyNE8nGiis94pwv1siF78rQkAP1Q1738Ce6pellRg/Ns/CtHqQ==", + "version": "10.19.6", + "resolved": "https://registry.npmjs.org/preact/-/preact-10.19.6.tgz", + "integrity": "sha512-gympg+T2Z1fG1unB8NH29yHJwnEaCH37Z32diPDku316OTnRPeMbiRV9kTrfZpocXjdfnWuFUl/Mj4BHaf6gnw==", "funding": { "type": "opencollective", "url": "https://opencollective.com/preact" diff --git a/package.json b/package.json index 787c37d70..492377bb8 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "mdast-util-to-hast": "^13.1.0", "mdast-util-to-string": "^4.0.0", "micromorph": "^0.4.5", - "preact": "^10.19.5", + "preact": "^10.19.6", "preact-render-to-string": "^6.3.1", "pretty-bytes": "^6.1.1", "pretty-time": "^1.1.0", From 66a5855fad8ece898cf64460a74e0f7ef6f3b23f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Feb 2024 13:54:15 -0800 Subject: [PATCH 13/35] chore(deps): bump chokidar from 3.5.3 to 3.6.0 (#937) Bumps [chokidar](https://github.com/paulmillr/chokidar) from 3.5.3 to 3.6.0. - [Release notes](https://github.com/paulmillr/chokidar/releases) - [Commits](https://github.com/paulmillr/chokidar/compare/3.5.3...3.6.0) --- updated-dependencies: - dependency-name: chokidar dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 17 +++++++---------- package.json | 2 +- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9ee42ff4c..7e71a1d30 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "@napi-rs/simple-git": "0.1.16", "async-mutex": "^0.4.1", "chalk": "^5.3.0", - "chokidar": "^3.5.3", + "chokidar": "^3.6.0", "cli-spinner": "^0.2.10", "d3": "^7.8.5", "esbuild-sass-plugin": "^2.16.1", @@ -1344,15 +1344,9 @@ } }, "node_modules/chokidar": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", @@ -1365,6 +1359,9 @@ "engines": { "node": ">= 8.10.0" }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, "optionalDependencies": { "fsevents": "~2.3.2" } diff --git a/package.json b/package.json index 492377bb8..ef623a0fb 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "@napi-rs/simple-git": "0.1.16", "async-mutex": "^0.4.1", "chalk": "^5.3.0", - "chokidar": "^3.5.3", + "chokidar": "^3.6.0", "cli-spinner": "^0.2.10", "d3": "^7.8.5", "esbuild-sass-plugin": "^2.16.1", From b9dee0775cda4bb29da1a5fb5b000ddcd4dc1f6e Mon Sep 17 00:00:00 2001 From: kon-foo <25391223+kon-foo@users.noreply.github.com> Date: Mon, 26 Feb 2024 22:55:47 +0100 Subject: [PATCH 14/35] docs: Clarifications in the Explorer Docs (#938) add example to filter by tags. --- docs/features/explorer.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/features/explorer.md b/docs/features/explorer.md index a2acb861a..95878f787 100644 --- a/docs/features/explorer.md +++ b/docs/features/explorer.md @@ -61,7 +61,7 @@ export class FileNode { children: FileNode[] // children of current node name: string // last part of slug displayName: string // what actually should be displayed in the explorer - file: QuartzPluginData | null // set if node is a file, see `QuartzPluginData` for more detail + file: QuartzPluginData | null // if node is a file, this is the file's metadata. See `QuartzPluginData` for more detail depth: number // depth of current node ... // rest of implementation @@ -167,6 +167,19 @@ Component.Explorer({ You can customize this by changing the entries of the `omit` set. Simply add all folder or file names you want to remove. +### Remove files by tag + +You can access the frontmatter of a file by `node.file?.frontmatter?`. This allows you to filter out files based on their frontmatter, for example by their tags. + +```ts title="quartz.layout.ts" +Component.Explorer({ + filterFn: (node) => { + // exclude files with the tag "explorerexclude" + return node.file?.frontmatter?.tags?.includes("explorerexclude") !== true + }, +}) +``` + ### Show every element in explorer To override the default filter function that removes the `tags` folder from the explorer, you can set the filter function to `undefined`. From f200a0be22405f1a5b03ddbc173d6174bff3a0ba Mon Sep 17 00:00:00 2001 From: kon-foo <25391223+kon-foo@users.noreply.github.com> Date: Tue, 27 Feb 2024 17:05:28 +0100 Subject: [PATCH 15/35] fix: correct umami host for self-hosted (#939) * fixed umami script path for self-hosted version * Update quartz/plugins/emitters/componentResources.ts Co-authored-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> --------- Co-authored-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> --- 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 046841689..1b6e13a40 100644 --- a/quartz/plugins/emitters/componentResources.ts +++ b/quartz/plugins/emitters/componentResources.ts @@ -120,7 +120,7 @@ function addGlobalPageResources( } else if (cfg.analytics?.provider === "umami") { componentResources.afterDOMLoaded.push(` const umamiScript = document.createElement("script") - umamiScript.src = "${cfg.analytics.host}" ?? "https://analytics.umami.is/script.js" + umamiScript.src = "${cfg.analytics.host ?? "https://analytics.umami.is"}/script.js" umamiScript.setAttribute("data-website-id", "${cfg.analytics.websiteId}") umamiScript.async = true From 1c42b6365cab71e1400e94178d39a7592aa47726 Mon Sep 17 00:00:00 2001 From: HakuGuen <80277109+HakuGuen@users.noreply.github.com> Date: Thu, 29 Feb 2024 16:14:20 -0800 Subject: [PATCH 16/35] feat(i18n): add Vietnamese translation (#950) --- quartz/i18n/index.ts | 2 + quartz/i18n/locales/vi-VN.ts | 83 ++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 quartz/i18n/locales/vi-VN.ts diff --git a/quartz/i18n/index.ts b/quartz/i18n/index.ts index 38d356280..b97368d96 100644 --- a/quartz/i18n/index.ts +++ b/quartz/i18n/index.ts @@ -12,6 +12,7 @@ import uk from "./locales/uk-UA" import ru from "./locales/ru-RU" import ko from "./locales/ko-KR" import zh from "./locales/zh-CN" +import vi from "./locales/vi-VN" export const TRANSLATIONS = { "en-US": en, @@ -48,6 +49,7 @@ export const TRANSLATIONS = { "ru-RU": ru, "ko-KR": ko, "zh-CN": zh, + "vi-VN": vi, } as const export const defaultTranslation = "en-US" diff --git a/quartz/i18n/locales/vi-VN.ts b/quartz/i18n/locales/vi-VN.ts new file mode 100644 index 000000000..b72ced4ac --- /dev/null +++ b/quartz/i18n/locales/vi-VN.ts @@ -0,0 +1,83 @@ +import { Translation } from "./definition" + +export default { + propertyDefaults: { + title: "Không có tiêu đề", + description: "Không có mô tả được cung cấp", + }, + components: { + callout: { + note: "Ghi Chú", + abstract: "Tóm Tắt", + info: "Thông tin", + todo: "Cần Làm", + tip: "Gợi Ý", + success: "Thành Công", + question: "Nghi Vấn", + warning: "Cảnh Báo", + failure: "Thất Bại", + danger: "Nguy Hiểm", + bug: "Lỗi", + example: "Ví Dụ", + quote: "Trích Dẫn", + }, + backlinks: { + title: "Liên Kết Ngược", + noBacklinksFound: "Không có liên kết ngược được tìm thấy", + }, + themeToggle: { + lightMode: "Sáng", + darkMode: "Tối", + }, + explorer: { + title: "Trong bài này", + }, + footer: { + createdWith: "Được tạo bởi", + }, + graph: { + title: "Biểu Đồ", + }, + recentNotes: { + title: "Bài viết gần đây", + seeRemainingMore: ({ remaining }) => `Xem ${remaining} thêm →`, + }, + transcludes: { + transcludeOf: ({ targetSlug }) => `Bao gồm ${targetSlug}`, + linkToOriginal: "Liên Kết Gốc", + }, + search: { + title: "Tìm Kiếm", + searchBarPlaceholder: "Tìm kiếm thông tin", + }, + tableOfContents: { + title: "Bảng Nội Dung", + }, + contentMeta: { + readingTime: ({ minutes }) => `đọc ${minutes} phút`, + }, + }, + pages: { + rss: { + recentNotes: "Những bài gần đây", + lastFewNotes: ({ count }) => `${count} Bài gần đây`, + }, + error: { + title: "Không Tìm Thấy", + notFound: "Trang này được bảo mật hoặc không tồn tại.", + }, + folderContent: { + folder: "Thư Mục", + itemsUnderFolder: ({ count }) => + count === 1 ? "1 mục trong thư mục này." : `${count} mục trong thư mục này.`, + }, + tagContent: { + tag: "Thẻ", + tagIndex: "Thẻ Mục Lục", + itemsUnderTag: ({ count }) => + count === 1 ? "1 mục gắn thẻ này." : `${count} mục gắn thẻ này.`, + showingFirst: ({ count }) => `Hiển thị trước ${count} thẻ.`, + totalTags: ({ count }) => `Tìm thấy ${count} thẻ tổng cộng.`, + }, + }, +} as const satisfies Translation From 018c6358c4c00be319ccc00df84f9be02e7845b4 Mon Sep 17 00:00:00 2001 From: Aaron Pham <29749331+aarnphm@users.noreply.github.com> Date: Sun, 3 Mar 2024 13:39:29 -0500 Subject: [PATCH 17/35] fix(callout): reorder the plugins to render latex on callout title (closes #952) (#934) Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com> --- quartz.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quartz.config.ts b/quartz.config.ts index 2cdadb740..a2eb605c0 100644 --- a/quartz.config.ts +++ b/quartz.config.ts @@ -55,6 +55,7 @@ const config: QuartzConfig = { Plugin.CreatedModifiedDate({ priority: ["frontmatter", "filesystem"], }), + Plugin.ObsidianFlavoredMarkdown({ enableInHtmlEmbed: false }), Plugin.Latex({ renderEngine: "katex" }), Plugin.SyntaxHighlighting({ theme: { @@ -63,7 +64,6 @@ const config: QuartzConfig = { }, keepBackground: false, }), - Plugin.ObsidianFlavoredMarkdown({ enableInHtmlEmbed: false }), Plugin.GitHubFlavoredMarkdown(), Plugin.TableOfContents(), Plugin.CrawlLinks({ markdownLinkResolution: "shortest" }), From 566f3cf9f81a597c28f6bdc4deef912ac95e8f34 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 3 Mar 2024 11:27:54 -0800 Subject: [PATCH 18/35] chore(deps): bump remark-smartypants from 2.0.0 to 2.1.0 (#755) Bumps [remark-smartypants](https://github.com/silvenon/remark-smartypants) from 2.0.0 to 2.1.0. - [Release notes](https://github.com/silvenon/remark-smartypants/releases) - [Commits](https://github.com/silvenon/remark-smartypants/compare/v2.0.0...v2.1.0) --- updated-dependencies: - dependency-name: remark-smartypants dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 26 ++++++-------------------- package.json | 2 +- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7e71a1d30..c720b7f8c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -50,7 +50,7 @@ "remark-math": "^6.0.0", "remark-parse": "^11.0.0", "remark-rehype": "^11.1.0", - "remark-smartypants": "^2.0.0", + "remark-smartypants": "^2.1.0", "rfdc": "^1.3.1", "rimraf": "^5.0.5", "serve-handler": "^6.1.5", @@ -4866,32 +4866,18 @@ } }, "node_modules/remark-smartypants": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/remark-smartypants/-/remark-smartypants-2.0.0.tgz", - "integrity": "sha512-Rc0VDmr/yhnMQIz8n2ACYXlfw/P/XZev884QU1I5u+5DgJls32o97Vc1RbK3pfumLsJomS2yy8eT4Fxj/2MDVA==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/remark-smartypants/-/remark-smartypants-2.1.0.tgz", + "integrity": "sha512-qoF6Vz3BjU2tP6OfZqHOvCU0ACmu/6jhGaINSQRI9mM7wCxNQTKB3JUAN4SVoN2ybElEDTxBIABRep7e569iJw==", "dependencies": { "retext": "^8.1.0", - "retext-smartypants": "^5.1.0", - "unist-util-visit": "^4.1.0" + "retext-smartypants": "^5.2.0", + "unist-util-visit": "^5.0.0" }, "engines": { "node": "^12.20.0 || ^14.13.1 || >=16.0.0" } }, - "node_modules/remark-smartypants/node_modules/unist-util-visit": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.1.2.tgz", - "integrity": "sha512-MSd8OUGISqHdVvfY9TPhyK2VdUrPgxkUtWSuMHF6XAAFuL4LokseigBnZtPnJMu+FbynTkFNnFlyjxpVKujMRg==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.1.1" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-stringify": { "version": "11.0.0", "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-11.0.0.tgz", diff --git a/package.json b/package.json index ef623a0fb..38b0ca6a7 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "remark-math": "^6.0.0", "remark-parse": "^11.0.0", "remark-rehype": "^11.1.0", - "remark-smartypants": "^2.0.0", + "remark-smartypants": "^2.1.0", "rfdc": "^1.3.1", "rimraf": "^5.0.5", "serve-handler": "^6.1.5", From 2a7e61ae2a0d0e1a479923f5664635d110e470c3 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Sun, 3 Mar 2024 12:31:55 -0800 Subject: [PATCH 19/35] feat: support transcluding codeblocks and blockquotes (closes #940) --- quartz/plugins/transformers/ofm.ts | 36 ++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/quartz/plugins/transformers/ofm.ts b/quartz/plugins/transformers/ofm.ts index fab7cf894..237d683a7 100644 --- a/quartz/plugins/transformers/ofm.ts +++ b/quartz/plugins/transformers/ofm.ts @@ -1,5 +1,5 @@ import { QuartzTransformerPlugin } from "../types" -import { Blockquote, Root, Html, BlockContent, DefinitionContent, Paragraph, Code } from "mdast" +import { Root, Html, BlockContent, DefinitionContent, Paragraph, Code } from "mdast" import { Element, Literal, Root as HtmlRoot } from "hast" import { ReplaceFunction, findAndReplace as mdastFindReplace } from "mdast-util-find-and-replace" import { slug as slugAnchor } from "github-slugger" @@ -17,7 +17,6 @@ import { toHtml } from "hast-util-to-html" import { PhrasingContent } from "mdast-util-find-and-replace/lib" import { capitalize } from "../../util/lang" import { PluggableList } from "unified" -import { ValidCallout, i18n } from "../../i18n" export interface Options { comments: boolean @@ -528,12 +527,35 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin last.value = last.value.slice(0, -matches[0].length) const block = matches[0].slice(1) - if (!Object.keys(file.data.blocks!).includes(block)) { - node.properties = { - ...node.properties, - id: block, + if (last.value === "") { + // this is an inline block ref but the actual block + // is the previous element above it + let idx = (index ?? 1) - 1 + while (idx >= 0) { + const element = parent?.children.at(idx) + if (!element) break + if (element.type !== "element") { + idx -= 1 + } else { + if (!Object.keys(file.data.blocks!).includes(block)) { + element.properties = { + ...element.properties, + id: block, + } + file.data.blocks![block] = element + } + return + } + } + } else { + // normal paragraph transclude + if (!Object.keys(file.data.blocks!).includes(block)) { + node.properties = { + ...node.properties, + id: block, + } + file.data.blocks![block] = node } - file.data.blocks![block] = node } } } From bd05950c2db1335b68c8e1701385219e681a4241 Mon Sep 17 00:00:00 2001 From: sventec Date: Sun, 3 Mar 2024 19:40:42 -0500 Subject: [PATCH 20/35] fix(docs): correct ExplicitPublish as filters instead of transformers (#953) --- docs/configuration.md | 4 ++-- docs/plugins/ExplicitPublish.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index 6c7665492..500e4c1cc 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -73,10 +73,10 @@ You can customize the behaviour of Quartz by adding, removing and reordering plu > [!note] > Each node is modified by every transformer _in order_. Some transformers are position sensitive, so you may need to pay particular attention to whether they need to come before or after certain other plugins. -You should take care to add the plugin to the right entry corresponding to its plugin type. For example, to add the [[ExplicitPublish]] plugin (a [[tags/plugin/transformer|Transformer]], you would add the following line: +You should take care to add the plugin to the right entry corresponding to its plugin type. For example, to add the [[ExplicitPublish]] plugin (a [[tags/plugin/filter|Filter]]), you would add the following line: ```ts title="quartz.config.ts" -transformers: [ +filters: [ ... Plugin.ExplicitPublish(), ... diff --git a/docs/plugins/ExplicitPublish.md b/docs/plugins/ExplicitPublish.md index 7ef2dd4d0..7c7aceb65 100644 --- a/docs/plugins/ExplicitPublish.md +++ b/docs/plugins/ExplicitPublish.md @@ -13,6 +13,6 @@ This plugin has no configuration options. ## API -- Category: Emitter +- Category: Filter - Function name: `Plugin.ExplicitPublish()`. - Source: [`quartz/plugins/filters/explicit.ts`](https://github.com/jackyzha0/quartz/blob/v4/quartz/plugins/filters/explicit.ts). From bcb5b2df09cb8c8fc0736ec476b2486f9b4643be Mon Sep 17 00:00:00 2001 From: Emile Bangma Date: Mon, 4 Mar 2024 18:52:28 +0100 Subject: [PATCH 21/35] feat(frontmatter): configure max length for description (#946) * Sentence length check * Replace external links with domain name. * Updated documentation. * Updated replacement values. * Updated Regex based on feedback. * Check description for undefined * Updated external url transform regex. * Updated formatting --- docs/plugins/Description.md | 1 + quartz/plugins/transformers/description.ts | 43 ++++++++++++++++++---- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/docs/plugins/Description.md b/docs/plugins/Description.md index 6849b3ca4..526bb0175 100644 --- a/docs/plugins/Description.md +++ b/docs/plugins/Description.md @@ -14,6 +14,7 @@ If the frontmatter contains a `description` property, it is used (see [[authorin This plugin accepts the following configuration options: - `descriptionLength`: the maximum length of the generated description. Default is 150 characters. The cut off happens after the first _sentence_ that ends after the given length. +- `replaceExternalLinks`: If `true` (default), replace external links with their domain and path in the description (e.g. `https://domain.tld/some_page/another_page?query=hello&target=world` is replaced with `domain.tld/some_page/another_page`). ## API diff --git a/quartz/plugins/transformers/description.ts b/quartz/plugins/transformers/description.ts index 884d5b189..0f8cd8d39 100644 --- a/quartz/plugins/transformers/description.ts +++ b/quartz/plugins/transformers/description.ts @@ -5,12 +5,19 @@ import { escapeHTML } from "../../util/escape" export interface Options { descriptionLength: number + replaceExternalLinks: boolean } const defaultOptions: Options = { descriptionLength: 150, + replaceExternalLinks: true, } +const urlRegex = new RegExp( + /(https?:\/\/)?(?([\da-z\.-]+)\.([a-z\.]{2,6})(:\d+)?)(?[\/\w\.-]*)(\?[\/\w\.=&;-]*)?/, + "g", +) + export const Description: QuartzTransformerPlugin | undefined> = (userOpts) => { const opts = { ...defaultOptions, ...userOpts } return { @@ -19,19 +26,39 @@ export const Description: QuartzTransformerPlugin | undefined> return [ () => { return async (tree: HTMLRoot, file) => { - const frontMatterDescription = file.data.frontmatter?.description - const text = escapeHTML(toString(tree)) + let frontMatterDescription = file.data.frontmatter?.description + let text = escapeHTML(toString(tree)) + + if (opts.replaceExternalLinks) { + frontMatterDescription = frontMatterDescription?.replace( + urlRegex, + "$" + "$", + ) + text = text.replace(urlRegex, "$" + "$") + } const desc = frontMatterDescription ?? text - const sentences = desc.replace(/\s+/g, " ").split(".") + const sentences = desc.replace(/\s+/g, " ").split(/\.\s/) let finalDesc = "" let sentenceIdx = 0 const len = opts.descriptionLength - while (finalDesc.length < len) { - const sentence = sentences[sentenceIdx] - if (!sentence) break - finalDesc += sentence + "." - sentenceIdx++ + + if (sentences[0] !== undefined && sentences[0].length >= len) { + const firstSentence = sentences[0].split(" ") + while (finalDesc.length < len) { + const sentence = firstSentence[sentenceIdx] + if (!sentence) break + finalDesc += sentence + " " + sentenceIdx++ + } + finalDesc = finalDesc.trimEnd() + "..." + } else { + while (finalDesc.length < len) { + const sentence = sentences[sentenceIdx] + if (!sentence) break + finalDesc += sentence.endsWith(".") ? sentence : sentence + "." + sentenceIdx++ + } } file.data.description = finalDesc From cec3662c748ff6abbe8570632e9287085a2a51fc Mon Sep 17 00:00:00 2001 From: Aaron Pham <29749331+aarnphm@users.noreply.github.com> Date: Mon, 4 Mar 2024 15:09:20 -0500 Subject: [PATCH 22/35] feat(graph): focusOnHover (#954) by default, globalGraph will enable focusOnHover, similar to Obsidian. --------- Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com> --- quartz/components/Graph.tsx | 3 +++ quartz/components/scripts/graph.inline.ts | 27 ++++++++++++++++++----- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/quartz/components/Graph.tsx b/quartz/components/Graph.tsx index 40ab43a2d..f7ebcc9a2 100644 --- a/quartz/components/Graph.tsx +++ b/quartz/components/Graph.tsx @@ -17,6 +17,7 @@ export interface D3Config { opacityScale: number removeTags: string[] showTags: boolean + focusOnHover?: boolean } interface GraphOptions { @@ -37,6 +38,7 @@ const defaultOptions: GraphOptions = { opacityScale: 1, showTags: true, removeTags: [], + focusOnHover: false, }, globalGraph: { drag: true, @@ -50,6 +52,7 @@ const defaultOptions: GraphOptions = { opacityScale: 1, showTags: true, removeTags: [], + focusOnHover: true, }, } diff --git a/quartz/components/scripts/graph.inline.ts b/quartz/components/scripts/graph.inline.ts index c991e163e..1c9bb5d64 100644 --- a/quartz/components/scripts/graph.inline.ts +++ b/quartz/components/scripts/graph.inline.ts @@ -44,6 +44,7 @@ async function renderGraph(container: string, fullSlug: FullSlug) { opacityScale, removeTags, showTags, + focusOnHover, } = JSON.parse(graph.dataset["cfg"]!) const data: Map = new Map( @@ -189,6 +190,8 @@ async function renderGraph(container: string, fullSlug: FullSlug) { return 2 + Math.sqrt(numLinks) } + let connectedNodes: SimpleSlug[] = [] + // draw individual nodes const node = graphNode .append("circle") @@ -202,17 +205,25 @@ async function renderGraph(container: string, fullSlug: FullSlug) { window.spaNavigate(new URL(targ, window.location.toString())) }) .on("mouseover", function (_, d) { - const neighbours: SimpleSlug[] = data.get(slug)?.links ?? [] - const neighbourNodes = d3 - .selectAll(".node") - .filter((d) => neighbours.includes(d.id)) const currentId = d.id const linkNodes = d3 .selectAll(".link") .filter((d: any) => d.source.id === currentId || d.target.id === currentId) - // highlight neighbour nodes - neighbourNodes.transition().duration(200).attr("fill", color) + if (focusOnHover) { + // fade out non-neighbour nodes + connectedNodes = linkNodes.data().flatMap((d: any) => [d.source.id, d.target.id]) + + d3.selectAll(".link") + .transition() + .duration(200) + .style("opacity", 0.2) + d3.selectAll(".node") + .filter((d) => !connectedNodes.includes(d.id)) + .transition() + .duration(200) + .style("opacity", 0.2) + } // highlight links linkNodes.transition().duration(200).attr("stroke", "var(--gray)").attr("stroke-width", 1) @@ -231,6 +242,10 @@ async function renderGraph(container: string, fullSlug: FullSlug) { .style("font-size", bigFont + "em") }) .on("mouseleave", function (_, d) { + if (focusOnHover) { + d3.selectAll(".link").transition().duration(200).style("opacity", 1) + d3.selectAll(".node").transition().duration(200).style("opacity", 1) + } const currentId = d.id const linkNodes = d3 .selectAll(".link") From a13d8e84b250a0e0bcb5d34e52f161e796e3a2fb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Mar 2024 12:54:21 -0800 Subject: [PATCH 23/35] chore(deps): bump lightningcss from 1.23.0 to 1.24.0 (#961) Bumps [lightningcss](https://github.com/parcel-bundler/lightningcss) from 1.23.0 to 1.24.0. - [Release notes](https://github.com/parcel-bundler/lightningcss/releases) - [Commits](https://github.com/parcel-bundler/lightningcss/compare/v1.23.0...v1.24.0) --- updated-dependencies: - dependency-name: lightningcss dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 80 +++++++++++++++++++++++------------------------ package.json | 2 +- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/package-lock.json b/package-lock.json index c720b7f8c..f001d872f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,7 @@ "hast-util-to-string": "^3.0.0", "is-absolute-url": "^4.0.1", "js-yaml": "^4.1.0", - "lightningcss": "^1.23.0", + "lightningcss": "^1.24.0", "mdast-util-find-and-replace": "^3.0.1", "mdast-util-to-hast": "^13.1.0", "mdast-util-to-string": "^4.0.0", @@ -3032,9 +3032,9 @@ } }, "node_modules/lightningcss": { - "version": "1.23.0", - "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.23.0.tgz", - "integrity": "sha512-SEArWKMHhqn/0QzOtclIwH5pXIYQOUEkF8DgICd/105O+GCgd7jxjNod/QPnBCSWvpRHQBGVz5fQ9uScby03zA==", + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.24.0.tgz", + "integrity": "sha512-y36QEEDVx4IM7/yIZNsZJMRREIu26WzTsauIysf5s76YeCmlSbRZS7aC97IGPuoFRnyZ5Wx43OBsQBFB5Ne7ng==", "dependencies": { "detect-libc": "^1.0.3" }, @@ -3046,21 +3046,21 @@ "url": "https://opencollective.com/parcel" }, "optionalDependencies": { - "lightningcss-darwin-arm64": "1.23.0", - "lightningcss-darwin-x64": "1.23.0", - "lightningcss-freebsd-x64": "1.23.0", - "lightningcss-linux-arm-gnueabihf": "1.23.0", - "lightningcss-linux-arm64-gnu": "1.23.0", - "lightningcss-linux-arm64-musl": "1.23.0", - "lightningcss-linux-x64-gnu": "1.23.0", - "lightningcss-linux-x64-musl": "1.23.0", - "lightningcss-win32-x64-msvc": "1.23.0" + "lightningcss-darwin-arm64": "1.24.0", + "lightningcss-darwin-x64": "1.24.0", + "lightningcss-freebsd-x64": "1.24.0", + "lightningcss-linux-arm-gnueabihf": "1.24.0", + "lightningcss-linux-arm64-gnu": "1.24.0", + "lightningcss-linux-arm64-musl": "1.24.0", + "lightningcss-linux-x64-gnu": "1.24.0", + "lightningcss-linux-x64-musl": "1.24.0", + "lightningcss-win32-x64-msvc": "1.24.0" } }, "node_modules/lightningcss-darwin-arm64": { - "version": "1.23.0", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.23.0.tgz", - "integrity": "sha512-kl4Pk3Q2lnE6AJ7Qaij47KNEfY2/UXRZBT/zqGA24B8qwkgllr/j7rclKOf1axcslNXvvUdztjo4Xqh39Yq1aA==", + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.24.0.tgz", + "integrity": "sha512-rTNPkEiynOu4CfGdd5ZfVOQe2gd2idfQd4EfX1l2ZUUwd+2SwSdbb7cG4rlwfnZckbzCAygm85xkpekRE5/wFw==", "cpu": [ "arm64" ], @@ -3077,9 +3077,9 @@ } }, "node_modules/lightningcss-darwin-x64": { - "version": "1.23.0", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.23.0.tgz", - "integrity": "sha512-KeRFCNoYfDdcolcFXvokVw+PXCapd2yHS1Diko1z1BhRz/nQuD5XyZmxjWdhmhN/zj5sH8YvWsp0/lPLVzqKpg==", + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.24.0.tgz", + "integrity": "sha512-4KCeF2RJjzp9xdGY8zIH68CUtptEg8uz8PfkHvsIdrP4t9t5CIgfDBhiB8AmuO75N6SofdmZexDZIKdy9vA7Ww==", "cpu": [ "x64" ], @@ -3096,9 +3096,9 @@ } }, "node_modules/lightningcss-freebsd-x64": { - "version": "1.23.0", - "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.23.0.tgz", - "integrity": "sha512-xhnhf0bWPuZxcqknvMDRFFo2TInrmQRWZGB0f6YoAsZX8Y+epfjHeeOIGCfAmgF0DgZxHwYc8mIR5tQU9/+ROA==", + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.24.0.tgz", + "integrity": "sha512-FJAYlek1wXuVTsncNU0C6YD41q126dXcIUm97KAccMn9C4s/JfLSqGWT2gIzAblavPFkyGG2gIADTWp3uWfN1g==", "cpu": [ "x64" ], @@ -3115,9 +3115,9 @@ } }, "node_modules/lightningcss-linux-arm-gnueabihf": { - "version": "1.23.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.23.0.tgz", - "integrity": "sha512-fBamf/bULvmWft9uuX+bZske236pUZEoUlaHNBjnueaCTJ/xd8eXgb0cEc7S5o0Nn6kxlauMBnqJpF70Bgq3zg==", + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.24.0.tgz", + "integrity": "sha512-N55K6JqzMx7C0hYUu1YmWqhkHwzEJlkQRMA6phY65noO0I1LOAvP4wBIoFWrzRE+O6zL0RmXJ2xppqyTbk3sYw==", "cpu": [ "arm" ], @@ -3134,9 +3134,9 @@ } }, "node_modules/lightningcss-linux-arm64-gnu": { - "version": "1.23.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.23.0.tgz", - "integrity": "sha512-RS7sY77yVLOmZD6xW2uEHByYHhQi5JYWmgVumYY85BfNoVI3DupXSlzbw+b45A9NnVKq45+oXkiN6ouMMtTwfg==", + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.24.0.tgz", + "integrity": "sha512-MqqUB2TpYtFWeBvvf5KExDdClU3YGLW5bHKs50uKKootcvG9KoS7wYwd5UichS+W3mYLc5yXUPGD1DNWbLiYKw==", "cpu": [ "arm64" ], @@ -3153,9 +3153,9 @@ } }, "node_modules/lightningcss-linux-arm64-musl": { - "version": "1.23.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.23.0.tgz", - "integrity": "sha512-cU00LGb6GUXCwof6ACgSMKo3q7XYbsyTj0WsKHLi1nw7pV0NCq8nFTn6ZRBYLoKiV8t+jWl0Hv8KkgymmK5L5g==", + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.24.0.tgz", + "integrity": "sha512-5wn4d9tFwa5bS1ao9mLexYVJdh3nn09HNIipsII6ZF7z9ZA5J4dOEhMgKoeCl891axTGTUYd8Kxn+Hn3XUSYRQ==", "cpu": [ "arm64" ], @@ -3172,9 +3172,9 @@ } }, "node_modules/lightningcss-linux-x64-gnu": { - "version": "1.23.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.23.0.tgz", - "integrity": "sha512-q4jdx5+5NfB0/qMbXbOmuC6oo7caPnFghJbIAV90cXZqgV8Am3miZhC4p+sQVdacqxfd+3nrle4C8icR3p1AYw==", + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.24.0.tgz", + "integrity": "sha512-3j5MdTh+LSDF3o6uDwRjRUgw4J+IfDCVtdkUrJvKxL79qBLUujXY7CTe5X3IQDDLKEe/3wu49r8JKgxr0MfjbQ==", "cpu": [ "x64" ], @@ -3191,9 +3191,9 @@ } }, "node_modules/lightningcss-linux-x64-musl": { - "version": "1.23.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.23.0.tgz", - "integrity": "sha512-G9Ri3qpmF4qef2CV/80dADHKXRAQeQXpQTLx7AiQrBYQHqBjB75oxqj06FCIe5g4hNCqLPnM9fsO4CyiT1sFSQ==", + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.24.0.tgz", + "integrity": "sha512-HI+rNnvaLz0o36z6Ki0gyG5igVGrJmzczxA5fznr6eFTj3cHORoR/j2q8ivMzNFR4UKJDkTWUH5LMhacwOHWBA==", "cpu": [ "x64" ], @@ -3210,9 +3210,9 @@ } }, "node_modules/lightningcss-win32-x64-msvc": { - "version": "1.23.0", - "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.23.0.tgz", - "integrity": "sha512-1rcBDJLU+obPPJM6qR5fgBUiCdZwZLafZM5f9kwjFLkb/UBNIzmae39uCSmh71nzPCTXZqHbvwu23OWnWEz+eg==", + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.24.0.tgz", + "integrity": "sha512-oeije/t7OZ5N9vSs6amyW/34wIYoBCpE6HUlsSKcP2SR1CVgx9oKEM00GtQmtqNnYiMIfsSm7+ppMb4NLtD5vg==", "cpu": [ "x64" ], diff --git a/package.json b/package.json index 38b0ca6a7..25d03316a 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "hast-util-to-string": "^3.0.0", "is-absolute-url": "^4.0.1", "js-yaml": "^4.1.0", - "lightningcss": "^1.23.0", + "lightningcss": "^1.24.0", "mdast-util-find-and-replace": "^3.0.1", "mdast-util-to-hast": "^13.1.0", "mdast-util-to-string": "^4.0.0", From 059dd1260e3762659530649972a220c9238bf6ab Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Mar 2024 12:55:02 -0800 Subject: [PATCH 24/35] chore(deps): bump preact-render-to-string from 6.3.1 to 6.4.0 (#960) Bumps [preact-render-to-string](https://github.com/developit/preact-render-to-string) from 6.3.1 to 6.4.0. - [Release notes](https://github.com/developit/preact-render-to-string/releases) - [Changelog](https://github.com/preactjs/preact-render-to-string/blob/main/CHANGELOG.md) - [Commits](https://github.com/developit/preact-render-to-string/compare/v6.3.1...6.4.0) --- updated-dependencies: - dependency-name: preact-render-to-string dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index f001d872f..b6613e464 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,7 +33,7 @@ "mdast-util-to-string": "^4.0.0", "micromorph": "^0.4.5", "preact": "^10.19.6", - "preact-render-to-string": "^6.3.1", + "preact-render-to-string": "^6.4.0", "pretty-bytes": "^6.1.1", "pretty-time": "^1.1.0", "reading-time": "^1.5.0", @@ -4465,9 +4465,9 @@ } }, "node_modules/preact-render-to-string": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/preact-render-to-string/-/preact-render-to-string-6.3.1.tgz", - "integrity": "sha512-NQ28WrjLtWY6lKDlTxnFpKHZdpjfF+oE6V4tZ0rTrunHrtZp6Dm0oFrcJalt/5PNeqJz4j1DuZDS0Y6rCBoqDA==", + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/preact-render-to-string/-/preact-render-to-string-6.4.0.tgz", + "integrity": "sha512-pzDwezZaLbK371OiJjXDsZJwVOALzFX5M1wEh2Kr0pEApq5AV6bRH/DFbA/zNA7Lck/duyREPQLLvzu2G6hEQQ==", "dependencies": { "pretty-format": "^3.8.0" }, diff --git a/package.json b/package.json index 25d03316a..7b8c9bece 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "mdast-util-to-string": "^4.0.0", "micromorph": "^0.4.5", "preact": "^10.19.6", - "preact-render-to-string": "^6.3.1", + "preact-render-to-string": "^6.4.0", "pretty-bytes": "^6.1.1", "pretty-time": "^1.1.0", "reading-time": "^1.5.0", From 83ab39c7bd00c7bdfddc303b765b73ae774e3aab Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Mar 2024 12:55:44 -0800 Subject: [PATCH 25/35] chore(deps): bump shiki from 1.1.6 to 1.1.7 (#959) Bumps [shiki](https://github.com/shikijs/shiki/tree/HEAD/packages/shiki) from 1.1.6 to 1.1.7. - [Release notes](https://github.com/shikijs/shiki/releases) - [Changelog](https://github.com/shikijs/shiki/blob/main/CHANGELOG.md) - [Commits](https://github.com/shikijs/shiki/commits/v1.1.7/packages/shiki) --- updated-dependencies: - dependency-name: shiki dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 16 ++++++++-------- package.json | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index b6613e464..816478267 100644 --- a/package-lock.json +++ b/package-lock.json @@ -54,7 +54,7 @@ "rfdc": "^1.3.1", "rimraf": "^5.0.5", "serve-handler": "^6.1.5", - "shiki": "^1.1.6", + "shiki": "^1.1.7", "source-map-support": "^0.5.21", "to-vfile": "^8.0.0", "toml": "^3.0.0", @@ -743,9 +743,9 @@ } }, "node_modules/@shikijs/core": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.1.6.tgz", - "integrity": "sha512-kt9hhvrWTm0EPtRDIsoAZnSsFlIDBVBBI5CQewpA/NZCPin+MOKRXg+JiWc4y+8fZ/v0HzfDhu/UC+OTZGMt7A==" + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.1.7.tgz", + "integrity": "sha512-gTYLUIuD1UbZp/11qozD3fWpUTuMqPSf3svDMMrL0UmlGU7D9dPw/V1FonwAorCUJBltaaESxq90jrSjQyGixg==" }, "node_modules/@sindresorhus/merge-streams": { "version": "2.3.0", @@ -5310,11 +5310,11 @@ } }, "node_modules/shiki": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.1.6.tgz", - "integrity": "sha512-j4pcpvaQWHb42cHeV+W6P+X/VcK7Y2ctvEham6zB8wsuRQroT6cEMIkiUmBU2Nqg2qnHZDH6ZyRdVldcy0l6xw==", + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.1.7.tgz", + "integrity": "sha512-9kUTMjZtcPH3i7vHunA6EraTPpPOITYTdA5uMrvsJRexktqP0s7P3s9HVK80b4pP42FRVe03D7fT3NmJv2yYhw==", "dependencies": { - "@shikijs/core": "1.1.6" + "@shikijs/core": "1.1.7" } }, "node_modules/signal-exit": { diff --git a/package.json b/package.json index 7b8c9bece..a5fc32fe3 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "rfdc": "^1.3.1", "rimraf": "^5.0.5", "serve-handler": "^6.1.5", - "shiki": "^1.1.6", + "shiki": "^1.1.7", "source-map-support": "^0.5.21", "to-vfile": "^8.0.0", "toml": "^3.0.0", From 73a890ab126786cba2e0cef701601672c9b28ee2 Mon Sep 17 00:00:00 2001 From: Aaron Pham <29749331+aarnphm@users.noreply.github.com> Date: Tue, 5 Mar 2024 22:37:28 -0500 Subject: [PATCH 26/35] =?UTF-8?q?revert:=20"fix(callout):=20reorder=20the?= =?UTF-8?q?=20plugins=20to=20render=20latex=20on=20callout=E2=80=A6=20(#96?= =?UTF-8?q?5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 018c6358c4c00be319ccc00df84f9be02e7845b4. --- quartz.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quartz.config.ts b/quartz.config.ts index a2eb605c0..2cdadb740 100644 --- a/quartz.config.ts +++ b/quartz.config.ts @@ -55,7 +55,6 @@ const config: QuartzConfig = { Plugin.CreatedModifiedDate({ priority: ["frontmatter", "filesystem"], }), - Plugin.ObsidianFlavoredMarkdown({ enableInHtmlEmbed: false }), Plugin.Latex({ renderEngine: "katex" }), Plugin.SyntaxHighlighting({ theme: { @@ -64,6 +63,7 @@ const config: QuartzConfig = { }, keepBackground: false, }), + Plugin.ObsidianFlavoredMarkdown({ enableInHtmlEmbed: false }), Plugin.GitHubFlavoredMarkdown(), Plugin.TableOfContents(), Plugin.CrawlLinks({ markdownLinkResolution: "shortest" }), From 5163504517791cb327423fff9291c91c519b27b6 Mon Sep 17 00:00:00 2001 From: Emile Bangma Date: Wed, 6 Mar 2024 06:53:35 +0100 Subject: [PATCH 27/35] fix: transclude all subsections for embedded call (closes #963) (#964) --- quartz/components/renderPage.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/quartz/components/renderPage.tsx b/quartz/components/renderPage.tsx index 5394d6f4c..9309e6723 100644 --- a/quartz/components/renderPage.tsx +++ b/quartz/components/renderPage.tsx @@ -106,8 +106,9 @@ export function renderPage( blockRef = blockRef.slice(1) let startIdx = undefined let endIdx = undefined + let headerRegex = /h[1-6]/ for (const [i, el] of page.htmlAst.children.entries()) { - if (el.type === "element" && el.tagName.match(/h[1-6]/)) { + if (el.type === "element" && el.tagName.match(headerRegex)) { if (endIdx) { break } @@ -116,6 +117,7 @@ export function renderPage( endIdx = i } else if (el.properties?.id === blockRef) { startIdx = i + headerRegex = new RegExp(`h[1-${el.tagName.slice(-1)}]`) } } } From a506cedd7a28f9443c34487e2997e58e919b09b2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Mar 2024 21:59:37 -0800 Subject: [PATCH 28/35] chore(deps-dev): bump @types/node from 20.11.19 to 20.11.24 (#958) Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.19 to 20.11.24. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 816478267..b3e7eced9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -73,7 +73,7 @@ "@types/d3": "^7.4.3", "@types/hast": "^3.0.4", "@types/js-yaml": "^4.0.9", - "@types/node": "^20.11.19", + "@types/node": "^20.11.24", "@types/pretty-time": "^1.1.5", "@types/source-map-support": "^0.5.10", "@types/ws": "^8.5.10", @@ -1093,9 +1093,9 @@ } }, "node_modules/@types/node": { - "version": "20.11.19", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.19.tgz", - "integrity": "sha512-7xMnVEcZFu0DikYjWOlRq7NTPETrm7teqUT2WkQjrTIkEgUyyGdWsj/Zg8bEJt5TNklzbPD1X3fqfsHw3SpapQ==", + "version": "20.11.24", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.24.tgz", + "integrity": "sha512-Kza43ewS3xoLgCEpQrsT+xRo/EJej1y0kVYGiLFE1NEODXGzTfwiC6tXTLMQskn1X4/Rjlh0MQUvx9W+L9long==", "dev": true, "dependencies": { "undici-types": "~5.26.4" diff --git a/package.json b/package.json index a5fc32fe3..a0feb9670 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,7 @@ "@types/d3": "^7.4.3", "@types/hast": "^3.0.4", "@types/js-yaml": "^4.0.9", - "@types/node": "^20.11.19", + "@types/node": "^20.11.24", "@types/pretty-time": "^1.1.5", "@types/source-map-support": "^0.5.10", "@types/ws": "^8.5.10", From 0ca8a2ac7ca5686598d360b247caf8c13d5036d5 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Tue, 5 Mar 2024 22:17:58 -0800 Subject: [PATCH 29/35] chore: transclude subsection without dynamic regex construction --- quartz/components/renderPage.tsx | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/quartz/components/renderPage.tsx b/quartz/components/renderPage.tsx index 9309e6723..7a97edbc2 100644 --- a/quartz/components/renderPage.tsx +++ b/quartz/components/renderPage.tsx @@ -19,6 +19,7 @@ interface RenderComponents { footer: QuartzComponent } +const headerRegex = new RegExp(/h[1-6]/) export function pageResources( baseDir: FullSlug | RelativeURL, staticResources: StaticResources, @@ -105,20 +106,23 @@ export function renderPage( // header transclude blockRef = blockRef.slice(1) let startIdx = undefined + let startDepth = undefined let endIdx = undefined - let headerRegex = /h[1-6]/ for (const [i, el] of page.htmlAst.children.entries()) { - if (el.type === "element" && el.tagName.match(headerRegex)) { - if (endIdx) { - break - } + // skip non-headers + if (!(el.type === "element" && el.tagName.match(headerRegex))) continue + const depth = Number(el.tagName.substring(1)) - if (startIdx !== undefined) { - endIdx = i - } else if (el.properties?.id === blockRef) { + // lookin for our blockref + if (startIdx === undefined || startDepth === undefined) { + // skip until we find the blockref that matches + if (el.properties?.id === blockRef) { startIdx = i - headerRegex = new RegExp(`h[1-${el.tagName.slice(-1)}]`) + startDepth = Number(el.tagName.substring(1)) } + } else if (depth <= startDepth) { + // looking for new header that is same level or higher + endIdx = i } } From e13cafe070885b0bc5c2642324342a8e957006b2 Mon Sep 17 00:00:00 2001 From: Emile Bangma Date: Wed, 6 Mar 2024 18:45:31 +0100 Subject: [PATCH 30/35] feat: support youtube playlist iframe (#968) * feat: support youtube playlist iframe * chore: updated Youtube embed documentation to include playlists --- docs/plugins/ObsidianFlavoredMarkdown.md | 2 +- quartz/plugins/transformers/ofm.ts | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/docs/plugins/ObsidianFlavoredMarkdown.md b/docs/plugins/ObsidianFlavoredMarkdown.md index 7700a5cfb..c4240865f 100644 --- a/docs/plugins/ObsidianFlavoredMarkdown.md +++ b/docs/plugins/ObsidianFlavoredMarkdown.md @@ -20,7 +20,7 @@ This plugin accepts the following configuration options: - `parseArrows`: If `true` (default), transforms arrow symbols into their HTML character equivalents. - `parseBlockReferences`: If `true` (default), handles block references, linking to specific content blocks. - `enableInHtmlEmbed`: If `true`, allows embedding of content directly within HTML. Defaults to `false`. -- `enableYouTubeEmbed`: If `true` (default), enables the embedding of YouTube videos using external image Markdown syntax. +- `enableYouTubeEmbed`: If `true` (default), enables the embedding of YouTube videos and playlists using external image Markdown syntax. - `enableVideoEmbed`: If `true` (default), enables the embedding of video files. - `enableCheckbox`: If `true`, adds support for interactive checkboxes in content. Defaults to `false`. diff --git a/quartz/plugins/transformers/ofm.ts b/quartz/plugins/transformers/ofm.ts index 237d683a7..48428af8b 100644 --- a/quartz/plugins/transformers/ofm.ts +++ b/quartz/plugins/transformers/ofm.ts @@ -123,6 +123,7 @@ const tagRegex = new RegExp( ) const blockReferenceRegex = new RegExp(/\^([-_A-Za-z0-9]+)$/, "g") const ytLinkRegex = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/ +const ytPlaylistLinkRegex = /[?&]list=([^#?&]*)/ const videoExtensionRegex = new RegExp(/\.(mp4|webm|ogg|avi|mov|flv|wmv|mkv|mpg|mpeg|3gp|m4v)$/) const wikilinkImageEmbedRegex = new RegExp( /^(?(?!^\d*x?\d*$).*?)?(\|?\s*?(?\d+)(x(?\d+))?)?$/, @@ -574,7 +575,9 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin if (node.tagName === "img" && typeof node.properties.src === "string") { const match = node.properties.src.match(ytLinkRegex) const videoId = match && match[2].length == 11 ? match[2] : null + const playlistId = node.properties.src.match(ytPlaylistLinkRegex)?.[1] if (videoId) { + // YouTube video (with optional playlist) node.tagName = "iframe" node.properties = { class: "external-embed", @@ -582,7 +585,20 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin frameborder: 0, width: "600px", height: "350px", - src: `https://www.youtube.com/embed/${videoId}`, + src: playlistId + ? `https://www.youtube.com/embed/${videoId}?list=${playlistId}` + : `https://www.youtube.com/embed/${videoId}`, + } + } else if (playlistId) { + // YouTube playlist only. + node.tagName = "iframe" + node.properties = { + class: "external-embed", + allow: "fullscreen", + frameborder: 0, + width: "600px", + height: "350px", + src: `https://www.youtube.com/embed/videoseries?list=${playlistId}`, } } } From 001c166825575d28a07257a969081fa74668c2b5 Mon Sep 17 00:00:00 2001 From: Matt Vogel Date: Wed, 6 Mar 2024 20:25:39 -0500 Subject: [PATCH 31/35] fix(tag): move hash to sass styling only (#930) --- quartz/components/PageList.tsx | 2 +- quartz/components/RecentNotes.tsx | 2 +- quartz/components/TagList.tsx | 3 +-- quartz/plugins/transformers/ofm.ts | 2 +- quartz/styles/base.scss | 5 +++++ 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/quartz/components/PageList.tsx b/quartz/components/PageList.tsx index 62b77b17b..1e5d232df 100644 --- a/quartz/components/PageList.tsx +++ b/quartz/components/PageList.tsx @@ -63,7 +63,7 @@ export const PageList: QuartzComponent = ({ cfg, fileData, allFiles, limit }: Pr class="internal tag-link" href={resolveRelative(fileData.slug!, `tags/${tag}` as FullSlug)} > - #{tag} + {tag} ))} diff --git a/quartz/components/RecentNotes.tsx b/quartz/components/RecentNotes.tsx index 549b025d3..d99878db9 100644 --- a/quartz/components/RecentNotes.tsx +++ b/quartz/components/RecentNotes.tsx @@ -63,7 +63,7 @@ export default ((userOpts?: Partial) => { class="internal tag-link" href={resolveRelative(fileData.slug!, `tags/${tag}` as FullSlug)} > - #{tag} + {tag} ))} diff --git a/quartz/components/TagList.tsx b/quartz/components/TagList.tsx index 04a483b6c..ba48098bd 100644 --- a/quartz/components/TagList.tsx +++ b/quartz/components/TagList.tsx @@ -9,12 +9,11 @@ const TagList: QuartzComponent = ({ fileData, displayClass }: QuartzComponentPro return (
    {tags.map((tag) => { - const display = `#${tag}` const linkDest = baseDir + `/tags/${slugTag(tag)}` return (
  • - {display} + {tag}
  • ) diff --git a/quartz/plugins/transformers/ofm.ts b/quartz/plugins/transformers/ofm.ts index 48428af8b..5058c8b35 100644 --- a/quartz/plugins/transformers/ofm.ts +++ b/quartz/plugins/transformers/ofm.ts @@ -328,7 +328,7 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin children: [ { type: "text", - value: `#${tag}`, + value: tag, }, ], } diff --git a/quartz/styles/base.scss b/quartz/styles/base.scss index 92798a2da..868dfdc79 100644 --- a/quartz/styles/base.scss +++ b/quartz/styles/base.scss @@ -79,6 +79,11 @@ a { border-radius: 0; padding: 0; } + &.tag-link { + &::before { + content: "#"; + } + } } &.external .external-icon { From f44e4d25e69c17c61ee911c889231a51f1d1c3a8 Mon Sep 17 00:00:00 2001 From: Aaron Pham <29749331+aarnphm@users.noreply.github.com> Date: Wed, 6 Mar 2024 21:24:50 -0500 Subject: [PATCH 32/35] fix(tag): remove hash on main page (#969) Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com> --- quartz/plugins/emitters/tagPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quartz/plugins/emitters/tagPage.tsx b/quartz/plugins/emitters/tagPage.tsx index 6f65ae477..d88d0722a 100644 --- a/quartz/plugins/emitters/tagPage.tsx +++ b/quartz/plugins/emitters/tagPage.tsx @@ -73,7 +73,7 @@ export const TagPage: QuartzEmitterPlugin> = (userOpts) const title = tag === "index" ? i18n(cfg.locale).pages.tagContent.tagIndex - : `${i18n(cfg.locale).pages.tagContent.tag}: #${tag}` + : `${i18n(cfg.locale).pages.tagContent.tag}: ${tag}` return [ tag, defaultProcessedContent({ From ba6c7a73d1dff02d9659a9e6e84be6b9a54579c2 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Wed, 6 Mar 2024 19:00:37 -0800 Subject: [PATCH 33/35] fix: remove extra # from tag content --- quartz/components/pages/TagContent.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quartz/components/pages/TagContent.tsx b/quartz/components/pages/TagContent.tsx index 1dd912471..692585c2b 100644 --- a/quartz/components/pages/TagContent.tsx +++ b/quartz/components/pages/TagContent.tsx @@ -58,7 +58,7 @@ const TagContent: QuartzComponent = (props: QuartzComponentProps) => {

    - #{tag} + {tag}

    {content &&

    {content}

    } From 3d4a94dda3406ced22b3cb85cdc26a2df7aa3f55 Mon Sep 17 00:00:00 2001 From: Tyler Funk Date: Wed, 6 Mar 2024 21:44:34 -0600 Subject: [PATCH 34/35] feat(analytics): Goatcounter support (#956) * Add options to support goatcounter analytics * goatcounter: support self-hosted * Add to configuration docs for goatcounter settings * use https instead of protocol-relative link for goatcounter js --- docs/configuration.md | 1 + quartz/cfg.ts | 6 ++++++ quartz/plugins/emitters/componentResources.ts | 9 +++++++++ 3 files changed, 16 insertions(+) diff --git a/docs/configuration.md b/docs/configuration.md index 500e4c1cc..64968fbb4 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -28,6 +28,7 @@ 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) - `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/quartz/cfg.ts b/quartz/cfg.ts index a477db057..2e32b1f80 100644 --- a/quartz/cfg.ts +++ b/quartz/cfg.ts @@ -19,6 +19,12 @@ export type Analytics = websiteId: string host?: string } + | { + provider: "goatcounter" + websiteId: string + host?: string + scriptSrc?: string + } export interface GlobalConfiguration { pageTitle: string diff --git a/quartz/plugins/emitters/componentResources.ts b/quartz/plugins/emitters/componentResources.ts index 1b6e13a40..7d1a01d20 100644 --- a/quartz/plugins/emitters/componentResources.ts +++ b/quartz/plugins/emitters/componentResources.ts @@ -126,6 +126,15 @@ function addGlobalPageResources( document.head.appendChild(umamiScript) `) + } else if (cfg.analytics?.provider === "goatcounter") { + componentResources.afterDOMLoaded.push(` + const goatcounterScript = document.createElement("script") + goatcounterScript.src = "${cfg.analytics.scriptSrc ?? "https://gc.zgo.at/count.js"}" + goatcounterScript.async = true + goatcounterScript.setAttribute("data-goatcounter", + "https://${cfg.analytics.websiteId}.${cfg.analytics.host ?? "goatcounter.com"}/count") + document.head.appendChild(goatcounterScript) + `) } if (cfg.enableSPA) { From 141dd3b51f59aabc8ef3506d040f7360a86f26d0 Mon Sep 17 00:00:00 2001 From: Aaron Pham <29749331+aarnphm@users.noreply.github.com> Date: Wed, 6 Mar 2024 22:45:02 -0500 Subject: [PATCH 35/35] fix(description): make sure to we join space correctly (#970) Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com> --- quartz/plugins/transformers/description.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/quartz/plugins/transformers/description.ts b/quartz/plugins/transformers/description.ts index 0f8cd8d39..b582feea6 100644 --- a/quartz/plugins/transformers/description.ts +++ b/quartz/plugins/transformers/description.ts @@ -39,29 +39,29 @@ export const Description: QuartzTransformerPlugin | undefined> const desc = frontMatterDescription ?? text const sentences = desc.replace(/\s+/g, " ").split(/\.\s/) - let finalDesc = "" - let sentenceIdx = 0 + const finalDesc: string[] = [] const len = opts.descriptionLength + let sentenceIdx = 0 if (sentences[0] !== undefined && sentences[0].length >= len) { const firstSentence = sentences[0].split(" ") while (finalDesc.length < len) { const sentence = firstSentence[sentenceIdx] if (!sentence) break - finalDesc += sentence + " " + finalDesc.push(sentence) sentenceIdx++ } - finalDesc = finalDesc.trimEnd() + "..." + finalDesc.push("...") } else { while (finalDesc.length < len) { const sentence = sentences[sentenceIdx] if (!sentence) break - finalDesc += sentence.endsWith(".") ? sentence : sentence + "." + finalDesc.push(sentence.endsWith(".") ? sentence : sentence + ".") sentenceIdx++ } } - file.data.description = finalDesc + file.data.description = finalDesc.join(" ") file.data.text = text } },