diff --git a/docs/features/explorer.md b/docs/features/explorer.md
index b5fd379a7..a2acb861a 100644
--- a/docs/features/explorer.md
+++ b/docs/features/explorer.md
@@ -42,7 +42,7 @@ When passing in your own options, you can omit any or all of these fields if you
Want to customize it even more?
-- Removing table of contents: remove `Component.Explorer()` from `quartz.layout.ts`
+- Removing explorer: remove `Component.Explorer()` from `quartz.layout.ts`
- (optional): After removing the explorer component, you can move the [[table of contents | Table of Contents]] component back to the `left` part of the layout
- Changing `sort`, `filter` and `map` behavior: explained in [[#Advanced customization]]
- Component:
diff --git a/docs/showcase.md b/docs/showcase.md
index cdef5fc50..0509e93ab 100644
--- a/docs/showcase.md
+++ b/docs/showcase.md
@@ -25,5 +25,6 @@ Want to see what Quartz can do? Here are some cool community gardens:
- [Scaling Synthesis - A hypertext research notebook](https://scalingsynthesis.com/)
- [Data Dictionary 🧠](https://glossary.airbyte.com/)
- [sspaeti.com's Second Brain](https://brain.sspaeti.com/)
+- [🪴Aster's notebook](https://notes.asterhu.com)
If you want to see your own on here, submit a [Pull Request adding yourself to this file](https://github.com/jackyzha0/quartz/blob/v4/docs/showcase.md)!
diff --git a/package-lock.json b/package-lock.json
index 4a8b58336..dc020fc83 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -40,7 +40,7 @@
"rehype-autolink-headings": "^7.1.0",
"rehype-katex": "^7.0.0",
"rehype-mathjax": "^6.0.0",
- "rehype-pretty-code": "^0.12.6",
+ "rehype-pretty-code": "^0.13.0",
"rehype-raw": "^7.0.0",
"rehype-slug": "^6.0.0",
"remark": "^15.0.1",
@@ -54,7 +54,7 @@
"rfdc": "^1.3.1",
"rimraf": "^5.0.5",
"serve-handler": "^6.1.5",
- "shikiji": "^0.10.2",
+ "shiki": "^1.1.6",
"source-map-support": "^0.5.21",
"to-vfile": "^8.0.0",
"toml": "^3.0.0",
@@ -742,6 +742,11 @@
"node": ">=14"
}
},
+ "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=="
+ },
"node_modules/@sindresorhus/merge-streams": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-2.3.0.tgz",
@@ -4708,11 +4713,11 @@
}
},
"node_modules/rehype-pretty-code": {
- "version": "0.12.6",
- "resolved": "https://registry.npmjs.org/rehype-pretty-code/-/rehype-pretty-code-0.12.6.tgz",
- "integrity": "sha512-AW18s4eXwnb4PGwL0Y8BoUzBJr23epWNXndCKaZ52S4kl/4tsgM+406oCp5NdtPZsB0ItpaY+hCMv3kw58DLrA==",
+ "version": "0.13.0",
+ "resolved": "https://registry.npmjs.org/rehype-pretty-code/-/rehype-pretty-code-0.13.0.tgz",
+ "integrity": "sha512-+22dz1StXlF7dlMyOySNaVxgcGhMI4BCxq0JxJJPWYGiKsI6cu5jyuIKGHXHvH18D8sv1rdKtvsY9UEfN3++SQ==",
"dependencies": {
- "@types/hast": "^3.0.3",
+ "@types/hast": "^3.0.4",
"hast-util-to-string": "^3.0.0",
"parse-numeric-range": "^1.3.0",
"rehype-parse": "^9.0.0",
@@ -4723,7 +4728,7 @@
"node": ">=18"
},
"peerDependencies": {
- "shikiji": "^0.7.0 || ^0.8.0 || ^0.9.0 || ^0.10.0"
+ "shiki": "^1.0.0"
}
},
"node_modules/rehype-raw": {
@@ -5321,19 +5326,14 @@
"node": ">=8"
}
},
- "node_modules/shikiji": {
- "version": "0.10.2",
- "resolved": "https://registry.npmjs.org/shikiji/-/shikiji-0.10.2.tgz",
- "integrity": "sha512-wtZg3T0vtYV2PnqusWQs3mDaJBdCPWxFDrBM/SE5LfrX92gjUvfEMlc+vJnoKY6Z/S44OWaCRzNIsdBRWcTAiw==",
+ "node_modules/shiki": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.1.6.tgz",
+ "integrity": "sha512-j4pcpvaQWHb42cHeV+W6P+X/VcK7Y2ctvEham6zB8wsuRQroT6cEMIkiUmBU2Nqg2qnHZDH6ZyRdVldcy0l6xw==",
"dependencies": {
- "shikiji-core": "0.10.2"
+ "@shikijs/core": "1.1.6"
}
},
- "node_modules/shikiji-core": {
- "version": "0.10.2",
- "resolved": "https://registry.npmjs.org/shikiji-core/-/shikiji-core-0.10.2.tgz",
- "integrity": "sha512-9Of8HMlF96usXJHmCL3Gd0Fcf0EcyJUF9m8EoAKKd98mHXi0La2AZl1h6PegSFGtiYcBDK/fLuKbDa1l16r1fA=="
- },
"node_modules/signal-exit": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
diff --git a/package.json b/package.json
index 37722e4ad..f81857284 100644
--- a/package.json
+++ b/package.json
@@ -70,7 +70,7 @@
"rehype-autolink-headings": "^7.1.0",
"rehype-katex": "^7.0.0",
"rehype-mathjax": "^6.0.0",
- "rehype-pretty-code": "^0.12.6",
+ "rehype-pretty-code": "^0.13.0",
"rehype-raw": "^7.0.0",
"rehype-slug": "^6.0.0",
"remark": "^15.0.1",
@@ -84,7 +84,7 @@
"rfdc": "^1.3.1",
"rimraf": "^5.0.5",
"serve-handler": "^6.1.5",
- "shikiji": "^0.10.2",
+ "shiki": "^1.1.6",
"source-map-support": "^0.5.21",
"to-vfile": "^8.0.0",
"toml": "^3.0.0",
diff --git a/quartz/components/pages/TagContent.tsx b/quartz/components/pages/TagContent.tsx
index 19452ec44..22f6bb25d 100644
--- a/quartz/components/pages/TagContent.tsx
+++ b/quartz/components/pages/TagContent.tsx
@@ -66,9 +66,12 @@ function TagContent(props: QuartzComponentProps) {
{i18n(cfg.locale).pages.tagContent.itemsUnderTag({ count: pages.length })}
{pages.length > numPages && (
-
- {i18n(cfg.locale).pages.tagContent.showingFirst({ count: numPages })}
-
+ <>
+ {" "}
+
+ {i18n(cfg.locale).pages.tagContent.showingFirst({ count: numPages })}
+
+ >
)}
diff --git a/quartz/components/scripts/popover.inline.ts b/quartz/components/scripts/popover.inline.ts
index d0346b05b..972d3c638 100644
--- a/quartz/components/scripts/popover.inline.ts
+++ b/quartz/components/scripts/popover.inline.ts
@@ -47,8 +47,8 @@ async function mouseEnterHandler(
}
if (!response) return
- const contentType = response.headers.get("Content-Type")
- const contentTypeCategory = contentType?.split("/")[0] ?? "text"
+ const [contentType] = response.headers.get("Content-Type")!.split(";")
+ const [contentTypeCategory, typeInfo] = contentType.split("/")
const popoverElement = document.createElement("div")
popoverElement.classList.add("popover")
@@ -56,19 +56,27 @@ async function mouseEnterHandler(
popoverInner.classList.add("popover-inner")
popoverElement.appendChild(popoverInner)
- popoverInner.dataset.contentType = contentTypeCategory
+ popoverInner.dataset.contentType = contentType ?? undefined
switch (contentTypeCategory) {
case "image":
const img = document.createElement("img")
-
- response.blob().then((blob) => {
- img.src = URL.createObjectURL(blob)
- })
+ img.src = targetUrl.toString()
img.alt = targetUrl.pathname
popoverInner.appendChild(img)
break
+ case "application":
+ switch (typeInfo) {
+ case "pdf":
+ const pdf = document.createElement("iframe")
+ pdf.src = targetUrl.toString()
+ popoverInner.appendChild(pdf)
+ break
+ default:
+ break
+ }
+ break
default:
const contents = await response.text()
const html = p.parseFromString(contents, "text/html")
diff --git a/quartz/components/styles/popover.scss b/quartz/components/styles/popover.scss
index 141b89ddf..b1694f97c 100644
--- a/quartz/components/styles/popover.scss
+++ b/quartz/components/styles/popover.scss
@@ -38,14 +38,25 @@
white-space: normal;
}
- & > .popover-inner[data-content-type="image"] {
- padding: 0;
- max-height: 100%;
+ & > .popover-inner[data-content-type] {
+ &[data-content-type*="pdf"],
+ &[data-content-type*="image"] {
+ padding: 0;
+ max-height: 100%;
+ }
- img {
- margin: 0;
- border-radius: 0;
- display: block;
+ &[data-content-type*="image"] {
+ img {
+ margin: 0;
+ border-radius: 0;
+ display: block;
+ }
+ }
+
+ &[data-content-type*="pdf"] {
+ iframe {
+ width: 100%;
+ }
}
}
diff --git a/quartz/components/types.ts b/quartz/components/types.ts
index d322ea926..a6b90d3b2 100644
--- a/quartz/components/types.ts
+++ b/quartz/components/types.ts
@@ -3,8 +3,10 @@ import { StaticResources } from "../util/resources"
import { QuartzPluginData } from "../plugins/vfile"
import { GlobalConfiguration } from "../cfg"
import { Node } from "hast"
+import { BuildCtx } from "../util/ctx"
export type QuartzComponentProps = {
+ ctx: BuildCtx
externalResources: StaticResources
fileData: QuartzPluginData
cfg: GlobalConfiguration
diff --git a/quartz/i18n/locales/de-DE.ts b/quartz/i18n/locales/de-DE.ts
index e3821944b..64c9ba9df 100644
--- a/quartz/i18n/locales/de-DE.ts
+++ b/quartz/i18n/locales/de-DE.ts
@@ -69,13 +69,13 @@ export default {
folderContent: {
folder: "Ordner",
itemsUnderFolder: ({ count }) =>
- count === 1 ? "1 Datei in diesem Ordner" : `${count} Dateien in diesem Ordner.`,
+ count === 1 ? "1 Datei in diesem Ordner." : `${count} Dateien in diesem Ordner.`,
},
tagContent: {
tag: "Tag",
tagIndex: "Tag-Übersicht",
itemsUnderTag: ({ count }) =>
- count === 1 ? "1 Datei mit diesem Tag" : `${count} Dateien mit diesem Tag.`,
+ count === 1 ? "1 Datei mit diesem Tag." : `${count} Dateien mit diesem Tag.`,
showingFirst: ({ count }) => `Die ersten ${count} Tags werden angezeigt.`,
totalTags: ({ count }) => `${count} Tags insgesamt.`,
},
diff --git a/quartz/i18n/locales/en-US.ts b/quartz/i18n/locales/en-US.ts
index 4a308d79a..ac283fdaf 100644
--- a/quartz/i18n/locales/en-US.ts
+++ b/quartz/i18n/locales/en-US.ts
@@ -69,13 +69,13 @@ export default {
folderContent: {
folder: "Folder",
itemsUnderFolder: ({ count }) =>
- count === 1 ? "1 item under this folder" : `${count} items under this folder.`,
+ count === 1 ? "1 item under this folder." : `${count} items under this folder.`,
},
tagContent: {
tag: "Tag",
tagIndex: "Tag Index",
itemsUnderTag: ({ count }) =>
- count === 1 ? "1 item with this tag" : `${count} items with this tag.`,
+ count === 1 ? "1 item with this tag." : `${count} items with this tag.`,
showingFirst: ({ count }) => `Showing first ${count} tags.`,
totalTags: ({ count }) => `Found ${count} total tags.`,
},
diff --git a/quartz/i18n/locales/es-ES.ts b/quartz/i18n/locales/es-ES.ts
index f59d201a3..37a2a79c7 100644
--- a/quartz/i18n/locales/es-ES.ts
+++ b/quartz/i18n/locales/es-ES.ts
@@ -69,13 +69,13 @@ export default {
folderContent: {
folder: "Carpeta",
itemsUnderFolder: ({ count }) =>
- count === 1 ? "1 artículo en esta carpeta" : `${count} artículos en esta carpeta.`,
+ count === 1 ? "1 artículo en esta carpeta." : `${count} artículos en esta carpeta.`,
},
tagContent: {
tag: "Etiqueta",
tagIndex: "Índice de Etiquetas",
itemsUnderTag: ({ count }) =>
- count === 1 ? "1 artículo con esta etiqueta" : `${count} artículos con esta etiqueta.`,
+ count === 1 ? "1 artículo con esta etiqueta." : `${count} artículos con esta etiqueta.`,
showingFirst: ({ count }) => `Mostrando las primeras ${count} etiquetas.`,
totalTags: ({ count }) => `Se encontraron ${count} etiquetas en total.`,
},
diff --git a/quartz/i18n/locales/fr-FR.ts b/quartz/i18n/locales/fr-FR.ts
index 8b7229201..b485d2b6e 100644
--- a/quartz/i18n/locales/fr-FR.ts
+++ b/quartz/i18n/locales/fr-FR.ts
@@ -69,13 +69,13 @@ export default {
folderContent: {
folder: "Dossier",
itemsUnderFolder: ({ count }) =>
- count === 1 ? "1 élément sous ce dossier" : `${count} éléments sous ce dossier.`,
+ count === 1 ? "1 élément sous ce dossier." : `${count} éléments sous ce dossier.`,
},
tagContent: {
tag: "Étiquette",
tagIndex: "Index des étiquettes",
itemsUnderTag: ({ count }) =>
- count === 1 ? "1 élément avec cette étiquette" : `${count} éléments avec cette étiquette.`,
+ count === 1 ? "1 élément avec cette étiquette." : `${count} éléments avec cette étiquette.`,
showingFirst: ({ count }) => `Affichage des premières ${count} étiquettes.`,
totalTags: ({ count }) => `Trouvé ${count} étiquettes au total.`,
},
diff --git a/quartz/i18n/locales/it-IT.ts b/quartz/i18n/locales/it-IT.ts
index a0cc04283..ca8818a65 100644
--- a/quartz/i18n/locales/it-IT.ts
+++ b/quartz/i18n/locales/it-IT.ts
@@ -69,13 +69,13 @@ export default {
folderContent: {
folder: "Cartella",
itemsUnderFolder: ({ count }) =>
- count === 1 ? "1 oggetto in questa cartella" : `${count} oggetti in questa cartella.`,
+ count === 1 ? "1 oggetto in questa cartella." : `${count} oggetti in questa cartella.`,
},
tagContent: {
tag: "Etichetta",
tagIndex: "Indice etichette",
itemsUnderTag: ({ count }) =>
- count === 1 ? "1 oggetto con questa etichetta" : `${count} oggetti con questa etichetta.`,
+ count === 1 ? "1 oggetto con questa etichetta." : `${count} oggetti con questa etichetta.`,
showingFirst: ({ count }) => `Prime ${count} etichette.`,
totalTags: ({ count }) => `Trovate ${count} etichette totali.`,
},
diff --git a/quartz/i18n/locales/ko-KR.ts b/quartz/i18n/locales/ko-KR.ts
index ed859a90e..ea735b00c 100644
--- a/quartz/i18n/locales/ko-KR.ts
+++ b/quartz/i18n/locales/ko-KR.ts
@@ -68,12 +68,12 @@ export default {
},
folderContent: {
folder: "폴더",
- itemsUnderFolder: ({ count }) => `${count}건의 페이지`,
+ itemsUnderFolder: ({ count }) => `${count}건의 항목`,
},
tagContent: {
tag: "태그",
tagIndex: "태그 목록",
- itemsUnderTag: ({ count }) => `${count}건의 페이지`,
+ itemsUnderTag: ({ count }) => `${count}건의 항목`,
showingFirst: ({ count }) => `처음 ${count}개의 태그`,
totalTags: ({ count }) => `총 ${count}개의 태그를 찾았습니다.`,
},
diff --git a/quartz/i18n/locales/nl-NL.ts b/quartz/i18n/locales/nl-NL.ts
index e239be0e1..d075d584a 100644
--- a/quartz/i18n/locales/nl-NL.ts
+++ b/quartz/i18n/locales/nl-NL.ts
@@ -70,7 +70,7 @@ export default {
folderContent: {
folder: "Map",
itemsUnderFolder: ({ count }) =>
- count === 1 ? "1 item in deze map" : `${count} items in deze map.`,
+ count === 1 ? "1 item in deze map." : `${count} items in deze map.`,
},
tagContent: {
tag: "Label",
diff --git a/quartz/i18n/locales/uk-UA.ts b/quartz/i18n/locales/uk-UA.ts
index c997a6972..b63693837 100644
--- a/quartz/i18n/locales/uk-UA.ts
+++ b/quartz/i18n/locales/uk-UA.ts
@@ -69,13 +69,13 @@ export default {
folderContent: {
folder: "Папка",
itemsUnderFolder: ({ count }) =>
- count === 1 ? "У цій папці 1 елемент" : `Елементів у цій папці: ${count}.`,
+ count === 1 ? "У цій папці 1 елемент." : `Елементів у цій папці: ${count}.`,
},
tagContent: {
tag: "Тег",
tagIndex: "Індекс тегу",
itemsUnderTag: ({ count }) =>
- count === 1 ? "1 елемент з цим тегом" : `Елементів з цим тегом: ${count}.`,
+ count === 1 ? "1 елемент з цим тегом." : `Елементів з цим тегом: ${count}.`,
showingFirst: ({ count }) => `Показ перших ${count} тегів.`,
totalTags: ({ count }) => `Всього знайдено тегів: ${count}.`,
},
diff --git a/quartz/plugins/emitters/404.tsx b/quartz/plugins/emitters/404.tsx
index f9d7a8620..e4605cfcd 100644
--- a/quartz/plugins/emitters/404.tsx
+++ b/quartz/plugins/emitters/404.tsx
@@ -46,6 +46,7 @@ export const NotFoundPage: QuartzEmitterPlugin = () => {
frontmatter: { title: notFound, tags: [] },
})
const componentData: QuartzComponentProps = {
+ ctx,
fileData: vfile.data,
externalResources,
cfg,
diff --git a/quartz/plugins/emitters/contentPage.tsx b/quartz/plugins/emitters/contentPage.tsx
index 904a8a8ca..f4938026e 100644
--- a/quartz/plugins/emitters/contentPage.tsx
+++ b/quartz/plugins/emitters/contentPage.tsx
@@ -97,6 +97,7 @@ export const ContentPage: QuartzEmitterPlugin> = (userOp
const externalResources = pageResources(pathToRoot(slug), resources)
const componentData: QuartzComponentProps = {
+ ctx,
fileData: file.data,
externalResources,
cfg,
diff --git a/quartz/plugins/emitters/folderPage.tsx b/quartz/plugins/emitters/folderPage.tsx
index bf69d2987..d892b282a 100644
--- a/quartz/plugins/emitters/folderPage.tsx
+++ b/quartz/plugins/emitters/folderPage.tsx
@@ -95,6 +95,7 @@ export const FolderPage: QuartzEmitterPlugin> = (userOpt
const externalResources = pageResources(pathToRoot(slug), resources)
const [tree, file] = folderDescriptions[folder]
const componentData: QuartzComponentProps = {
+ ctx,
fileData: file.data,
externalResources,
cfg,
diff --git a/quartz/plugins/emitters/tagPage.tsx b/quartz/plugins/emitters/tagPage.tsx
index 3eb6975f7..6f65ae477 100644
--- a/quartz/plugins/emitters/tagPage.tsx
+++ b/quartz/plugins/emitters/tagPage.tsx
@@ -99,6 +99,7 @@ export const TagPage: QuartzEmitterPlugin> = (userOpts)
const externalResources = pageResources(pathToRoot(slug), resources)
const [tree, file] = tagDescriptions[tag]
const componentData: QuartzComponentProps = {
+ ctx,
fileData: file.data,
externalResources,
cfg,
diff --git a/quartz/plugins/transformers/toc.ts b/quartz/plugins/transformers/toc.ts
index a31fb7c2d..c5bbcf0f5 100644
--- a/quartz/plugins/transformers/toc.ts
+++ b/quartz/plugins/transformers/toc.ts
@@ -6,7 +6,7 @@ import Slugger from "github-slugger"
export interface Options {
maxDepth: 1 | 2 | 3 | 4 | 5 | 6
- minEntries: 1
+ minEntries: number
showByDefault: boolean
collapseByDefault: boolean
}
@@ -52,7 +52,7 @@ export const TableOfContents: QuartzTransformerPlugin | undefin
}
})
- if (toc.length > opts.minEntries) {
+ if (toc.length > 0 && toc.length > opts.minEntries) {
file.data.toc = toc.map((entry) => ({
...entry,
depth: entry.depth - highestDepth,