From 21c6bbf3026cf9c06f6458bdb6614099d9a91adc Mon Sep 17 00:00:00 2001 From: Aaron Pham <29749331+aarnphm@users.noreply.github.com> Date: Tue, 13 Feb 2024 23:53:44 -0500 Subject: [PATCH 001/135] chore(types): add additional hint for LSP support (#864) Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com> --- quartz/components/ArticleTitle.tsx | 4 ++-- quartz/components/Backlinks.tsx | 9 +++++++-- quartz/components/Body.tsx | 4 ++-- quartz/components/Breadcrumbs.tsx | 9 +++++++-- quartz/components/Darkmode.tsx | 4 ++-- quartz/components/DesktopOnly.tsx | 2 +- quartz/components/Explorer.tsx | 9 +++++++-- quartz/components/Footer.tsx | 4 ++-- quartz/components/Graph.tsx | 4 ++-- quartz/components/Head.tsx | 4 ++-- quartz/components/Header.tsx | 4 ++-- quartz/components/MobileOnly.tsx | 2 +- quartz/components/PageList.tsx | 4 ++-- quartz/components/PageTitle.tsx | 4 ++-- quartz/components/RecentNotes.tsx | 9 +++++++-- quartz/components/Search.tsx | 4 ++-- quartz/components/TableOfContents.tsx | 10 +++++++--- quartz/components/TagList.tsx | 4 ++-- 18 files changed, 59 insertions(+), 35 deletions(-) diff --git a/quartz/components/ArticleTitle.tsx b/quartz/components/ArticleTitle.tsx index 7768de6cb..318aeb24e 100644 --- a/quartz/components/ArticleTitle.tsx +++ b/quartz/components/ArticleTitle.tsx @@ -1,7 +1,7 @@ -import { QuartzComponentConstructor, QuartzComponentProps } from "./types" +import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" import { classNames } from "../util/lang" -function ArticleTitle({ fileData, displayClass }: QuartzComponentProps) { +const ArticleTitle: QuartzComponent = ({ fileData, displayClass }: QuartzComponentProps) => { const title = fileData.frontmatter?.title if (title) { return

{title}

diff --git a/quartz/components/Backlinks.tsx b/quartz/components/Backlinks.tsx index 573c1c391..aa412a2e0 100644 --- a/quartz/components/Backlinks.tsx +++ b/quartz/components/Backlinks.tsx @@ -1,10 +1,15 @@ -import { QuartzComponentConstructor, QuartzComponentProps } from "./types" +import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" import style from "./styles/backlinks.scss" import { resolveRelative, simplifySlug } from "../util/path" import { i18n } from "../i18n" import { classNames } from "../util/lang" -function Backlinks({ fileData, allFiles, displayClass, cfg }: QuartzComponentProps) { +const Backlinks: QuartzComponent = ({ + fileData, + allFiles, + displayClass, + cfg, +}: QuartzComponentProps) => { const slug = simplifySlug(fileData.slug!) const backlinkFiles = allFiles.filter((file) => file.links?.includes(slug)) return ( diff --git a/quartz/components/Body.tsx b/quartz/components/Body.tsx index fbb857293..96b627883 100644 --- a/quartz/components/Body.tsx +++ b/quartz/components/Body.tsx @@ -1,9 +1,9 @@ // @ts-ignore import clipboardScript from "./scripts/clipboard.inline" import clipboardStyle from "./styles/clipboard.scss" -import { QuartzComponentConstructor, QuartzComponentProps } from "./types" +import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" -function Body({ children }: QuartzComponentProps) { +const Body: QuartzComponent = ({ children }: QuartzComponentProps) => { return
{children}
} diff --git a/quartz/components/Breadcrumbs.tsx b/quartz/components/Breadcrumbs.tsx index eab8a34e2..b1a924aa8 100644 --- a/quartz/components/Breadcrumbs.tsx +++ b/quartz/components/Breadcrumbs.tsx @@ -1,4 +1,4 @@ -import { QuartzComponentConstructor, QuartzComponentProps } from "./types" +import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" import breadcrumbsStyle from "./styles/breadcrumbs.scss" import { FullSlug, SimpleSlug, resolveRelative } from "../util/path" import { QuartzPluginData } from "../plugins/vfile" @@ -54,7 +54,11 @@ export default ((opts?: Partial) => { // computed index of folder name to its associated file data let folderIndex: Map | undefined - function Breadcrumbs({ fileData, allFiles, displayClass }: QuartzComponentProps) { + const Breadcrumbs: QuartzComponent = ({ + fileData, + allFiles, + displayClass, + }: QuartzComponentProps) => { // Hide crumbs on root if enabled if (options.hideOnRoot && fileData.slug === "index") { return <> @@ -121,5 +125,6 @@ export default ((opts?: Partial) => { ) } Breadcrumbs.css = breadcrumbsStyle + return Breadcrumbs }) satisfies QuartzComponentConstructor diff --git a/quartz/components/Darkmode.tsx b/quartz/components/Darkmode.tsx index 62d3c2382..8ed7c99b0 100644 --- a/quartz/components/Darkmode.tsx +++ b/quartz/components/Darkmode.tsx @@ -3,11 +3,11 @@ // see: https://v8.dev/features/modules#defer import darkmodeScript from "./scripts/darkmode.inline" import styles from "./styles/darkmode.scss" -import { QuartzComponentConstructor, QuartzComponentProps } from "./types" +import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" import { i18n } from "../i18n" import { classNames } from "../util/lang" -function Darkmode({ displayClass, cfg }: QuartzComponentProps) { +const Darkmode: QuartzComponent = ({ displayClass, cfg }: QuartzComponentProps) => { return (
diff --git a/quartz/components/DesktopOnly.tsx b/quartz/components/DesktopOnly.tsx index a11f23fa8..fe2a27f14 100644 --- a/quartz/components/DesktopOnly.tsx +++ b/quartz/components/DesktopOnly.tsx @@ -3,7 +3,7 @@ import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } fro export default ((component?: QuartzComponent) => { if (component) { const Component = component - function DesktopOnly(props: QuartzComponentProps) { + const DesktopOnly: QuartzComponent = (props: QuartzComponentProps) => { return } diff --git a/quartz/components/Explorer.tsx b/quartz/components/Explorer.tsx index f7017342e..cffc079ef 100644 --- a/quartz/components/Explorer.tsx +++ b/quartz/components/Explorer.tsx @@ -1,4 +1,4 @@ -import { QuartzComponentConstructor, QuartzComponentProps } from "./types" +import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" import explorerStyle from "./styles/explorer.scss" // @ts-ignore @@ -75,7 +75,12 @@ export default ((userOpts?: Partial) => { jsonTree = JSON.stringify(folders) } - function Explorer({ cfg, allFiles, displayClass, fileData }: QuartzComponentProps) { + const Explorer: QuartzComponent = ({ + cfg, + allFiles, + displayClass, + fileData, + }: QuartzComponentProps) => { constructFileTree(allFiles) return (
diff --git a/quartz/components/Footer.tsx b/quartz/components/Footer.tsx index de472f729..076c37874 100644 --- a/quartz/components/Footer.tsx +++ b/quartz/components/Footer.tsx @@ -1,4 +1,4 @@ -import { QuartzComponentConstructor, QuartzComponentProps } from "./types" +import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" import style from "./styles/footer.scss" import { version } from "../../package.json" import { i18n } from "../i18n" @@ -8,7 +8,7 @@ interface Options { } export default ((opts?: Options) => { - function Footer({ displayClass, cfg }: QuartzComponentProps) { + const Footer: QuartzComponent = ({ displayClass, cfg }: QuartzComponentProps) => { const year = new Date().getFullYear() const links = opts?.links ?? [] return ( diff --git a/quartz/components/Graph.tsx b/quartz/components/Graph.tsx index 9fce9bd8f..40ab43a2d 100644 --- a/quartz/components/Graph.tsx +++ b/quartz/components/Graph.tsx @@ -1,4 +1,4 @@ -import { QuartzComponentConstructor, QuartzComponentProps } from "./types" +import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" // @ts-ignore import script from "./scripts/graph.inline" import style from "./styles/graph.scss" @@ -54,7 +54,7 @@ const defaultOptions: GraphOptions = { } export default ((opts?: GraphOptions) => { - function Graph({ displayClass, cfg }: QuartzComponentProps) { + const Graph: QuartzComponent = ({ displayClass, cfg }: QuartzComponentProps) => { const localGraph = { ...defaultOptions.localGraph, ...opts?.localGraph } const globalGraph = { ...defaultOptions.globalGraph, ...opts?.globalGraph } return ( diff --git a/quartz/components/Head.tsx b/quartz/components/Head.tsx index 8292acc05..a3c0800ab 100644 --- a/quartz/components/Head.tsx +++ b/quartz/components/Head.tsx @@ -1,10 +1,10 @@ import { i18n } from "../i18n" import { FullSlug, joinSegments, pathToRoot } from "../util/path" import { JSResourceToScriptElement } from "../util/resources" -import { QuartzComponentConstructor, QuartzComponentProps } from "./types" +import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" export default (() => { - function Head({ cfg, fileData, externalResources }: QuartzComponentProps) { + const Head: QuartzComponent = ({ cfg, fileData, externalResources }: QuartzComponentProps) => { const title = fileData.frontmatter?.title ?? i18n(cfg.locale).propertyDefaults.title const description = fileData.description?.trim() ?? i18n(cfg.locale).propertyDefaults.description diff --git a/quartz/components/Header.tsx b/quartz/components/Header.tsx index 5281f7296..eba17ae09 100644 --- a/quartz/components/Header.tsx +++ b/quartz/components/Header.tsx @@ -1,6 +1,6 @@ -import { QuartzComponentConstructor, QuartzComponentProps } from "./types" +import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" -function Header({ children }: QuartzComponentProps) { +const Header: QuartzComponent = ({ children }: QuartzComponentProps) => { return children.length > 0 ?
{children}
: null } diff --git a/quartz/components/MobileOnly.tsx b/quartz/components/MobileOnly.tsx index 5a190957b..7d2108de7 100644 --- a/quartz/components/MobileOnly.tsx +++ b/quartz/components/MobileOnly.tsx @@ -3,7 +3,7 @@ import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } fro export default ((component?: QuartzComponent) => { if (component) { const Component = component - function MobileOnly(props: QuartzComponentProps) { + const MobileOnly: QuartzComponent = (props: QuartzComponentProps) => { return } diff --git a/quartz/components/PageList.tsx b/quartz/components/PageList.tsx index 644e354c4..62b77b17b 100644 --- a/quartz/components/PageList.tsx +++ b/quartz/components/PageList.tsx @@ -1,7 +1,7 @@ import { FullSlug, resolveRelative } from "../util/path" import { QuartzPluginData } from "../plugins/vfile" import { Date, getDate } from "./Date" -import { QuartzComponentProps } from "./types" +import { QuartzComponent, QuartzComponentProps } from "./types" import { GlobalConfiguration } from "../cfg" export function byDateAndAlphabetical( @@ -29,7 +29,7 @@ type Props = { limit?: number } & QuartzComponentProps -export function PageList({ cfg, fileData, allFiles, limit }: Props) { +export const PageList: QuartzComponent = ({ cfg, fileData, allFiles, limit }: Props) => { let list = allFiles.sort(byDateAndAlphabetical(cfg)) if (limit) { list = list.slice(0, limit) diff --git a/quartz/components/PageTitle.tsx b/quartz/components/PageTitle.tsx index d12960264..2362f1027 100644 --- a/quartz/components/PageTitle.tsx +++ b/quartz/components/PageTitle.tsx @@ -1,9 +1,9 @@ import { pathToRoot } from "../util/path" -import { QuartzComponentConstructor, QuartzComponentProps } from "./types" +import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" import { classNames } from "../util/lang" import { i18n } from "../i18n" -function PageTitle({ fileData, cfg, displayClass }: QuartzComponentProps) { +const PageTitle: QuartzComponent = ({ fileData, cfg, displayClass }: QuartzComponentProps) => { const title = cfg?.pageTitle ?? i18n(cfg.locale).propertyDefaults.title const baseDir = pathToRoot(fileData.slug!) return ( diff --git a/quartz/components/RecentNotes.tsx b/quartz/components/RecentNotes.tsx index f8f6de41f..549b025d3 100644 --- a/quartz/components/RecentNotes.tsx +++ b/quartz/components/RecentNotes.tsx @@ -1,4 +1,4 @@ -import { QuartzComponentConstructor, QuartzComponentProps } from "./types" +import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" import { FullSlug, SimpleSlug, resolveRelative } from "../util/path" import { QuartzPluginData } from "../plugins/vfile" import { byDateAndAlphabetical } from "./PageList" @@ -24,7 +24,12 @@ const defaultOptions = (cfg: GlobalConfiguration): Options => ({ }) export default ((userOpts?: Partial) => { - function RecentNotes({ allFiles, fileData, displayClass, cfg }: QuartzComponentProps) { + const RecentNotes: QuartzComponent = ({ + allFiles, + fileData, + displayClass, + cfg, + }: QuartzComponentProps) => { const opts = { ...defaultOptions(cfg), ...userOpts } const pages = allFiles.filter(opts.filter).sort(opts.sort) const remaining = Math.max(0, pages.length - opts.limit) diff --git a/quartz/components/Search.tsx b/quartz/components/Search.tsx index a07dbc4fd..01e5a353d 100644 --- a/quartz/components/Search.tsx +++ b/quartz/components/Search.tsx @@ -1,4 +1,4 @@ -import { QuartzComponentConstructor, QuartzComponentProps } from "./types" +import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" import style from "./styles/search.scss" // @ts-ignore import script from "./scripts/search.inline" @@ -14,7 +14,7 @@ const defaultOptions: SearchOptions = { } export default ((userOpts?: Partial) => { - function Search({ displayClass, cfg }: QuartzComponentProps) { + const Search: QuartzComponent = ({ displayClass, cfg }: QuartzComponentProps) => { const opts = { ...defaultOptions, ...userOpts } const searchPlaceholder = i18n(cfg.locale).components.search.searchBarPlaceholder return ( diff --git a/quartz/components/TableOfContents.tsx b/quartz/components/TableOfContents.tsx index 2abc74b53..77ff0eb10 100644 --- a/quartz/components/TableOfContents.tsx +++ b/quartz/components/TableOfContents.tsx @@ -1,4 +1,4 @@ -import { QuartzComponentConstructor, QuartzComponentProps } from "./types" +import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" import legacyStyle from "./styles/legacyToc.scss" import modernStyle from "./styles/toc.scss" import { classNames } from "../util/lang" @@ -15,7 +15,11 @@ const defaultOptions: Options = { layout: "modern", } -function TableOfContents({ fileData, displayClass, cfg }: QuartzComponentProps) { +const TableOfContents: QuartzComponent = ({ + fileData, + displayClass, + cfg, +}: QuartzComponentProps) => { if (!fileData.toc) { return null } @@ -56,7 +60,7 @@ function TableOfContents({ fileData, displayClass, cfg }: QuartzComponentProps) TableOfContents.css = modernStyle TableOfContents.afterDOMLoaded = script -function LegacyTableOfContents({ fileData, cfg }: QuartzComponentProps) { +const LegacyTableOfContents: QuartzComponent = ({ fileData, cfg }: QuartzComponentProps) => { if (!fileData.toc) { return null } diff --git a/quartz/components/TagList.tsx b/quartz/components/TagList.tsx index e5dd1a3ae..04a483b6c 100644 --- a/quartz/components/TagList.tsx +++ b/quartz/components/TagList.tsx @@ -1,8 +1,8 @@ import { pathToRoot, slugTag } from "../util/path" -import { QuartzComponentConstructor, QuartzComponentProps } from "./types" +import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" import { classNames } from "../util/lang" -function TagList({ fileData, displayClass }: QuartzComponentProps) { +const TagList: QuartzComponent = ({ fileData, displayClass }: QuartzComponentProps) => { const tags = fileData.frontmatter?.tags const baseDir = pathToRoot(fileData.slug!) if (tags && tags.length > 0) { From 2041341d9fd9a3b674d7fa7286ad5b6e99ce80e5 Mon Sep 17 00:00:00 2001 From: Aaron Bull Schaefer Date: Wed, 14 Feb 2024 09:41:44 -0800 Subject: [PATCH 002/135] docs: workaround for shallow clones on Cloudflare Pages (#868) Rather than recommend a different hosting provider, Cloudflare Pages users that prioritize the `git` method for their `CreatedModifiedDate` configuration can preface the build command with a means of fetching the required repository history. See: - https://gohugo.io/methods/page/gitinfo/#hosting-considerations --- docs/hosting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/hosting.md b/docs/hosting.md index e6340d293..bae7ed899 100644 --- a/docs/hosting.md +++ b/docs/hosting.md @@ -30,7 +30,7 @@ Press "Save and deploy" and Cloudflare should have a deployed version of your si To add a custom domain, check out [Cloudflare's documentation](https://developers.cloudflare.com/pages/platform/custom-domains/). > [!warning] -> Cloudflare Pages only allows shallow `git` clones so if you rely on `git` for timestamps, it is recommended you either add dates to your frontmatter (see [[authoring content#Syntax]]) or use another hosting provider. +> Cloudflare Pages performs a shallow clone by default, so if you rely on `git` for timestamps, it is recommended that you add `git fetch --unshallow &&` to the beginning of the build command (e.g., `git fetch --unshallow && npx quartz build`). ## GitHub Pages From 6c8023463d0e4ea68be3216c454775fd87d3e370 Mon Sep 17 00:00:00 2001 From: David Fischer Date: Wed, 14 Feb 2024 21:41:13 +0100 Subject: [PATCH 003/135] Add support for image popovers (#854) * feat(popover): Add support for images * fix: run prettier * feat(popover): use switch logic for content types & adjust styles * feat(popover): Add content type data tag for popover-inner class --- docs/features/popover previews.md | 2 ++ quartz/components/scripts/popover.inline.ts | 40 +++++++++++++++------ quartz/components/styles/popover.scss | 11 ++++++ 3 files changed, 42 insertions(+), 11 deletions(-) diff --git a/docs/features/popover previews.md b/docs/features/popover previews.md index f88222402..066604758 100644 --- a/docs/features/popover previews.md +++ b/docs/features/popover previews.md @@ -8,6 +8,8 @@ By default, Quartz only fetches previews for pages inside your vault due to [COR When [[creating components|creating your own components]], you can include this `popover-hint` class to also include it in the popover. +Similar to Obsidian, [[quartz layout.png|images referenced using wikilinks]] can also be viewed as popups. + ## Configuration - Remove popovers: set the `enablePopovers` field in `quartz.config.ts` to be `false`. diff --git a/quartz/components/scripts/popover.inline.ts b/quartz/components/scripts/popover.inline.ts index 0251834cb..d0346b05b 100644 --- a/quartz/components/scripts/popover.inline.ts +++ b/quartz/components/scripts/popover.inline.ts @@ -37,29 +37,47 @@ async function mouseEnterHandler( targetUrl.hash = "" targetUrl.search = "" - const contents = await fetch(`${targetUrl}`) - .then((res) => res.text()) - .catch((err) => { - console.error(err) - }) + const response = await fetch(`${targetUrl}`).catch((err) => { + console.error(err) + }) // bailout if another popover exists if (hasAlreadyBeenFetched()) { return } - if (!contents) return - const html = p.parseFromString(contents, "text/html") - normalizeRelativeURLs(html, targetUrl) - const elts = [...html.getElementsByClassName("popover-hint")] - if (elts.length === 0) return + if (!response) return + const contentType = response.headers.get("Content-Type") + const contentTypeCategory = contentType?.split("/")[0] ?? "text" const popoverElement = document.createElement("div") popoverElement.classList.add("popover") const popoverInner = document.createElement("div") popoverInner.classList.add("popover-inner") popoverElement.appendChild(popoverInner) - elts.forEach((elt) => popoverInner.appendChild(elt)) + + popoverInner.dataset.contentType = contentTypeCategory + + switch (contentTypeCategory) { + case "image": + const img = document.createElement("img") + + response.blob().then((blob) => { + img.src = URL.createObjectURL(blob) + }) + img.alt = targetUrl.pathname + + popoverInner.appendChild(img) + break + default: + const contents = await response.text() + const html = p.parseFromString(contents, "text/html") + normalizeRelativeURLs(html, targetUrl) + const elts = [...html.getElementsByClassName("popover-hint")] + if (elts.length === 0) return + + elts.forEach((elt) => popoverInner.appendChild(elt)) + } setPosition(popoverElement) link.appendChild(popoverElement) diff --git a/quartz/components/styles/popover.scss b/quartz/components/styles/popover.scss index e46292a21..141b89ddf 100644 --- a/quartz/components/styles/popover.scss +++ b/quartz/components/styles/popover.scss @@ -38,6 +38,17 @@ white-space: normal; } + & > .popover-inner[data-content-type="image"] { + padding: 0; + max-height: 100%; + + img { + margin: 0; + border-radius: 0; + display: block; + } + } + h1 { font-size: 1.5rem; } From 78a408c96a221629ce1a8b70a17ed4981aad1336 Mon Sep 17 00:00:00 2001 From: kabirgh <15871468+kabirgh@users.noreply.github.com> Date: Fri, 16 Feb 2024 00:50:33 +0000 Subject: [PATCH 004/135] feat: implement getDependencyGraph for FolderPage (#849) --- quartz/plugins/emitters/folderPage.tsx | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/quartz/plugins/emitters/folderPage.tsx b/quartz/plugins/emitters/folderPage.tsx index 690fa56f7..bf69d2987 100644 --- a/quartz/plugins/emitters/folderPage.tsx +++ b/quartz/plugins/emitters/folderPage.tsx @@ -38,12 +38,21 @@ export const FolderPage: QuartzEmitterPlugin> = (userOpt getQuartzComponents() { return [Head, Header, Body, ...header, ...beforeBody, pageBody, ...left, ...right, Footer] }, - async getDependencyGraph(_ctx, _content, _resources) { + async getDependencyGraph(_ctx, content, _resources) { // Example graph: - // nested/file.md --> nested/file.html - // \-------> nested/index.html - // TODO implement - return new DepGraph() + // nested/file.md --> nested/index.html + // nested/file2.md ------^ + const graph = new DepGraph() + + content.map(([_tree, vfile]) => { + const slug = vfile.data.slug + const folderName = path.dirname(slug ?? "") as SimpleSlug + if (slug && folderName !== "." && folderName !== "tags") { + graph.addEdge(vfile.data.filePath!, joinSegments(folderName, "index.html") as FilePath) + } + }) + + return graph }, async emit(ctx, content, resources): Promise { const fps: FilePath[] = [] From 823d9529224d70056be9dbac29dbbc66f75ae5e8 Mon Sep 17 00:00:00 2001 From: kabirgh <15871468+kabirgh@users.noreply.github.com> Date: Fri, 16 Feb 2024 00:50:48 +0000 Subject: [PATCH 005/135] feat: implement getDependencyGraph for AliasRedirects emitter (#860) --- quartz/plugins/emitters/aliases.ts | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/quartz/plugins/emitters/aliases.ts b/quartz/plugins/emitters/aliases.ts index fb25a448e..af3578ebe 100644 --- a/quartz/plugins/emitters/aliases.ts +++ b/quartz/plugins/emitters/aliases.ts @@ -9,9 +9,30 @@ export const AliasRedirects: QuartzEmitterPlugin = () => ({ getQuartzComponents() { return [] }, - async getDependencyGraph(_ctx, _content, _resources) { - // TODO implement - return new DepGraph() + async getDependencyGraph(ctx, content, _resources) { + const graph = new DepGraph() + + const { argv } = ctx + for (const [_tree, file] of content) { + const dir = path.posix.relative(argv.directory, path.dirname(file.data.filePath!)) + const aliases = file.data.frontmatter?.aliases ?? [] + const slugs = aliases.map((alias) => path.posix.join(dir, alias) as FullSlug) + const permalink = file.data.frontmatter?.permalink + if (typeof permalink === "string") { + slugs.push(permalink as FullSlug) + } + + for (let slug of slugs) { + // fix any slugs that have trailing slash + if (slug.endsWith("/")) { + slug = joinSegments(slug, "index") as FullSlug + } + + graph.addEdge(file.data.filePath!, joinSegments(argv.output, slug + ".html") as FilePath) + } + } + + return graph }, async emit(ctx, content, _resources): Promise { const { argv } = ctx From 5af707ea20e8106857750e1d6a0e43cf18679749 Mon Sep 17 00:00:00 2001 From: kabirgh <15871468+kabirgh@users.noreply.github.com> Date: Sat, 17 Feb 2024 17:45:01 +0000 Subject: [PATCH 006/135] fix/feat(fast rebuild): re-render transclusions in normal and fastRebuild mode (#842) * Re-render transclusions in normal watch mode * Include transclusions in ContentPage getDependencyGraph * Address PR comments --- quartz/components/renderPage.tsx | 26 +++++-------- quartz/plugins/emitters/contentPage.tsx | 49 +++++++++++++++++++++++-- 2 files changed, 56 insertions(+), 19 deletions(-) diff --git a/quartz/components/renderPage.tsx b/quartz/components/renderPage.tsx index 33671d21d..5394d6f4c 100644 --- a/quartz/components/renderPage.tsx +++ b/quartz/components/renderPage.tsx @@ -3,10 +3,9 @@ import { QuartzComponent, QuartzComponentProps } from "./types" import HeaderConstructor from "./Header" import BodyConstructor from "./Body" import { JSResourceToScriptElement, StaticResources } from "../util/resources" -import { FullSlug, RelativeURL, joinSegments, normalizeHastElement } from "../util/path" +import { clone, FullSlug, RelativeURL, joinSegments, normalizeHastElement } from "../util/path" import { visit } from "unist-util-visit" import { Root, Element, ElementContent } from "hast" -import { QuartzPluginData } from "../plugins/vfile" import { GlobalConfiguration } from "../cfg" import { i18n } from "../i18n" @@ -52,18 +51,6 @@ export function pageResources( } } -let pageIndex: Map | undefined = undefined -function getOrComputeFileIndex(allFiles: QuartzPluginData[]): Map { - if (!pageIndex) { - pageIndex = new Map() - for (const file of allFiles) { - pageIndex.set(file.slug!, file) - } - } - - return pageIndex -} - export function renderPage( cfg: GlobalConfiguration, slug: FullSlug, @@ -71,14 +58,18 @@ export function renderPage( components: RenderComponents, pageResources: StaticResources, ): string { + // make a deep copy of the tree so we don't remove the transclusion references + // for the file cached in contentMap in build.ts + const root = clone(componentData.tree) as Root + // process transcludes in componentData - visit(componentData.tree as Root, "element", (node, _index, _parent) => { + visit(root, "element", (node, _index, _parent) => { if (node.tagName === "blockquote") { const classNames = (node.properties?.className ?? []) as string[] if (classNames.includes("transclude")) { const inner = node.children[0] as Element const transcludeTarget = inner.properties["data-slug"] as FullSlug - const page = getOrComputeFileIndex(componentData.allFiles).get(transcludeTarget) + const page = componentData.allFiles.find((f) => f.slug === transcludeTarget) if (!page) { return } @@ -181,6 +172,9 @@ export function renderPage( } }) + // set componentData.tree to the edited html that has transclusions rendered + componentData.tree = root + const { head: Head, header, diff --git a/quartz/plugins/emitters/contentPage.tsx b/quartz/plugins/emitters/contentPage.tsx index e531b36e8..904a8a8ca 100644 --- a/quartz/plugins/emitters/contentPage.tsx +++ b/quartz/plugins/emitters/contentPage.tsx @@ -1,16 +1,56 @@ +import path from "path" +import { visit } from "unist-util-visit" +import { Root } from "hast" +import { VFile } from "vfile" import { QuartzEmitterPlugin } from "../types" import { QuartzComponentProps } from "../../components/types" import HeaderConstructor from "../../components/Header" import BodyConstructor from "../../components/Body" import { pageResources, renderPage } from "../../components/renderPage" import { FullPageLayout } from "../../cfg" -import { FilePath, joinSegments, pathToRoot } from "../../util/path" +import { Argv } from "../../util/ctx" +import { FilePath, isRelativeURL, joinSegments, pathToRoot } from "../../util/path" import { defaultContentPageLayout, sharedPageComponents } from "../../../quartz.layout" import { Content } from "../../components" import chalk from "chalk" import { write } from "./helpers" import DepGraph from "../../depgraph" +// get all the dependencies for the markdown file +// eg. images, scripts, stylesheets, transclusions +const parseDependencies = (argv: Argv, hast: Root, file: VFile): string[] => { + const dependencies: string[] = [] + + visit(hast, "element", (elem): void => { + let ref: string | null = null + + if ( + ["script", "img", "audio", "video", "source", "iframe"].includes(elem.tagName) && + elem?.properties?.src + ) { + ref = elem.properties.src.toString() + } else if (["a", "link"].includes(elem.tagName) && elem?.properties?.href) { + // transclusions will create a tags with relative hrefs + ref = elem.properties.href.toString() + } + + // if it is a relative url, its a local file and we need to add + // it to the dependency graph. otherwise, ignore + if (ref === null || !isRelativeURL(ref)) { + return + } + + let fp = path.join(file.data.filePath!, path.relative(argv.directory, ref)).replace(/\\/g, "/") + // markdown files have the .md extension stripped in hrefs, add it back here + if (!fp.split("/").pop()?.includes(".")) { + fp += ".md" + } + dependencies.push(fp) + }) + + return dependencies +} + export const ContentPage: QuartzEmitterPlugin> = (userOpts) => { const opts: FullPageLayout = { ...sharedPageComponents, @@ -29,13 +69,16 @@ export const ContentPage: QuartzEmitterPlugin> = (userOp return [Head, Header, Body, ...header, ...beforeBody, pageBody, ...left, ...right, Footer] }, async getDependencyGraph(ctx, content, _resources) { - // TODO handle transclusions const graph = new DepGraph() - for (const [_tree, file] of content) { + for (const [tree, file] of content) { const sourcePath = file.data.filePath! const slug = file.data.slug! graph.addEdge(sourcePath, joinSegments(ctx.argv.output, slug + ".html") as FilePath) + + parseDependencies(ctx.argv, tree as Root, file).forEach((dep) => { + graph.addEdge(dep as FilePath, sourcePath) + }) } return graph From fa2ea2896f0977253733334199d28e509351e621 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Silviu=20Loren=C8=9B?= <124451350+smilorent@users.noreply.github.com> Date: Sat, 17 Feb 2024 20:23:45 +0200 Subject: [PATCH 007/135] feat: add user-defined config for syntax highlighting plugin (#869) * feat: add user-defined options to syntax highlighting plugin * feat: add default syntax highlighting config to `quartz.config.ts` * chore: refactor according to @aarnphm's review Co-authored-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> * chore: run Prettier on `quartz/plugins/transformers/syntax.ts` * Update quartz/plugins/transformers/syntax.ts Co-authored-by: Jacky Zhao * Update syntax.ts --------- Co-authored-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> Co-authored-by: Jacky Zhao --- quartz.config.ts | 11 ++++++- quartz/plugins/transformers/syntax.ts | 47 +++++++++++++++++---------- 2 files changed, 40 insertions(+), 18 deletions(-) diff --git a/quartz.config.ts b/quartz.config.ts index 4e36e9408..8c479ac78 100644 --- a/quartz.config.ts +++ b/quartz.config.ts @@ -53,7 +53,16 @@ const config: QuartzConfig = { priority: ["frontmatter", "filesystem"], }), Plugin.Latex({ renderEngine: "katex" }), - Plugin.SyntaxHighlighting(), + Plugin.SyntaxHighlighting({ + // uses themes bundled with Shikiji, see https://shikiji.netlify.app/themes + theme: { + light: "github-light", + dark: "github-dark", + }, + // set this to 'true' to use the background color of the Shikiji theme + // if set to 'false', will use Quartz theme colors for background + keepBackground: false, + }), Plugin.ObsidianFlavoredMarkdown({ enableInHtmlEmbed: false }), Plugin.GitHubFlavoredMarkdown(), Plugin.TableOfContents(), diff --git a/quartz/plugins/transformers/syntax.ts b/quartz/plugins/transformers/syntax.ts index e84772962..f11734e5f 100644 --- a/quartz/plugins/transformers/syntax.ts +++ b/quartz/plugins/transformers/syntax.ts @@ -1,20 +1,33 @@ import { QuartzTransformerPlugin } from "../types" -import rehypePrettyCode, { Options as CodeOptions } from "rehype-pretty-code" +import rehypePrettyCode, { Options as CodeOptions, Theme as CodeTheme } from "rehype-pretty-code" -export const SyntaxHighlighting: QuartzTransformerPlugin = () => ({ - name: "SyntaxHighlighting", - htmlPlugins() { - return [ - [ - rehypePrettyCode, - { - keepBackground: false, - theme: { - dark: "github-dark", - light: "github-light", - }, - } satisfies Partial, - ], - ] +interface Theme extends Record { + light: CodeTheme + dark: CodeTheme +} + +interface Options { + theme?: Theme + keepBackground?: boolean +} + +const defaultOptions: Options = { + theme: { + light: "github-light", + dark: "github-dark", }, -}) + keepBackground: false, +} + +export const SyntaxHighlighting: QuartzTransformerPlugin = ( + userOpts?: Partial, +) => { + const opts: Partial = { ...defaultOptions, ...userOpts } + + return { + name: "SyntaxHighlighting", + htmlPlugins() { + return [[rehypePrettyCode, opts]] + }, + } +} From 06e3f8b93d5fbe96e7a05e4eb6be97b6a2d7ead0 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Sat, 17 Feb 2024 10:34:46 -0800 Subject: [PATCH 008/135] fix(style): introduce semiBoldWeight and various improvements to reduce CLS --- quartz/components/Head.tsx | 12 ++++++------ quartz/components/styles/explorer.scss | 4 ++-- quartz/plugins/emitters/componentResources.ts | 9 ++++----- quartz/styles/base.scss | 2 +- quartz/styles/callouts.scss | 2 +- quartz/styles/variables.scss | 1 + 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/quartz/components/Head.tsx b/quartz/components/Head.tsx index a3c0800ab..3cb6bea66 100644 --- a/quartz/components/Head.tsx +++ b/quartz/components/Head.tsx @@ -21,6 +21,12 @@ export default (() => { {title} + {cfg.theme.cdnCaching && ( + <> + + + + )} @@ -30,12 +36,6 @@ export default (() => { - {cfg.theme.cdnCaching && ( - <> - - - - )} {css.map((href) => ( ))} diff --git a/quartz/components/styles/explorer.scss b/quartz/components/styles/explorer.scss index 34f180cf2..55ea8aa88 100644 --- a/quartz/components/styles/explorer.scss +++ b/quartz/components/styles/explorer.scss @@ -87,7 +87,7 @@ svg { color: var(--secondary); font-family: var(--headerFont); font-size: 0.95rem; - font-weight: $boldWeight; + font-weight: $semiBoldWeight; line-height: 1.5rem; display: inline-block; } @@ -112,7 +112,7 @@ svg { font-size: 0.95rem; display: inline-block; color: var(--secondary); - font-weight: $boldWeight; + font-weight: $semiBoldWeight; margin: 0; line-height: 1.5rem; pointer-events: none; diff --git a/quartz/plugins/emitters/componentResources.ts b/quartz/plugins/emitters/componentResources.ts index 67bc69c3d..046841689 100644 --- a/quartz/plugins/emitters/componentResources.ts +++ b/quartz/plugins/emitters/componentResources.ts @@ -196,10 +196,6 @@ export const ComponentResources: QuartzEmitterPlugin = (opts?: Partial< const cfg = ctx.cfg.configuration // component specific scripts and styles const componentResources = getComponentResources(ctx) - // important that this goes *after* component scripts - // as the "nav" event gets triggered here and we should make sure - // that everyone else had the chance to register a listener for it - let googleFontsStyleSheet = "" if (fontOrigin === "local") { // let the user do it themselves in css @@ -247,12 +243,15 @@ export const ComponentResources: QuartzEmitterPlugin = (opts?: Partial< } } + // important that this goes *after* component scripts + // as the "nav" event gets triggered here and we should make sure + // that everyone else had the chance to register a listener for it addGlobalPageResources(ctx, resources, componentResources) const stylesheet = joinStyles( ctx.cfg.configuration.theme, - ...componentResources.css, googleFontsStyleSheet, + ...componentResources.css, styles, ) const [prescript, postscript] = await Promise.all([ diff --git a/quartz/styles/base.scss b/quartz/styles/base.scss index f0e7c14d1..6c8f836ab 100644 --- a/quartz/styles/base.scss +++ b/quartz/styles/base.scss @@ -54,7 +54,7 @@ ul, } a { - font-weight: $boldWeight; + font-weight: $semiBoldWeight; text-decoration: none; transition: color 0.2s ease; color: var(--secondary); diff --git a/quartz/styles/callouts.scss b/quartz/styles/callouts.scss index 7fa52c506..b1fd180ce 100644 --- a/quartz/styles/callouts.scss +++ b/quartz/styles/callouts.scss @@ -157,6 +157,6 @@ } .callout-title-inner { - font-weight: $boldWeight; + font-weight: $semiBoldWeight; } } diff --git a/quartz/styles/variables.scss b/quartz/styles/variables.scss index 8384b9c4e..e45cc9158 100644 --- a/quartz/styles/variables.scss +++ b/quartz/styles/variables.scss @@ -5,4 +5,5 @@ $sidePanelWidth: 380px; $topSpacing: 6rem; $fullPageWidth: $pageWidth + 2 * $sidePanelWidth; $boldWeight: 700; +$semiBoldWeight: 600; $normalWeight: 400; From a6690c6503ca6b2957a4476671c7239212b81b1a Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Sat, 17 Feb 2024 10:57:59 -0800 Subject: [PATCH 009/135] fix(style): bold should use semibold --- quartz/styles/base.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/quartz/styles/base.scss b/quartz/styles/base.scss index 6c8f836ab..92798a2da 100644 --- a/quartz/styles/base.scss +++ b/quartz/styles/base.scss @@ -53,6 +53,10 @@ ul, } } +strong { + font-weight: $semiBoldWeight; +} + a { font-weight: $semiBoldWeight; text-decoration: none; From aa24a62ae77ed1bd3edd4b617cd76d7a056c7f1c Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Sat, 17 Feb 2024 11:12:35 -0800 Subject: [PATCH 010/135] fix(breadcrumbs): calculate trailing slash for tag hierarchies (closes #873) --- quartz/components/Breadcrumbs.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/quartz/components/Breadcrumbs.tsx b/quartz/components/Breadcrumbs.tsx index b1a924aa8..9ccfb9a6a 100644 --- a/quartz/components/Breadcrumbs.tsx +++ b/quartz/components/Breadcrumbs.tsx @@ -1,6 +1,6 @@ import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" import breadcrumbsStyle from "./styles/breadcrumbs.scss" -import { FullSlug, SimpleSlug, resolveRelative } from "../util/path" +import { FullSlug, SimpleSlug, joinSegments, resolveRelative } from "../util/path" import { QuartzPluginData } from "../plugins/vfile" import { classNames } from "../util/lang" @@ -82,8 +82,12 @@ export default ((opts?: Partial) => { // Split slug into hierarchy/parts const slugParts = fileData.slug?.split("/") if (slugParts) { + // is tag breadcrumb? + const isTagPath = slugParts[0] === "tags" + // full path until current part let currentPath = "" + for (let i = 0; i < slugParts.length - 1; i++) { let curPathSegment = slugParts[i] @@ -97,10 +101,15 @@ export default ((opts?: Partial) => { } // Add current slug to full path - currentPath += slugParts[i] + "/" + currentPath = joinSegments(currentPath, slugParts[i]) + const includeTrailingSlash = !isTagPath || i < 1 // Format and add current crumb - const crumb = formatCrumb(curPathSegment, fileData.slug!, currentPath as SimpleSlug) + const crumb = formatCrumb( + curPathSegment, + fileData.slug!, + (currentPath + (includeTrailingSlash ? "/" : "")) as SimpleSlug, + ) crumbs.push(crumb) } From 8c5c5f9130c65fcc48412a24b0a6c98b254f1934 Mon Sep 17 00:00:00 2001 From: makondratev <69584771+makondratev@users.noreply.github.com> Date: Sun, 18 Feb 2024 21:54:37 +0300 Subject: [PATCH 011/135] feat(i18n): add Russian (#886) --- quartz/i18n/index.ts | 2 + quartz/i18n/locales/ru-RU.ts | 95 ++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 quartz/i18n/locales/ru-RU.ts diff --git a/quartz/i18n/index.ts b/quartz/i18n/index.ts index c4fa4251c..1e4853f40 100644 --- a/quartz/i18n/index.ts +++ b/quartz/i18n/index.ts @@ -8,6 +8,7 @@ import ro from "./locales/ro-RO" import es from "./locales/es-ES" import ar from "./locales/ar-SA" import uk from "./locales/uk-UA" +import ru from "./locales/ru-RU" export const TRANSLATIONS = { "en-US": en, @@ -40,6 +41,7 @@ export const TRANSLATIONS = { "ar-DZ": ar, "ar-MR": ar, "uk-UA": uk, + "ru-RU": ru, } as const export const defaultTranslation = "en-US" diff --git a/quartz/i18n/locales/ru-RU.ts b/quartz/i18n/locales/ru-RU.ts new file mode 100644 index 000000000..8ead3cabe --- /dev/null +++ b/quartz/i18n/locales/ru-RU.ts @@ -0,0 +1,95 @@ +import { Translation } from "./definition" + +export default { + propertyDefaults: { + title: "Без названия", + description: "Описание отсутствует", + }, + components: { + callout: { + note: "Заметка", + abstract: "Резюме", + info: "Инфо", + todo: "Сделать", + tip: "Подсказка", + success: "Успех", + question: "Вопрос", + warning: "Предупреждение", + failure: "Неудача", + danger: "Опасность", + bug: "Баг", + example: "Пример", + quote: "Цитата", + }, + backlinks: { + title: "Обратные ссылки", + noBacklinksFound: "Обратные ссылки отсутствуют", + }, + themeToggle: { + lightMode: "Светлый режим", + darkMode: "Тёмный режим", + }, + explorer: { + title: "Проводник", + }, + footer: { + createdWith: "Создано с помощью", + }, + graph: { + title: "Вид графа", + }, + recentNotes: { + title: "Недавние заметки", + seeRemainingMore: ({ remaining }) => + `Посмотреть оставш${getForm(remaining, "уюся", "иеся", "иеся")} ${remaining} →`, + }, + transcludes: { + transcludeOf: ({ targetSlug }) => `Переход из ${targetSlug}`, + linkToOriginal: "Ссылка на оригинал", + }, + search: { + title: "Поиск", + searchBarPlaceholder: "Найти что-нибудь", + }, + tableOfContents: { + title: "Оглавление", + }, + contentMeta: { + readingTime: ({ minutes }) => `время чтения ~${minutes} мин.`, + }, + }, + pages: { + rss: { + recentNotes: "Недавние заметки", + lastFewNotes: ({ count }) => + `Последн${getForm(count, "яя", "ие", "ие")} ${count} замет${getForm(count, "ка", "ки", "ок")}`, + }, + error: { + title: "Страница не найдена", + notFound: "Эта страница приватная или не существует", + }, + folderContent: { + folder: "Папка", + itemsUnderFolder: ({ count }) => + `в этой папке ${count} элемент${getForm(count, "", "а", "ов")}`, + }, + tagContent: { + tag: "Тег", + tagIndex: "Индекс тегов", + itemsUnderTag: ({ count }) => `с этим тегом ${count} элемент${getForm(count, "", "а", "ов")}`, + showingFirst: ({ count }) => + `Показыва${getForm(count, "ется", "ются", "ются")} ${count} тег${getForm(count, "", "а", "ов")}`, + totalTags: ({ count }) => `Всего ${count} тег${getForm(count, "", "а", "ов")}`, + }, + }, +} as const satisfies Translation + +function getForm(number: number, form1: string, form2: string, form5: string): string { + const remainder100 = number % 100 + const remainder10 = remainder100 % 10 + + if (remainder100 >= 10 && remainder100 <= 20) return form5 + if (remainder10 > 1 && remainder10 < 5) return form2 + if (remainder10 == 1) return form1 + return form5 +} From b1a105371bffdea6ca10a010292248ef9aff3ce2 Mon Sep 17 00:00:00 2001 From: JONG HWAN KIM <99215801+JongDeug@users.noreply.github.com> Date: Mon, 19 Feb 2024 07:37:59 +0900 Subject: [PATCH 012/135] feat(i18n): add Korean (#889) * feat(i18n): add Korean * feat(i18n): add Korean --- quartz/i18n/index.ts | 2 + quartz/i18n/locales/ko-KR.ts | 81 ++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 quartz/i18n/locales/ko-KR.ts diff --git a/quartz/i18n/index.ts b/quartz/i18n/index.ts index 1e4853f40..5224f667b 100644 --- a/quartz/i18n/index.ts +++ b/quartz/i18n/index.ts @@ -9,6 +9,7 @@ import es from "./locales/es-ES" import ar from "./locales/ar-SA" import uk from "./locales/uk-UA" import ru from "./locales/ru-RU" +import ko from "./locales/ko-KR" export const TRANSLATIONS = { "en-US": en, @@ -42,6 +43,7 @@ export const TRANSLATIONS = { "ar-MR": ar, "uk-UA": uk, "ru-RU": ru, + "ko-KR": ko, } as const export const defaultTranslation = "en-US" diff --git a/quartz/i18n/locales/ko-KR.ts b/quartz/i18n/locales/ko-KR.ts new file mode 100644 index 000000000..ed859a90e --- /dev/null +++ b/quartz/i18n/locales/ko-KR.ts @@ -0,0 +1,81 @@ +import { Translation } from "./definition" + +export default { + propertyDefaults: { + title: "제목 없음", + description: "설명 없음", + }, + components: { + callout: { + note: "노트", + abstract: "개요", + info: "정보", + todo: "할일", + tip: "팁", + success: "성공", + question: "질문", + warning: "주의", + failure: "실패", + danger: "위험", + bug: "버그", + example: "예시", + quote: "인용", + }, + backlinks: { + title: "백링크", + noBacklinksFound: "백링크가 없습니다.", + }, + themeToggle: { + lightMode: "라이트 모드", + darkMode: "다크 모드", + }, + explorer: { + title: "탐색기", + }, + footer: { + createdWith: "Created with", + }, + graph: { + title: "그래프 뷰", + }, + recentNotes: { + title: "최근 게시글", + seeRemainingMore: ({ remaining }) => `${remaining}건 더보기 →`, + }, + transcludes: { + transcludeOf: ({ targetSlug }) => `${targetSlug}의 포함`, + linkToOriginal: "원본 링크", + }, + search: { + title: "검색", + searchBarPlaceholder: "검색어를 입력하세요", + }, + tableOfContents: { + title: "목차", + }, + contentMeta: { + readingTime: ({ minutes }) => `${minutes} min read`, + }, + }, + pages: { + rss: { + recentNotes: "최근 게시글", + lastFewNotes: ({ count }) => `최근 ${count} 건`, + }, + error: { + title: "Not Found", + notFound: "페이지가 존재하지 않거나 비공개 설정이 되어 있습니다.", + }, + folderContent: { + folder: "폴더", + itemsUnderFolder: ({ count }) => `${count}건의 페이지`, + }, + tagContent: { + tag: "태그", + tagIndex: "태그 목록", + itemsUnderTag: ({ count }) => `${count}건의 페이지`, + showingFirst: ({ count }) => `처음 ${count}개의 태그`, + totalTags: ({ count }) => `총 ${count}개의 태그를 찾았습니다.`, + }, + }, +} as const satisfies Translation From 739c2e2cc8db456514f81def7fa8c519656fdaa7 Mon Sep 17 00:00:00 2001 From: s-crypt <41712656+s-crypt@users.noreply.github.com> Date: Sun, 18 Feb 2024 20:26:04 -0800 Subject: [PATCH 013/135] perf(cdn): CDNJS instead of JSDelivr (#891) --- docs/advanced/making plugins.md | 4 ++-- quartz/plugins/transformers/latex.ts | 4 ++-- quartz/plugins/transformers/ofm.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/advanced/making plugins.md b/docs/advanced/making plugins.md index 565f5bdba..d9ed9e33e 100644 --- a/docs/advanced/making plugins.md +++ b/docs/advanced/making plugins.md @@ -84,10 +84,10 @@ export const Latex: QuartzTransformerPlugin = (opts?: Options) => { externalResources() { if (engine === "katex") { return { - css: ["https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/katex.min.css"], + css: ["https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/katex.min.css"], js: [ { - src: "https://cdn.jsdelivr.net/npm/katex@0.16.7/dist/contrib/copy-tex.min.js", + src: "https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.7/contrib/copy-tex.min.js", loadTime: "afterDOMReady", contentType: "external", }, diff --git a/quartz/plugins/transformers/latex.ts b/quartz/plugins/transformers/latex.ts index ab10a4fbb..c9f6bff0d 100644 --- a/quartz/plugins/transformers/latex.ts +++ b/quartz/plugins/transformers/latex.ts @@ -26,12 +26,12 @@ export const Latex: QuartzTransformerPlugin = (opts?: Options) => { return { css: [ // base css - "https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.css", + "https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/katex.min.css", ], js: [ { // fix copy behaviour: https://github.com/KaTeX/KaTeX/blob/main/contrib/copy-tex/README.md - src: "https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/contrib/copy-tex.min.js", + src: "https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/contrib/copy-tex.min.js", loadTime: "afterDOMReady", contentType: "external", }, diff --git a/quartz/plugins/transformers/ofm.ts b/quartz/plugins/transformers/ofm.ts index e110e403f..6aad23052 100644 --- a/quartz/plugins/transformers/ofm.ts +++ b/quartz/plugins/transformers/ofm.ts @@ -619,7 +619,7 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin let mermaidImport = undefined document.addEventListener('nav', async () => { if (document.querySelector("code.mermaid")) { - mermaidImport ||= await import('https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs') + mermaidImport ||= await import('https://cdnjs.cloudflare.com/ajax/libs/mermaid/10.7.0/mermaid.esm.min.mjs') const mermaid = mermaidImport.default const darkMode = document.documentElement.getAttribute('saved-theme') === 'dark' mermaid.initialize({ From efd46f84de2d8dcc630b96de5454027bfbbf5f6e Mon Sep 17 00:00:00 2001 From: Eiko Wagenknecht Date: Mon, 19 Feb 2024 09:08:36 +0100 Subject: [PATCH 014/135] fix(frontmatter): delimiters parameter was not passed (#885) * fix: delimiters parameter was not passed Signed-off-by: Eiko Wagenknecht * fix: remove unneeded undefined --------- Signed-off-by: Eiko Wagenknecht --- quartz/plugins/transformers/frontmatter.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quartz/plugins/transformers/frontmatter.ts b/quartz/plugins/transformers/frontmatter.ts index 9371df81e..7073d43bd 100644 --- a/quartz/plugins/transformers/frontmatter.ts +++ b/quartz/plugins/transformers/frontmatter.ts @@ -8,12 +8,12 @@ import { QuartzPluginData } from "../vfile" import { i18n } from "../../i18n" export interface Options { - delims: string | string[] + delimiters: string | [string, string] language: "yaml" | "toml" } const defaultOptions: Options = { - delims: "---", + delimiters: "---", language: "yaml", } From d9e8ffc78c54a59047df56d8000b2f6289eb9be0 Mon Sep 17 00:00:00 2001 From: Leonardo Ledda <35930217+LeddaZ@users.noreply.github.com> Date: Mon, 19 Feb 2024 18:50:01 +0100 Subject: [PATCH 015/135] feat(i18n): Add Italian (#893) Signed-off-by: Leonardo Ledda --- quartz/i18n/index.ts | 2 + quartz/i18n/locales/it-IT.ts | 83 ++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 quartz/i18n/locales/it-IT.ts diff --git a/quartz/i18n/index.ts b/quartz/i18n/index.ts index 5224f667b..3861bf73c 100644 --- a/quartz/i18n/index.ts +++ b/quartz/i18n/index.ts @@ -1,6 +1,7 @@ import { Translation, CalloutTranslation } from "./locales/definition" import en from "./locales/en-US" import fr from "./locales/fr-FR" +import it from "./locales/it-IT" import ja from "./locales/ja-JP" import de from "./locales/de-DE" import nl from "./locales/nl-NL" @@ -14,6 +15,7 @@ import ko from "./locales/ko-KR" export const TRANSLATIONS = { "en-US": en, "fr-FR": fr, + "it-IT": it, "ja-JP": ja, "de-DE": de, "nl-NL": nl, diff --git a/quartz/i18n/locales/it-IT.ts b/quartz/i18n/locales/it-IT.ts new file mode 100644 index 000000000..a0cc04283 --- /dev/null +++ b/quartz/i18n/locales/it-IT.ts @@ -0,0 +1,83 @@ +import { Translation } from "./definition" + +export default { + propertyDefaults: { + title: "Senza titolo", + description: "Nessuna descrizione", + }, + components: { + callout: { + note: "Nota", + abstract: "Astratto", + info: "Info", + todo: "Da fare", + tip: "Consiglio", + success: "Completato", + question: "Domanda", + warning: "Attenzione", + failure: "Errore", + danger: "Pericolo", + bug: "Bug", + example: "Esempio", + quote: "Citazione", + }, + backlinks: { + title: "Link entranti", + noBacklinksFound: "Nessun link entrante", + }, + themeToggle: { + lightMode: "Tema chiaro", + darkMode: "Tema scuro", + }, + explorer: { + title: "Esplora", + }, + footer: { + createdWith: "Creato con", + }, + graph: { + title: "Vista grafico", + }, + recentNotes: { + title: "Note recenti", + seeRemainingMore: ({ remaining }) => `Vedi ${remaining} altro →`, + }, + transcludes: { + transcludeOf: ({ targetSlug }) => `Transclusione di ${targetSlug}`, + linkToOriginal: "Link all'originale", + }, + search: { + title: "Cerca", + searchBarPlaceholder: "Cerca qualcosa", + }, + tableOfContents: { + title: "Tabella dei contenuti", + }, + contentMeta: { + readingTime: ({ minutes }) => `${minutes} minuti`, + }, + }, + pages: { + rss: { + recentNotes: "Note recenti", + lastFewNotes: ({ count }) => `Ultime ${count} note`, + }, + error: { + title: "Non trovato", + notFound: "Questa pagina è privata o non esiste.", + }, + folderContent: { + folder: "Cartella", + itemsUnderFolder: ({ count }) => + 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.`, + showingFirst: ({ count }) => `Prime ${count} etichette.`, + totalTags: ({ count }) => `Trovate ${count} etichette totali.`, + }, + }, +} as const satisfies Translation From 3e09b05468c372e85518ff76d8d6d9a415f61fac Mon Sep 17 00:00:00 2001 From: kon-foo <25391223+kon-foo@users.noreply.github.com> Date: Mon, 19 Feb 2024 18:50:40 +0100 Subject: [PATCH 016/135] docs: add self-hosting section (#883) * Add Self-Hosting section Add Nginx section * run prettier --- docs/hosting.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/hosting.md b/docs/hosting.md index bae7ed899..eeb930849 100644 --- a/docs/hosting.md +++ b/docs/hosting.md @@ -228,3 +228,25 @@ pages: When `.gitlab-ci.yaml` is committed, 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`. + +## Self-Hosting + +Copy the `public` directory to your web server and configure it to serve the files. You can use any web server to host your site. Since Quartz generates links that do not include the `.html` extension, you need to let your web server know how to deal with it. + +### Using Nginx + +Here's an example of how to do this with Nginx: + +```nginx title="nginx.conf" +server { + listen 80; + server_name example.com; + root /path/to/quartz/public; + index index.html; + error_page 404 /404.html; + + location / { + try_files $uri $uri.html $uri/ =404; + } +} +``` From e85ea490003870c5a6c004bb2e6bd6d76769a2ce Mon Sep 17 00:00:00 2001 From: KylinDC Date: Tue, 20 Feb 2024 02:31:09 +0800 Subject: [PATCH 017/135] feat(i18n): add Simplified Chinese (#896) --- quartz/i18n/index.ts | 2 + quartz/i18n/locales/zh-CN.ts | 81 ++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 quartz/i18n/locales/zh-CN.ts diff --git a/quartz/i18n/index.ts b/quartz/i18n/index.ts index 3861bf73c..38d356280 100644 --- a/quartz/i18n/index.ts +++ b/quartz/i18n/index.ts @@ -11,6 +11,7 @@ import ar from "./locales/ar-SA" import uk from "./locales/uk-UA" import ru from "./locales/ru-RU" import ko from "./locales/ko-KR" +import zh from "./locales/zh-CN" export const TRANSLATIONS = { "en-US": en, @@ -46,6 +47,7 @@ export const TRANSLATIONS = { "uk-UA": uk, "ru-RU": ru, "ko-KR": ko, + "zh-CN": zh, } as const export const defaultTranslation = "en-US" diff --git a/quartz/i18n/locales/zh-CN.ts b/quartz/i18n/locales/zh-CN.ts new file mode 100644 index 000000000..43d011197 --- /dev/null +++ b/quartz/i18n/locales/zh-CN.ts @@ -0,0 +1,81 @@ +import { Translation } from "./definition" + +export default { + propertyDefaults: { + title: "无题", + description: "无描述", + }, + components: { + callout: { + note: "笔记", + abstract: "摘要", + info: "提示", + todo: "待办", + tip: "提示", + success: "成功", + question: "问题", + warning: "警告", + failure: "失败", + danger: "危险", + bug: "错误", + example: "示例", + quote: "引用", + }, + backlinks: { + title: "反向链接", + noBacklinksFound: "无法找到反向链接", + }, + themeToggle: { + lightMode: "亮色模式", + darkMode: "暗色模式", + }, + explorer: { + title: "探索", + }, + footer: { + createdWith: "Created with", + }, + graph: { + title: "关系图谱", + }, + recentNotes: { + title: "最近的笔记", + seeRemainingMore: ({ remaining }) => `查看更多${remaining}篇笔记 →`, + }, + transcludes: { + transcludeOf: ({ targetSlug }) => `包含${targetSlug}`, + linkToOriginal: "指向原始笔记的链接", + }, + search: { + title: "搜索", + searchBarPlaceholder: "搜索些什么", + }, + tableOfContents: { + title: "目录", + }, + contentMeta: { + readingTime: ({ minutes }) => `${minutes}分钟阅读`, + }, + }, + pages: { + rss: { + recentNotes: "最近的笔记", + lastFewNotes: ({ count }) => `最近的${count}条笔记`, + }, + error: { + title: "无法找到", + notFound: "私有笔记或笔记不存在。", + }, + folderContent: { + folder: "文件夹", + itemsUnderFolder: ({ count }) => `此文件夹下有${count}条笔记。`, + }, + tagContent: { + tag: "标签", + tagIndex: "标签索引", + itemsUnderTag: ({ count }) => `此标签下有${count}条笔记。`, + showingFirst: ({ count }) => `显示前${count}个标签。`, + totalTags: ({ count }) => `总共有${count}个标签。`, + }, + }, +} as const satisfies Translation From a67a8d7aa9da06d8f87d0f48bac630728a4ea394 Mon Sep 17 00:00:00 2001 From: kabirgh <15871468+kabirgh@users.noreply.github.com> Date: Mon, 19 Feb 2024 18:58:15 +0000 Subject: [PATCH 018/135] feat: implement getDependencyGraph for TagPage (#872) * feat: implement getDependencyGraph for TagPage * Only add file to dg if it has at least 1 tag --- quartz/plugins/emitters/tagPage.tsx | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/quartz/plugins/emitters/tagPage.tsx b/quartz/plugins/emitters/tagPage.tsx index 332c758d5..3eb6975f7 100644 --- a/quartz/plugins/emitters/tagPage.tsx +++ b/quartz/plugins/emitters/tagPage.tsx @@ -35,9 +35,26 @@ export const TagPage: QuartzEmitterPlugin> = (userOpts) getQuartzComponents() { return [Head, Header, Body, ...header, ...beforeBody, pageBody, ...left, ...right, Footer] }, - async getDependencyGraph(ctx, _content, _resources) { - // TODO implement - return new DepGraph() + async getDependencyGraph(ctx, content, _resources) { + const graph = new DepGraph() + + for (const [_tree, file] of content) { + const sourcePath = file.data.filePath! + const tags = (file.data.frontmatter?.tags ?? []).flatMap(getAllSegmentPrefixes) + // if the file has at least one tag, it is used in the tag index page + if (tags.length > 0) { + tags.push("index") + } + + for (const tag of tags) { + graph.addEdge( + sourcePath, + joinSegments(ctx.argv.output, "tags", tag + ".html") as FilePath, + ) + } + } + + return graph }, async emit(ctx, content, resources): Promise { const fps: FilePath[] = [] From 0493942c79f8528ca8bef6cd8e2f634275f03119 Mon Sep 17 00:00:00 2001 From: kon-foo <25391223+kon-foo@users.noreply.github.com> Date: Mon, 19 Feb 2024 20:04:27 +0100 Subject: [PATCH 019/135] fix: remove assets via globs to avoid volume mount lock (#877) * Fix docker volume lock issue by altering asset cleanup method Modified build process to prevent the deletion of the output directory. * Add fsOps utility for filesystem operations * Use cleanDirectory in build process to fix volume lock issue * applied prettier * handle ENOENT error when output dir does not exist * remove native function in favor of rimraf * use path.join to concatenate paths --- quartz/build.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quartz/build.ts b/quartz/build.ts index 452a2f1ae..3d95f315f 100644 --- a/quartz/build.ts +++ b/quartz/build.ts @@ -60,7 +60,7 @@ async function buildQuartz(argv: Argv, mut: Mutex, clientRefresh: () => void) { const release = await mut.acquire() perf.addEvent("clean") - await rimraf(output) + await rimraf(path.join(output, "*"), { glob: true }) console.log(`Cleaned output directory \`${output}\` in ${perf.timeSince("clean")}`) perf.addEvent("glob") @@ -375,7 +375,7 @@ async function rebuildFromEntrypoint( // TODO: we can probably traverse the link graph to figure out what's safe to delete here // instead of just deleting everything - await rimraf(argv.output) + await rimraf(path.join(argv.output, ".*"), { glob: true }) await emitContent(ctx, filteredContent) console.log(chalk.green(`Done rebuilding in ${perf.timeSince()}`)) } catch (err) { From 637e336cdaa8cf8eb918257c236c53ccc5dc5ae8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Feb 2024 13:46:27 -0800 Subject: [PATCH 020/135] chore(deps-dev): bump @types/node from 20.11.16 to 20.11.19 (#899) Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.16 to 20.11.19. - [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 7d1d9737e..4d0ef1a69 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.16", + "@types/node": "^20.11.19", "@types/pretty-time": "^1.1.5", "@types/source-map-support": "^0.5.10", "@types/ws": "^8.5.10", @@ -1088,9 +1088,9 @@ } }, "node_modules/@types/node": { - "version": "20.11.16", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.16.tgz", - "integrity": "sha512-gKb0enTmRCzXSSUJDq6/sPcqrfCv2mkkG6Jt/clpn5eiCbKTY+SgZUxo+p8ZKMof5dCp9vHQUAB7wOUTod22wQ==", + "version": "20.11.19", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.19.tgz", + "integrity": "sha512-7xMnVEcZFu0DikYjWOlRq7NTPETrm7teqUT2WkQjrTIkEgUyyGdWsj/Zg8bEJt5TNklzbPD1X3fqfsHw3SpapQ==", "dev": true, "dependencies": { "undici-types": "~5.26.4" diff --git a/package.json b/package.json index f89bb2a0b..2a567358b 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.16", + "@types/node": "^20.11.19", "@types/pretty-time": "^1.1.5", "@types/source-map-support": "^0.5.10", "@types/ws": "^8.5.10", From f1619620d5cd285b4a4dabf69a9dd1d95de2f36c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Feb 2024 13:47:00 -0800 Subject: [PATCH 021/135] chore(deps): bump globby from 14.0.0 to 14.0.1 (#897) Bumps [globby](https://github.com/sindresorhus/globby) from 14.0.0 to 14.0.1. - [Release notes](https://github.com/sindresorhus/globby/releases) - [Commits](https://github.com/sindresorhus/globby/compare/v14.0.0...v14.0.1) --- updated-dependencies: - dependency-name: globby 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 4d0ef1a69..e2ae90e7c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,7 @@ "esbuild-sass-plugin": "^2.16.1", "flexsearch": "0.7.43", "github-slugger": "^2.0.0", - "globby": "^14.0.0", + "globby": "^14.0.1", "gray-matter": "^4.0.3", "hast-util-to-html": "^9.0.0", "hast-util-to-jsx-runtime": "^2.3.0", @@ -743,9 +743,9 @@ } }, "node_modules/@sindresorhus/merge-streams": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-1.0.0.tgz", - "integrity": "sha512-rUV5WyJrJLoloD4NDN1V1+LDMDWOa4OTsT4yYJwQNpTU6FWxkxHpL7eu4w+DmiH8x/EAM1otkPE1+LaspIbplw==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-2.3.0.tgz", + "integrity": "sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==", "engines": { "node": ">=18" }, @@ -2301,11 +2301,11 @@ } }, "node_modules/globby": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-14.0.0.tgz", - "integrity": "sha512-/1WM/LNHRAOH9lZta77uGbq0dAEQM+XjNesWwhlERDVenqothRbnzTrL3/LrIoEPPjeUHC3vrS6TwoyxeHs7MQ==", + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/globby/-/globby-14.0.1.tgz", + "integrity": "sha512-jOMLD2Z7MAhyG8aJpNOpmziMOP4rPLcc95oQPKXBazW82z+CEgPFBQvEpRUa1KeIMUJo4Wsm+q6uzO/Q/4BksQ==", "dependencies": { - "@sindresorhus/merge-streams": "^1.0.0", + "@sindresorhus/merge-streams": "^2.1.0", "fast-glob": "^3.3.2", "ignore": "^5.2.4", "path-type": "^5.0.0", diff --git a/package.json b/package.json index 2a567358b..d469d7b01 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "esbuild-sass-plugin": "^2.16.1", "flexsearch": "0.7.43", "github-slugger": "^2.0.0", - "globby": "^14.0.0", + "globby": "^14.0.1", "gray-matter": "^4.0.3", "hast-util-to-html": "^9.0.0", "hast-util-to-jsx-runtime": "^2.3.0", From 779c501d9eb6393539f0be7653dbdc09f1b9ebe9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Feb 2024 13:47:07 -0800 Subject: [PATCH 022/135] chore(deps): bump preact from 10.19.4 to 10.19.5 (#898) Bumps [preact](https://github.com/preactjs/preact) from 10.19.4 to 10.19.5. - [Release notes](https://github.com/preactjs/preact/releases) - [Commits](https://github.com/preactjs/preact/compare/10.19.4...10.19.5) --- 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 e2ae90e7c..4a8b58336 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.4", + "preact": "^10.19.5", "preact-render-to-string": "^6.3.1", "pretty-bytes": "^6.1.1", "pretty-time": "^1.1.0", @@ -4454,9 +4454,9 @@ } }, "node_modules/preact": { - "version": "10.19.4", - "resolved": "https://registry.npmjs.org/preact/-/preact-10.19.4.tgz", - "integrity": "sha512-dwaX5jAh0Ga8uENBX1hSOujmKWgx9RtL80KaKUFLc6jb4vCEAc3EeZ0rnQO/FO4VgjfPMfoLFWnNG8bHuZ9VLw==", + "version": "10.19.5", + "resolved": "https://registry.npmjs.org/preact/-/preact-10.19.5.tgz", + "integrity": "sha512-OPELkDmSVbKjbFqF9tgvOowiiQ9TmsJljIzXRyNE8nGiis94pwv1siF78rQkAP1Q1738Ce6pellRg/Ns/CtHqQ==", "funding": { "type": "opencollective", "url": "https://opencollective.com/preact" diff --git a/package.json b/package.json index d469d7b01..54c67fbff 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.4", + "preact": "^10.19.5", "preact-render-to-string": "^6.3.1", "pretty-bytes": "^6.1.1", "pretty-time": "^1.1.0", From b6cf3df84f452c22ac9ddaf452b0ecbe0828086f Mon Sep 17 00:00:00 2001 From: Eiko Wagenknecht Date: Mon, 19 Feb 2024 22:49:07 +0100 Subject: [PATCH 023/135] fix: correctly parse falsy js as title (#900) --- quartz/plugins/transformers/frontmatter.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quartz/plugins/transformers/frontmatter.ts b/quartz/plugins/transformers/frontmatter.ts index 7073d43bd..79aa5f313 100644 --- a/quartz/plugins/transformers/frontmatter.ts +++ b/quartz/plugins/transformers/frontmatter.ts @@ -57,9 +57,9 @@ export const FrontMatter: QuartzTransformerPlugin | undefined> }, }) - if (data.title) { + if (data.title != null && data.title.toString() !== "") { data.title = data.title.toString() - } else if (data.title === null || data.title === undefined) { + } else { data.title = file.stem ?? i18n(cfg.configuration.locale).propertyDefaults.title } From fc5fa48bf18ec0bc0b7a7e31a086428664117e04 Mon Sep 17 00:00:00 2001 From: JONG HWAN KIM <99215801+JongDeug@users.noreply.github.com> Date: Tue, 20 Feb 2024 15:36:54 +0900 Subject: [PATCH 024/135] feat(i18n): change itemsUnderFolder, itemsUnderTag translation of ko-KR (#905) * feat(i18n): add Korean * feat(i18n): add Korean * feat(i18n): change itemsUnderFolder, itemsUnderTag translation of ko-KR --- quartz/i18n/locales/ko-KR.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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}개의 태그를 찾았습니다.`, }, From 3b266ee7d0d414d2af7d291f249b0153af51aa2e Mon Sep 17 00:00:00 2001 From: Eiko Wagenknecht Date: Tue, 20 Feb 2024 15:45:10 +0100 Subject: [PATCH 025/135] fix: add space and missing dot for listing pages (#907) --- quartz/components/pages/TagContent.tsx | 9 ++++++--- quartz/i18n/locales/de-DE.ts | 4 ++-- quartz/i18n/locales/en-US.ts | 4 ++-- quartz/i18n/locales/es-ES.ts | 4 ++-- quartz/i18n/locales/fr-FR.ts | 4 ++-- quartz/i18n/locales/it-IT.ts | 4 ++-- quartz/i18n/locales/nl-NL.ts | 2 +- quartz/i18n/locales/uk-UA.ts | 4 ++-- 8 files changed, 19 insertions(+), 16 deletions(-) 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/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/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}.`, }, From 1c3f3d03e1682cd435363e354acae6dc936baef3 Mon Sep 17 00:00:00 2001 From: Eiko Wagenknecht Date: Tue, 20 Feb 2024 18:06:53 +0100 Subject: [PATCH 026/135] fix(toc): correct type for minEntries param (#909) --- quartz/plugins/transformers/toc.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quartz/plugins/transformers/toc.ts b/quartz/plugins/transformers/toc.ts index 4c31d2062..bfc2f9877 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, From 7dd596ebcece8badf18586186c9712b364fab42e Mon Sep 17 00:00:00 2001 From: kon-foo <25391223+kon-foo@users.noreply.github.com> Date: Wed, 21 Feb 2024 17:18:44 +0100 Subject: [PATCH 027/135] docs: Fix in explorer.md (#911) --- 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 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: From 916aedce40864a485724d9df78879e8d130beab3 Mon Sep 17 00:00:00 2001 From: Aster Hu Date: Wed, 21 Feb 2024 22:04:36 -0500 Subject: [PATCH 028/135] docs: Add Aster's notebook to showcase.md (#912) --- docs/showcase.md | 1 + 1 file changed, 1 insertion(+) 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)! From 345c347a56070d0b0d2b72656df891eec6a1f7ab Mon Sep 17 00:00:00 2001 From: Aaron Pham <29749331+aarnphm@users.noreply.github.com> Date: Thu, 22 Feb 2024 20:51:07 -0500 Subject: [PATCH 029/135] chore: passing additional buildCtx to componentData (#914) Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com> --- quartz/components/types.ts | 2 ++ quartz/plugins/emitters/404.tsx | 1 + quartz/plugins/emitters/contentPage.tsx | 1 + quartz/plugins/emitters/folderPage.tsx | 1 + quartz/plugins/emitters/tagPage.tsx | 1 + 5 files changed, 6 insertions(+) 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/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, From 96c7076fb5333882dd354c5f156232217d4fab13 Mon Sep 17 00:00:00 2001 From: Aaron Pham <29749331+aarnphm@users.noreply.github.com> Date: Thu, 22 Feb 2024 22:16:40 -0500 Subject: [PATCH 030/135] feat(popover): add support for PDF (#913) * feat(popover): add support for PDF Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com> * chore: split pdf by ';' Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com> * fix: remove unnecessary check Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com> --------- Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com> --- quartz/components/scripts/popover.inline.ts | 17 +++++++++++--- quartz/components/styles/popover.scss | 25 +++++++++++++++------ 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/quartz/components/scripts/popover.inline.ts b/quartz/components/scripts/popover.inline.ts index d0346b05b..dee0a7876 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,7 +56,7 @@ async function mouseEnterHandler( popoverInner.classList.add("popover-inner") popoverElement.appendChild(popoverInner) - popoverInner.dataset.contentType = contentTypeCategory + popoverInner.dataset.contentType = contentType ?? undefined switch (contentTypeCategory) { case "image": @@ -69,6 +69,17 @@ async function mouseEnterHandler( 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%; + } } } From 129e878b29dc53a1327d88089fa5876b0b1cc764 Mon Sep 17 00:00:00 2001 From: Aaron Pham <29749331+aarnphm@users.noreply.github.com> Date: Fri, 23 Feb 2024 00:55:35 -0500 Subject: [PATCH 031/135] chore(img): return targetUrl as given href (#916) Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com> --- quartz/components/scripts/popover.inline.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/quartz/components/scripts/popover.inline.ts b/quartz/components/scripts/popover.inline.ts index dee0a7876..972d3c638 100644 --- a/quartz/components/scripts/popover.inline.ts +++ b/quartz/components/scripts/popover.inline.ts @@ -61,10 +61,7 @@ async function mouseEnterHandler( 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) From fb66ae283848deec6b2be405642bd63f0c113e61 Mon Sep 17 00:00:00 2001 From: KylinDC Date: Fri, 23 Feb 2024 13:56:26 +0800 Subject: [PATCH 032/135] deps(highlighting): migrate to shiki as shikiji has been archived (#918) --- package-lock.json | 34 +++++++++++++++++----------------- package.json | 4 ++-- 2 files changed, 19 insertions(+), 19 deletions(-) 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 54c67fbff..094e62ae4 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,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", @@ -79,7 +79,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", From be9b6b3a1e2038ea0a985ebd37fb18a661bddd04 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Fri, 23 Feb 2024 09:32:08 -0800 Subject: [PATCH 033/135] fix(docs): make docs accurate to callout behaviour (closes #920) --- docs/features/callouts.md | 63 +++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 36 deletions(-) diff --git a/docs/features/callouts.md b/docs/features/callouts.md index d73979284..3fefda2e6 100644 --- a/docs/features/callouts.md +++ b/docs/features/callouts.md @@ -55,50 +55,41 @@ By default, custom callouts are handled by applying the `note` style. To make fa > > > > > [!example] You can even use multiple layers of nesting. -> [!EXAMPLE] Examples -> -> Aliases: example +> [!note] +> Aliases: "note" -> [!note] Notes -> -> Aliases: note +> [!abstract] +> Aliases: "abstract", "summary", "tldr" -> [!abstract] Summaries -> -> Aliases: abstract, summary, tldr +> [!info] +> Aliases: "info" -> [!info] Info -> -> Aliases: info, todo +> [!todo] +> Aliases: "todo" -> [!tip] Hint -> -> Aliases: tip, hint, important +> [!tip] +> Aliases: "tip", "hint", "important" -> [!success] Success -> -> Aliases: success, check, done +> [!success] +> Aliases: "success", "check", "done" -> [!question] Question -> -> Aliases: question, help, faq +> [!question] +> Aliases: "question", "help", "faq" -> [!warning] Warning -> -> Aliases: warning, caution, attention +> [!warning] +> Aliases: "warning", "attention", "caution" -> [!failure] Failure -> -> Aliases: failure, fail, missing +> [!failure] +> Aliases: "failure", "missing", "fail" -> [!danger] Error -> -> Aliases: danger, error +> [!danger] +> Aliases: "danger", "error" -> [!bug] Bug -> -> Aliases: bug +> [!bug] +> Aliases: "bug" -> [!quote] Quote -> -> Aliases: quote, cite +> [!example] +> Aliases: "example" + +> [!quote] +> Aliases: "quote", "cite" From 421718958fc47db0f1a7b53f51e0c7063db744b3 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Fri, 23 Feb 2024 11:20:35 -0800 Subject: [PATCH 034/135] fix(callouts): use user provided title instead of canonical for default title --- quartz/plugins/transformers/ofm.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/quartz/plugins/transformers/ofm.ts b/quartz/plugins/transformers/ofm.ts index 6aad23052..fab7cf894 100644 --- a/quartz/plugins/transformers/ofm.ts +++ b/quartz/plugins/transformers/ofm.ts @@ -412,12 +412,7 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin children: [ { type: "text", - value: useDefaultTitle - ? capitalize( - i18n(cfg.locale).components.callout[calloutType as ValidCallout] ?? - calloutType, - ) - : titleContent + " ", + value: useDefaultTitle ? capitalize(typeString) : titleContent + " ", }, ...restOfTitle, ], From 1929241a62b67ebd9cc9831e372ab321874d03d1 Mon Sep 17 00:00:00 2001 From: Eiko Wagenknecht Date: Fri, 23 Feb 2024 21:07:53 +0100 Subject: [PATCH 035/135] docs: update plugin documentation (#888) * docs: first few plugins documented * docs: move plugin info * docs: move plugin docs to tag based system * docs: update latex example code snippet * docs: fix spelling of latex in title * docs: add missing linebreak * docs: remove plugin tag from feature pages * docs: shorten titles * docs: refine wording * docs: move plugin details for frontmatter * docs: add features/* tags * docs: update latex example * docs: make references more explicit * docs: add stubs for the remaining plugins * docs: more descriptions * docs: fix feature tags * docs: descriptions * docs: new plugin pages * docs: update configuration page * docs: more plugin work * docs: run prettier * docs: remove comments in config file and add link to docs * docs: minor fixes * docs: run prettier * docs: spelling * docs: update docs/plugins/AliasRedirects.md Co-authored-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> * docs: update docs/plugins/Assets.md Co-authored-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> * docs: update docs/plugins/CNAME.md Co-authored-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> * docs: update docs/plugins/Static.md Co-authored-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> * docs: update docs * docs: update docs/features/Mermaid diagrams.md Co-authored-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> * docs: update docs/plugins/RemoveDrafts.md Co-authored-by: Jacky Zhao * docs: update docs/plugins/Assets.md Co-authored-by: Jacky Zhao * docs: update docs/configuration.md Co-authored-by: Jacky Zhao * docs: update docs/configuration.md Co-authored-by: Jacky Zhao * docs: update docs/configuration.md Co-authored-by: Jacky Zhao * docs: some updates * docs: work in review comments --------- Signed-off-by: Eiko Wagenknecht Co-authored-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> Co-authored-by: Jacky Zhao --- docs/advanced/making plugins.md | 12 ++++--- docs/authoring content.md | 4 +++ docs/configuration.md | 44 +++++++++++++++++------- docs/features/Latex.md | 13 ++++--- docs/features/Mermaid diagrams.md | 8 ++++- docs/features/Obsidian compatibility.md | 28 ++++----------- docs/features/OxHugo compatibility.md | 18 +++------- docs/features/RSS Feed.md | 6 ++-- docs/features/callouts.md | 9 ++--- docs/features/folder and tag listings.md | 21 +++++------ docs/features/private pages.md | 6 ++-- docs/features/syntax highlighting.md | 6 ++-- docs/features/table of contents.md | 22 ++++-------- docs/features/wikilinks.md | 2 +- docs/index.md | 2 +- docs/plugins/AliasRedirects.md | 37 ++++++++++++++++++++ docs/plugins/Assets.md | 20 +++++++++++ docs/plugins/CNAME.md | 22 ++++++++++++ docs/plugins/ComponentResources.md | 18 ++++++++++ docs/plugins/ContentIndex.md | 26 ++++++++++++++ docs/plugins/ContentPage.md | 18 ++++++++++ docs/plugins/CrawlLinks.md | 30 ++++++++++++++++ docs/plugins/CreatedModifiedDate.md | 25 ++++++++++++++ docs/plugins/Description.md | 22 ++++++++++++ docs/plugins/ExplicitPublish.md | 18 ++++++++++ docs/plugins/FolderPage.md | 22 ++++++++++++ docs/plugins/Frontmatter.md | 24 +++++++++++++ docs/plugins/GitHubFlavoredMarkdown.md | 23 +++++++++++++ docs/plugins/HardLineBreaks.md | 18 ++++++++++ docs/plugins/Latex.md | 20 +++++++++++ docs/plugins/NotFoundPage.md | 18 ++++++++++ docs/plugins/ObsidianFlavoredMarkdown.md | 34 ++++++++++++++++++ docs/plugins/OxHugoFlavoredMarkdown.md | 29 ++++++++++++++++ docs/plugins/RemoveDrafts.md | 18 ++++++++++ docs/plugins/Static.md | 21 +++++++++++ docs/plugins/SyntaxHighlighting.md | 23 +++++++++++++ docs/plugins/TableOfContents.md | 26 ++++++++++++++ docs/plugins/TagPage.md | 20 +++++++++++ docs/plugins/index.md | 3 ++ docs/tags/plugin.md | 3 ++ quartz.config.ts | 10 +++--- 41 files changed, 641 insertions(+), 108 deletions(-) create mode 100644 docs/plugins/AliasRedirects.md create mode 100644 docs/plugins/Assets.md create mode 100644 docs/plugins/CNAME.md create mode 100644 docs/plugins/ComponentResources.md create mode 100644 docs/plugins/ContentIndex.md create mode 100644 docs/plugins/ContentPage.md create mode 100644 docs/plugins/CrawlLinks.md create mode 100644 docs/plugins/CreatedModifiedDate.md create mode 100644 docs/plugins/Description.md create mode 100644 docs/plugins/ExplicitPublish.md create mode 100644 docs/plugins/FolderPage.md create mode 100644 docs/plugins/Frontmatter.md create mode 100644 docs/plugins/GitHubFlavoredMarkdown.md create mode 100644 docs/plugins/HardLineBreaks.md create mode 100644 docs/plugins/Latex.md create mode 100644 docs/plugins/NotFoundPage.md create mode 100644 docs/plugins/ObsidianFlavoredMarkdown.md create mode 100644 docs/plugins/OxHugoFlavoredMarkdown.md create mode 100644 docs/plugins/RemoveDrafts.md create mode 100644 docs/plugins/Static.md create mode 100644 docs/plugins/SyntaxHighlighting.md create mode 100644 docs/plugins/TableOfContents.md create mode 100644 docs/plugins/TagPage.md create mode 100644 docs/plugins/index.md create mode 100644 docs/tags/plugin.md diff --git a/docs/advanced/making plugins.md b/docs/advanced/making plugins.md index d9ed9e33e..b2bacf0aa 100644 --- a/docs/advanced/making plugins.md +++ b/docs/advanced/making plugins.md @@ -53,12 +53,12 @@ All transformer plugins must define at least a `name` field to register the plug Normally for both `remark` and `rehype`, you can find existing plugins that you can use to . If you'd like to create your own `remark` or `rehype` plugin, checkout the [guide to creating a plugin](https://unifiedjs.com/learn/guide/create-a-plugin/) using `unified` (the underlying AST parser and transformer library). -A good example of a transformer plugin that borrows from the `remark` and `rehype` ecosystems is the [[Latex]] plugin: +A good example of a transformer plugin that borrows from the `remark` and `rehype` ecosystems is the [[plugins/Latex|Latex]] plugin: ```ts title="quartz/plugins/transformers/latex.ts" import remarkMath from "remark-math" import rehypeKatex from "rehype-katex" -import rehypeMathjax from "rehype-mathjax/svg.js" +import rehypeMathjax from "rehype-mathjax/svg" import { QuartzTransformerPlugin } from "../types" interface Options { @@ -84,10 +84,14 @@ export const Latex: QuartzTransformerPlugin = (opts?: Options) => { externalResources() { if (engine === "katex") { return { - css: ["https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/katex.min.css"], + css: [ + // base css + "https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/katex.min.css", + ], js: [ { - src: "https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.7/contrib/copy-tex.min.js", + // fix copy behaviour: https://github.com/KaTeX/KaTeX/blob/main/contrib/copy-tex/README.md + src: "https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/contrib/copy-tex.min.js", loadTime: "afterDOMReady", contentType: "external", }, diff --git a/docs/authoring content.md b/docs/authoring content.md index c259e5011..d872a964f 100644 --- a/docs/authoring content.md +++ b/docs/authoring content.md @@ -38,3 +38,7 @@ Some common frontmatter fields that are natively supported by Quartz: When your Quartz is at a point you're happy with, you can save your changes to GitHub. First, make sure you've [[setting up your GitHub repository|already setup your GitHub repository]] and then do `npx quartz sync`. + +## Customization + +Frontmatter parsing for `title`, `tags`, `aliases` and `cssclasses` is a functionality of the [[Frontmatter]] plugin, `date` is handled by the [[CreatedModifiedDate]] plugin and `description` by the [[Description]] plugin. See the plugin pages for customization options. diff --git a/docs/configuration.md b/docs/configuration.md index 366430cc2..6c7665492 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -30,12 +30,12 @@ This part of the configuration concerns anything that can affect the whole site. - `{ provider: 'umami', host: '', websiteId: '' }`: use [Umami](https://umami.is/); - `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` + - 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`. - Note that Quartz 4 will avoid using this as much as possible and use relative URLs whenever it can to make sure your site works no matter _where_ you end up actually deploying it. - `ignorePatterns`: a list of [glob]() patterns that Quartz should ignore and not search through when looking for files inside the `content` folder. See [[private pages]] for more details. - `defaultDateType`: whether to use created, modified, or published as the default date to display on pages and page listings. - `theme`: configure how the site looks. - - `cdnCaching`: Whether to use Google CDN to cache the fonts (generally will be faster). Disable this if you want Quartz to be self-contained. Default to `true` + - `cdnCaching`: If `true` (default), use Google CDN to cache the fonts. This will generally will be faster. Disable (`false`) this if you want Quartz to download the fonts to be self-contained. - `typography`: what fonts to use. Any font available on [Google Fonts](https://fonts.google.com/) works here. - `header`: Font to use for headers - `code`: Font for inline and block quotes. @@ -56,7 +56,7 @@ You can think of Quartz plugins as a series of transformations over content. ![[quartz transform pipeline.png]] -```ts +```ts title="quartz.config.ts" plugins: { transformers: [...], filters: [...], @@ -64,22 +64,40 @@ plugins: { } ``` -- [[making plugins#Transformers|Transformers]] **map** over content (e.g. parsing frontmatter, generating a description) -- [[making plugins#Filters|Filters]] **filter** content (e.g. filtering out drafts) -- [[making plugins#Emitters|Emitters]] **reduce** over content (e.g. creating an RSS feed or pages that list all files with a specific tag) +- [[tags/plugin/transformer|Transformers]] **map** over content (e.g. parsing frontmatter, generating a description) +- [[tags/plugin/filter|Filters]] **filter** content (e.g. filtering out drafts) +- [[tags/plugin/emitter|Emitters]] **reduce** over content (e.g. creating an RSS feed or pages that list all files with a specific tag) -By adding, removing, and reordering plugins from the `tranformers`, `filters`, and `emitters` fields, you can customize the behaviour of Quartz. +You can customize the behaviour of Quartz by adding, removing and reordering plugins in the `transformers`, `filters` and `emitters` fields. > [!note] -> Each node is modified by every transformer _in order_. Some transformers are position-sensitive so you may need to take special note of whether it needs come before or after any other particular plugins. +> 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. -Additionally, plugins may also have their own configuration settings that you can pass in. For example, the [[Latex]] plugin allows you to pass in a field specifying the `renderEngine` to choose between Katex and MathJax. +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: -```ts +```ts title="quartz.config.ts" transformers: [ - Plugin.FrontMatter(), // uses default options - Plugin.Latex({ renderEngine: "katex" }), // specify some options + ... + Plugin.ExplicitPublish(), + ... +], +``` + +To remove a plugin, you should remove all occurrences of it in the `quartz.config.ts`. + +To customize plugins further, some plugins may also have their own configuration settings that you can pass in. If you do not pass in a configuration, the plugin will use its default settings. + +For example, the [[plugins/Latex|Latex]] plugin allows you to pass in a field specifying the `renderEngine` to choose between Katex and MathJax. + +```ts title="quartz.config.ts" +transformers: [ + Plugin.FrontMatter(), // use default options + Plugin.Latex({ renderEngine: "katex" }), // set some custom options ] ``` -If you'd like to make your own plugins, read the guide on [[making plugins]] for more information. +Some plugins are included by default in the[ `quartz.config.ts`](https://github.com/jackyzha0/quartz/blob/v4/quartz.config.ts), but there are more available. + +You can see a list of all plugins and their configuration options [[tags/plugin|here]]. + +If you'd like to make your own plugins, see the [[making plugins|making custom plugins]] guide. diff --git a/docs/features/Latex.md b/docs/features/Latex.md index 3c8f6ff1f..e019190e1 100644 --- a/docs/features/Latex.md +++ b/docs/features/Latex.md @@ -1,6 +1,7 @@ --- +title: LaTeX tags: - - plugin/transformer + - feature/transformer --- Quartz uses [Katex](https://katex.org/) by default to typeset both inline and block math expressions at build time. @@ -38,6 +39,9 @@ a & b & c \end{bmatrix} $$ +> [!warn] +> Due to limitations in the [underlying parsing library](https://github.com/remarkjs/remark-math), block math in Quartz requires the `$$` delimiters to be on newlines like above. + ### Inline Math Similarly, inline math can be rendered by delimiting math expression with a single `$`. For example, `$e^{i\pi} = -1$` produces $e^{i\pi} = -1$ @@ -53,11 +57,6 @@ 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 -## MathJax - -In `quartz.config.ts`, you can configure Quartz to use [MathJax SVG rendering](https://docs.mathjax.org/en/latest/output/svg.html) by replacing `Plugin.Latex({ renderEngine: 'katex' })` with `Plugin.Latex({ renderEngine: 'mathjax' })` - ## Customization -- Removing Latex support: remove all instances of `Plugin.Latex()` from `quartz.config.ts`. -- Plugin: `quartz/plugins/transformers/latex.ts` +Latex parsing is a functionality of the [[plugins/Latex|Latex]] plugin. See the plugin page for customization options. diff --git a/docs/features/Mermaid diagrams.md b/docs/features/Mermaid diagrams.md index f14a5589b..9cc408917 100644 --- a/docs/features/Mermaid diagrams.md +++ b/docs/features/Mermaid diagrams.md @@ -1,9 +1,15 @@ +--- +title: "Mermaid Diagrams" +tags: + - feature/transformer +--- + Quartz supports Mermaid which allows you to add diagrams and charts to your notes. Mermaid supports a range of diagrams, such as [flow charts](https://mermaid.js.org/syntax/flowchart.html), [sequence diagrams](https://mermaid.js.org/syntax/sequenceDiagram.html), and [timelines](https://mermaid.js.org/syntax/timeline.html). This is enabled as a part of [[Obsidian compatibility]] and can be configured and enabled/disabled from that plugin. By default, Quartz will render Mermaid diagrams to match the site theme. > [!warning] -> Wondering why Mermaid diagrams may not be showing up even if you have them enabled? You may need to reorder your plugins so that `Plugin.ObsidianFlavoredMarkdown()` is _after_ `Plugin.SyntaxHighlighting()`. +> Wondering why Mermaid diagrams may not be showing up even if you have them enabled? You may need to reorder your plugins so that [[ObsidianFlavoredMarkdown]] is _after_ [[SyntaxHighlighting]]. ## Syntax diff --git a/docs/features/Obsidian compatibility.md b/docs/features/Obsidian compatibility.md index 1254370e0..e469f4866 100644 --- a/docs/features/Obsidian compatibility.md +++ b/docs/features/Obsidian compatibility.md @@ -1,33 +1,17 @@ --- +title: "Obsidian Compatibility" tags: - - plugin/transformer + - feature/transformer --- Quartz was originally designed as a tool to publish Obsidian vaults as websites. Even as the scope of Quartz has widened over time, it hasn't lost the ability to seamlessly interoperate with Obsidian. -By default, Quartz ships with `Plugin.ObsidianFlavoredMarkdown` which is a transformer plugin that adds support for [Obsidian Flavored Markdown](https://help.obsidian.md/Editing+and+formatting/Obsidian+Flavored+Markdown). This includes support for features like [[wikilinks]] and [[Mermaid diagrams]]. +By default, Quartz ships with the [[ObsidianFlavoredMarkdown]] plugin, which is a transformer plugin that adds support for [Obsidian Flavored Markdown](https://help.obsidian.md/Editing+and+formatting/Obsidian+Flavored+Markdown). This includes support for features like [[wikilinks]] and [[Mermaid diagrams]]. -It also ships with support for [frontmatter parsing](https://help.obsidian.md/Editing+and+formatting/Properties) with the same fields that Obsidian uses through the `Plugin.FrontMatter` transformer plugin. +It also ships with support for [frontmatter parsing](https://help.obsidian.md/Editing+and+formatting/Properties) with the same fields that Obsidian uses through the [[Frontmatter]] transformer plugin. -Finally, Quartz also provides `Plugin.CrawlLinks` which allows you to customize Quartz's link resolution behaviour to match Obsidian. +Finally, Quartz also provides [[CrawlLinks]] plugin, which allows you to customize Quartz's link resolution behaviour to match Obsidian. ## Configuration -- Frontmatter parsing: - - Disabling: remove all instances of `Plugin.FrontMatter()` from `quartz.config.ts`. - - Customize default values for frontmatter: edit `quartz/plugins/transformers/frontmatter.ts` -- Obsidian Flavored Markdown: - - Disabling: remove all instances of `Plugin.ObsidianFlavoredMarkdown()` from `quartz.config.ts` - - Customizing features: `Plugin.ObsidianFlavoredMarkdown` has several other options to toggle on and off: - - `comments`: whether to enable `%%` style Obsidian comments. Defaults to `true` - - `highlight`: whether to enable `==` style highlights. Defaults to `true` - - `wikilinks`: whether to enable turning [[wikilinks]] into regular links. Defaults to `true` - - `callouts`: whether to enable [[callouts]]. Defaults to `true` - - `mermaid`: whether to enable [[Mermaid diagrams]]. Defaults to `true` - - `parseTags`: whether to try and parse tags in the content body. Defaults to `true` - - `parseArrows`: whether to try and parse arrows in the content body. Defaults to `true`. - - `enableInHtmlEmbed`: whether to try and parse Obsidian flavoured markdown in raw HTML. Defaults to `false` - - `enableYouTubeEmbed`: whether to enable embedded YouTube videos using external image Markdown syntax. Defaults to `false` -- Link resolution behaviour: - - Disabling: remove all instances of `Plugin.CrawlLinks()` from `quartz.config.ts` - - Changing link resolution preference: set `markdownLinkResolution` to one of `absolute`, `relative` or `shortest` +This functionality is provided by the [[ObsidianFlavoredMarkdown]], [[Frontmatter]] and [[CrawlLinks]] plugins. See the plugin pages for customization options. diff --git a/docs/features/OxHugo compatibility.md b/docs/features/OxHugo compatibility.md index 3143eb1b5..e22051146 100644 --- a/docs/features/OxHugo compatibility.md +++ b/docs/features/OxHugo compatibility.md @@ -1,11 +1,12 @@ --- +title: "OxHugo Compatibility" tags: - - plugin/transformer + - feature/transformer --- [org-roam](https://www.orgroam.com/) is a plain-text personal knowledge management system for [emacs](https://en.wikipedia.org/wiki/Emacs). [ox-hugo](https://github.com/kaushalmodi/ox-hugo) is org exporter backend that exports `org-mode` files to [Hugo](https://gohugo.io/) compatible Markdown. -Because the Markdown generated by ox-hugo is not pure Markdown but Hugo specific, we need to transform it to fit into Quartz. This is done by `Plugin.OxHugoFlavouredMarkdown`. Even though this [[making plugins|plugin]] was written with `ox-hugo` in mind, it should work for any Hugo specific Markdown. +Because the Markdown generated by ox-hugo is not pure Markdown but Hugo specific, we need to transform it to fit into Quartz. This is done by the [[OxHugoFlavoredMarkdown]] plugin. Even though this plugin was written with `ox-hugo` in mind, it should work for any Hugo specific Markdown. ```typescript title="quartz.config.ts" plugins: { @@ -25,15 +26,4 @@ Quartz by default doesn't understand `org-roam` files as they aren't Markdown. Y ## Configuration -- Link resolution - - `wikilinks`: Whether to replace `{{ relref }}` with Quartz [[wikilinks]] - - `removePredefinedAnchor`: Whether to remove [pre-defined anchor set by ox-hugo](https://ox-hugo.scripter.co/doc/anchors/). -- Image handling - - `replaceFigureWithMdImg`: Whether to replace `
` with `![]()` -- Formatting - - `removeHugoShortcode`: Whether to remove hugo shortcode syntax (`{{}}`) - - `replaceOrgLatex`: Whether to replace org-mode formatting for latex fragments with what `Plugin.Latex` supports. - -> [!warning] -> -> While you can use `Plugin.OxHugoFlavoredMarkdown` and `Plugin.ObsidianFlavoredMarkdown` together, it's not recommended because it might mutate the file in unexpected ways. Use with caution. +This functionality is provided by the [[OxHugoFlavoredMarkdown]] plugin. See the plugin page for customization options. diff --git a/docs/features/RSS Feed.md b/docs/features/RSS Feed.md index bfeb399c9..ed4138dfc 100644 --- a/docs/features/RSS Feed.md +++ b/docs/features/RSS Feed.md @@ -1,7 +1,5 @@ -Quartz creates an RSS feed for all the content on your site by generating an `index.xml` file that RSS readers can subscribe to. Because of the RSS spec, this requires the `baseUrl` property in your [[configuration]] to be set properly for RSS readers to pick it up properly. +Quartz emits an RSS feed for all the content on your site by generating an `index.xml` file that RSS readers can subscribe to. Because of the RSS spec, this requires the `baseUrl` property in your [[configuration]] to be set properly for RSS readers to pick it up properly. ## Configuration -- Remove RSS feed: set the `enableRSS` field of `Plugin.ContentIndex` in `quartz.config.ts` to be `false`. -- Change number of entries: set the `rssLimit` field of `Plugin.ContentIndex` to be the desired value. It defaults to latest 10 items. -- Use rich HTML output in RSS: set `rssFullHtml` field of `Plugin.ContentIndex` to be `true`. +This functionality is provided by the [[ContentIndex]] plugin. See the plugin page for customization options. diff --git a/docs/features/callouts.md b/docs/features/callouts.md index 3fefda2e6..4caeeb4c8 100644 --- a/docs/features/callouts.md +++ b/docs/features/callouts.md @@ -1,7 +1,7 @@ --- title: Callouts tags: - - plugin/transformer + - feature/transformer --- Quartz supports the same Admonition-callout syntax as Obsidian. @@ -19,12 +19,13 @@ This includes See [documentation on supported types and syntax here](https://help.obsidian.md/Editing+and+formatting/Callouts). > [!warning] -> Wondering why callouts may not be showing up even if you have them enabled? You may need to reorder your plugins so that `Plugin.ObsidianFlavoredMarkdown()` is _after_ `Plugin.SyntaxHighlighting()`. +> Wondering why callouts may not be showing up even if you have them enabled? You may need to reorder your plugins so that [[ObsidianFlavoredMarkdown]] is _after_ [[SyntaxHighlighting]]. ## Customization -- Disable callouts: simply pass `callouts: false` to the plugin: `Plugin.ObsidianFlavoredMarkdown({ callouts: false })` -- Editing icons: `quartz/styles/callouts.scss` +The callouts are a functionality of the [[ObsidianFlavoredMarkdown]] plugin. See the plugin page for how to enable or disable them. + +You can edit the icons by customizing `quartz/styles/callouts.scss`. ### Add custom callouts diff --git a/docs/features/folder and tag listings.md b/docs/features/folder and tag listings.md index dfde7c26e..d330f1479 100644 --- a/docs/features/folder and tag listings.md +++ b/docs/features/folder and tag listings.md @@ -1,18 +1,20 @@ --- title: Folder and Tag Listings tags: - - plugin/emitter + - feature/emitter --- -Quartz creates listing pages for any folders and tags you have. +Quartz emits listing pages for any folders and tags you have. ## Folder Listings Quartz will generate an index page for all the pages under that folder. This includes any content that is multiple levels deep. -Additionally, Quartz will also generate pages for subfolders. Say you have a note in a nested folder `content/abc/def/note.md`. Then, Quartz would generate a page for all the notes under `abc` _and_ a page for all the notes under `abc/def`. +Additionally, Quartz will also generate pages for subfolders. Say you have a note in a nested folder `content/abc/def/note.md`. Then Quartz would generate a page for all the notes under `abc` _and_ a page for all the notes under `abc/def`. -By default, Quartz will title the page `Folder: ` and no description. You can override this by creating an `index.md` file in the folder with the `title` [[authoring content#Syntax|frontmatter]] field. Any content you write in this file will also be used in the description of the folder. +You can link to the folder listing by referencing its name, plus a trailing slash, like this: `[[advanced/]]` (results in [[advanced/]]). + +By default, Quartz will title the page `Folder: ` and no description. You can override this by creating an `index.md` file in the folder with the `title` [[authoring content#Syntax|frontmatter]] field. Any content you write in this file will also be used in the folder description. For example, for the folder `content/posts`, you can add another file `content/posts/index.md` to add a specific description for it. @@ -20,13 +22,12 @@ For example, for the folder `content/posts`, you can add another file `content/p Quartz will also create an index page for each unique tag in your vault and render a list of all notes with that tag. -Quartz also supports tag hierarchies as well (e.g. `plugin/emitter`) and will also render a separate tag page for each layer of the tag hierarchy. It will also create a default global tag index page at `/tags` that displays a list of all the tags in your Quartz. +Quartz also supports tag hierarchies as well (e.g. `plugin/emitter`) and will also render a separate tag page for each level of the tag hierarchy. It will also create a default global tag index page at `/tags` that displays a list of all the tags in your Quartz. -Like folder listings, you can also provide a description and title for a tag page by creating a file for each tag. For example, if you wanted to create a custom description for the #component tag, you would create a file at `content/tags/component.md` with a title and description. +You can link to the tag listing by referencing its name with a `tag/` prefix, like this: `[[tags/plugin]]` (results in [[tags/plugin]]). + +As with folder listings, you can also provide a description and title for a tag page by creating a file for each tag. For example, if you wanted to create a custom description for the #component tag, you would create a file at `content/tags/component.md` with a title and description. ## Customization -The layout for both the folder and content pages can be customized. By default, they use the `defaultListPageLayout` in `quartz.layouts.ts`. If you'd like to make more involved changes to the layout and don't mind editing some [[creating components|Quartz components]], you can take a look at `quartz/components/pages/FolderContent.tsx` and `quartz/components/pages/TagContent.tsx` respectively. - -- Removing folder listings: remove `Plugin.FolderPage()` from `emitters` in `quartz.config.ts` -- Removing tag listings: remove `Plugin.TagPage()` from `emitters` in `quartz.config.ts` +The folder listings are a functionality of the [[FolderPage]] plugin, the tag listings of the [[TagPage]] plugin. See the plugin pages for customization options. diff --git a/docs/features/private pages.md b/docs/features/private pages.md index 638c628b6..1e8f8aa24 100644 --- a/docs/features/private pages.md +++ b/docs/features/private pages.md @@ -1,16 +1,16 @@ --- title: Private Pages tags: - - plugin/filter + - feature/filter --- There may be some notes you want to avoid publishing as a website. Quartz supports this through two mechanisms which can be used in conjunction: ## Filter Plugins -[[making plugins#Filters|Filter plugins]] are plugins that filter out content based off of certain criteria. By default, Quartz uses the `Plugin.RemoveDrafts` plugin which filters out any note that has `draft: true` in the frontmatter. +[[making plugins#Filters|Filter plugins]] are plugins that filter out content based off of certain criteria. By default, Quartz uses the [[RemoveDrafts]] plugin which filters out any note that has `draft: true` in the frontmatter. -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. +If you'd like to only publish a select number of notes, you can instead use [[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. diff --git a/docs/features/syntax highlighting.md b/docs/features/syntax highlighting.md index 68436c2da..16fef2575 100644 --- a/docs/features/syntax highlighting.md +++ b/docs/features/syntax highlighting.md @@ -1,7 +1,7 @@ --- title: Syntax Highlighting tags: - - plugin/transformer + - feature/transformer --- Syntax highlighting in Quartz is completely done at build-time. This means that Quartz only ships pre-calculated CSS to highlight the right words so there is no heavy client-side bundle that does the syntax highlighting. @@ -130,6 +130,4 @@ const [name, setName] = useState('Taylor'); ## Customization -- Removing syntax highlighting: delete all usages of `Plugin.SyntaxHighlighting()` from `quartz.config.ts`. -- Style: By default, Quartz uses derivatives of the GitHub light and dark themes. You can customize the colours in the `quartz/styles/syntax.scss` file. -- Plugin: `quartz/plugins/transformers/syntax.ts` +Syntax highlighting is a functionality of the [[SyntaxHighlighting]] plugin. See the plugin page for customization options. diff --git a/docs/features/table of contents.md b/docs/features/table of contents.md index 0298ffaab..4ecccc934 100644 --- a/docs/features/table of contents.md +++ b/docs/features/table of contents.md @@ -2,25 +2,17 @@ title: "Table of Contents" tags: - component - - plugin/transformer + - feature/transformer --- -Quartz can automatically generate a table of contents from a list of headings on each page. It will also show you your current scroll position on the site by marking headings you've scrolled through with a different colour. +Quartz can automatically generate a table of contents (TOC) from a list of headings on each page. It will also show you your current scrolling position on the page by highlighting headings you've scrolled through with a different color. -By default, it will show all headers from H1 (`# Title`) all the way to H3 (`### Title`) and will only show the table of contents if there is more than 1 header on the page. -You can also hide the table of contents on a page by adding `enableToc: false` to the frontmatter for that page. +You can hide the TOC on a page by adding `enableToc: false` to the frontmatter for that page. -> [!info] -> This feature requires both `Plugin.TableOfContents` in your `quartz.config.ts` and `Component.TableOfContents` in your `quartz.layout.ts` to function correctly. +By default, the TOC shows all headings from H1 (`# Title`) to H3 (`### Title`) and is only displayed if there is more than one heading on the page. ## Customization -- 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` - - Legacy Quartz 3 style: `quartz/components/styles/legacyToc.scss` -- Script: `quartz/components/scripts/toc.inline.ts` +The table of contents is a functionality of the [[TableOfContents]] plugin. See the plugin page for more customization options. + +It also needs the `TableOfContents` component, which is displayed in the right sidebar by default. You can change this by customizing the [[layout]]. The TOC component can be configured with the `layout` parameter, which can either be `modern` (default) or `legacy`. diff --git a/docs/features/wikilinks.md b/docs/features/wikilinks.md index 1b005327c..ad4f2d779 100644 --- a/docs/features/wikilinks.md +++ b/docs/features/wikilinks.md @@ -4,7 +4,7 @@ title: Wikilinks Wikilinks were pioneered by earlier internet wikis to make it easier to write links across pages without needing to write Markdown or HTML links each time. -Quartz supports Wikilinks by default and these links are resolved by Quartz using `Plugin.CrawlLinks`. See the [Obsidian Help page on Internal Links](https://help.obsidian.md/Linking+notes+and+files/Internal+links) for more information on Wikilink syntax. +Quartz supports Wikilinks by default and these links are resolved by Quartz using the [[CrawlLinks]] plugin. See the [Obsidian Help page on Internal Links](https://help.obsidian.md/Linking+notes+and+files/Internal+links) for more information on Wikilink syntax. This is enabled as a part of [[Obsidian compatibility]] and can be configured and enabled/disabled from that plugin. diff --git a/docs/index.md b/docs/index.md index f25b6e244..87cf024a3 100644 --- a/docs/index.md +++ b/docs/index.md @@ -31,7 +31,7 @@ If you prefer instructions in a video format you can try following Nicole van de ## 🔧 Features -- [[Obsidian compatibility]], [[full-text search]], [[graph view]], note transclusion, [[wikilinks]], [[backlinks]], [[Latex]], [[syntax highlighting]], [[popover previews]], [[Docker Support]], [[i18n|internationalization]] and [many more](./features) right out of the box +- [[Obsidian compatibility]], [[full-text search]], [[graph view]], note transclusion, [[wikilinks]], [[backlinks]], [[features/Latex|Latex]], [[syntax highlighting]], [[popover previews]], [[Docker Support]], [[i18n|internationalization]] and [many more](./features) right out of the box - Hot-reload for both configuration and content - Simple JSX layouts and [[creating components|page components]] - [[SPA Routing|Ridiculously fast page loads]] and tiny bundle sizes diff --git a/docs/plugins/AliasRedirects.md b/docs/plugins/AliasRedirects.md new file mode 100644 index 000000000..3a33ce649 --- /dev/null +++ b/docs/plugins/AliasRedirects.md @@ -0,0 +1,37 @@ +--- +title: AliasRedirects +tags: + - plugin/emitter +--- + +This plugin emits HTML redirect pages for aliases and permalinks defined in the frontmatter of content files. + +For example, A `foo.md` has the following frontmatter + +```md title="foo.md" +--- +title: "Foo" +alias: + - "bar" +--- +``` + +The target `host.me/bar` will be redirected to `host.me/foo` + +Note that these are permanent redirect. + +The emitter supports the following aliases: + +- `aliases` +- `alias` + +> [!note] +> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. + +This plugin has no configuration options. + +## API + +- Category: Emitter +- Function name: `Plugin.AliasRedirects()`. +- Source: [`quartz/plugins/emitters/aliases.ts`](https://github.com/jackyzha0/quartz/blob/v4/quartz/plugins/emitters/aliases.ts). diff --git a/docs/plugins/Assets.md b/docs/plugins/Assets.md new file mode 100644 index 000000000..eb03994e1 --- /dev/null +++ b/docs/plugins/Assets.md @@ -0,0 +1,20 @@ +--- +title: Assets +tags: + - plugin/emitter +--- + +This plugin emits all non-Markdown static assets in your content folder (like images, videos, HTML, etc). The plugin respects the `ignorePatterns` in the global [[configuration]]. + +Note that all static assets will then be accessible through its path on your generated site, i.e: `host.me/path/to/static.pdf` + +> [!note] +> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. + +This plugin has no configuration options. + +## API + +- Category: Emitter +- Function name: `Plugin.Assets()`. +- Source: [`quartz/plugins/emitters/assets.ts`](https://github.com/jackyzha0/quartz/blob/v4/quartz/plugins/emitters/assets.ts). diff --git a/docs/plugins/CNAME.md b/docs/plugins/CNAME.md new file mode 100644 index 000000000..1cc0b5ccf --- /dev/null +++ b/docs/plugins/CNAME.md @@ -0,0 +1,22 @@ +--- +title: CNAME +tags: + - plugin/emitter +--- + +This plugin emits a `CNAME` record that points your subdomain to the default domain of your site. + +If you want to use a custom domain name like `quartz.example.com` for the site, then this is needed. + +See [[Hosting]] for more information. + +> [!note] +> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. + +This plugin has no configuration options. + +## API + +- Category: Emitter +- Function name: `Plugin.CNAME()`. +- Source: [`quartz/plugins/emitters/cname.ts`](https://github.com/jackyzha0/quartz/blob/v4/quartz/plugins/emitters/cname.ts). diff --git a/docs/plugins/ComponentResources.md b/docs/plugins/ComponentResources.md new file mode 100644 index 000000000..739c17070 --- /dev/null +++ b/docs/plugins/ComponentResources.md @@ -0,0 +1,18 @@ +--- +title: ComponentResources +tags: + - plugin/emitter +--- + +This plugin manages and emits the static resources required for the Quartz framework. This includes CSS stylesheets and JavaScript scripts that enhance the functionality and aesthetics of the generated site. See also the `cdnCaching` option in the `theme` section of the [[configuration]]. + +> [!note] +> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. + +This plugin has no configuration options. + +## API + +- Category: Emitter +- Function name: `Plugin.ComponentResources()`. +- Source: [`quartz/plugins/emitters/componentResources.ts`](https://github.com/jackyzha0/quartz/blob/v4/quartz/plugins/emitters/componentResources.ts). diff --git a/docs/plugins/ContentIndex.md b/docs/plugins/ContentIndex.md new file mode 100644 index 000000000..af235b057 --- /dev/null +++ b/docs/plugins/ContentIndex.md @@ -0,0 +1,26 @@ +--- +title: ContentIndex +tags: + - plugin/emitter +--- + +This plugin emits both RSS and an XML sitemap for your site. The [[RSS Feed]] allows users to subscribe to content on your site and the sitemap allows search engines to better index your site. The plugin also emits a `contentIndex.json` file which is used by dynamic frontend components like search and graph. + +This plugin emits a comprehensive index of the site's content, generating additional resources such as a sitemap, an RSS feed, and a + +> [!note] +> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. + +This plugin accepts the following configuration options: + +- `enableSiteMap`: If `true` (default), generates a sitemap XML file (`sitemap.xml`) listing all site URLs for search engines in content discovery. +- `enableRSS`: If `true` (default), produces an RSS feed (`index.xml`) with recent content updates. +- `rssLimit`: Defines the maximum number of entries to include in the RSS feed, helping to focus on the most recent or relevant content. Defaults to `10`. +- `rssFullHtml`: If `true`, the RSS feed includes full HTML content. Otherwise it includes just summaries. +- `includeEmptyFiles`: If `true` (default), content files with no body text are included in the generated index and resources. + +## API + +- Category: Emitter +- Function name: `Plugin.ContentIndex()`. +- Source: [`quartz/plugins/emitters/contentIndex.ts`](https://github.com/jackyzha0/quartz/blob/v4/quartz/plugins/emitters/contentIndex.ts). diff --git a/docs/plugins/ContentPage.md b/docs/plugins/ContentPage.md new file mode 100644 index 000000000..5d9016f3c --- /dev/null +++ b/docs/plugins/ContentPage.md @@ -0,0 +1,18 @@ +--- +title: ContentPage +tags: + - plugin/emitter +--- + +This plugin is a core component of the Quartz framework. It generates the HTML pages for each piece of Markdown content. It emits the full-page [[layout]], including headers, footers, and body content, among others. + +> [!note] +> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. + +This plugin has no configuration options. + +## API + +- Category: Emitter +- Function name: `Plugin.ContentPage()`. +- Source: [`quartz/plugins/emitters/contentPage.tsx`](https://github.com/jackyzha0/quartz/blob/v4/quartz/plugins/emitters/contentPage.tsx). diff --git a/docs/plugins/CrawlLinks.md b/docs/plugins/CrawlLinks.md new file mode 100644 index 000000000..15a0d6607 --- /dev/null +++ b/docs/plugins/CrawlLinks.md @@ -0,0 +1,30 @@ +--- +title: CrawlLinks +tags: + - plugin/transformer +--- + +This plugin parses links and processes them to point to the right places. It is also needed for embedded links (like images). See [[Obsidian compatibility]] for more information. + +> [!note] +> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. + +This plugin accepts the following configuration options: + +- `markdownLinkResolution`: Sets the strategy for resolving Markdown paths, can be `"absolute"` (default), `"relative"` or `"shortest"`. You should use the same setting here as in [[Obsidian compatibility|Obsidian]]. + - `absolute`: Path relative to the root of the content folder. + - `relative`: Path relative to the file you are linking from. + - `shortest`: Name of the file. If this isn't enough to identify the file, use the full absolute path. +- `prettyLinks`: If `true` (default), simplifies links by removing folder paths, making them more user friendly (e.g. `folder/deeply/nested/note` becomes `note`). +- `openLinksInNewTab`: If `true`, configures external links to open in a new tab. Defaults to `false`. +- `lazyLoad`: If `true`, adds lazy loading to resource elements (`img`, `video`, etc.) to improve page load performance. Defaults to `false`. +- `externalLinkIcon`: Adds an icon next to external links when `true` (default) to visually distinguishing them from internal links. + +> [!warning] +> Removing this plugin is _not_ recommended and will likely break the page. + +## API + +- Category: Transformer +- Function name: `Plugin.CrawlLinks()`. +- Source: [`quartz/plugins/transformers/links.ts`](https://github.com/jackyzha0/quartz/blob/v4/quartz/plugins/transformers/links.ts). diff --git a/docs/plugins/CreatedModifiedDate.md b/docs/plugins/CreatedModifiedDate.md new file mode 100644 index 000000000..6a0f1371a --- /dev/null +++ b/docs/plugins/CreatedModifiedDate.md @@ -0,0 +1,25 @@ +--- +title: "CreatedModifiedDate" +tags: + - plugin/transformer +--- + +This plugin determines the created, modified, and published dates for a document using three potential data sources: frontmatter metadata, Git history, and the filesystem. See [[authoring content#Syntax]] for more information. + +> [!note] +> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. + +This plugin accepts the following configuration options: + +- `priority`: The data sources to consult for date information. Highest priority first. Possible values are `"frontmatter"`, `"git"`, and `"filesystem"`. Defaults to `"frontmatter", "git", "filesystem"]`. + +> [!warning] +> If you rely on `git` for dates, make sure `defaultDateType` is set to `modified` in `quartz.config.ts`. +> +> Depending on how you [[hosting|host]] your Quartz, the `filesystem` dates of your local files may not match the final dates. In these cases, it may be better to use `git` or `frontmatter` to guarantee correct dates. + +## API + +- Category: Transformer +- Function name: `Plugin.CreatedModifiedDate()`. +- Source: [`quartz/plugins/transformers/lastmod.ts`](https://github.com/jackyzha0/quartz/blob/v4/quartz/plugins/transformers/lastmod.ts). diff --git a/docs/plugins/Description.md b/docs/plugins/Description.md new file mode 100644 index 000000000..6849b3ca4 --- /dev/null +++ b/docs/plugins/Description.md @@ -0,0 +1,22 @@ +--- +title: Description +tags: + - plugin/transformer +--- + +This plugin generates descriptions that are used as metadata for the HTML `head`, the [[RSS Feed]] and in [[folder and tag listings]] if there is no main body content, the description is used as the text between the title and the listing. + +If the frontmatter contains a `description` property, it is used (see [[authoring content#Syntax]]). Otherwise, the plugin will do its best to use the first few sentences of the content to reach the target description length. + +> [!note] +> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. + +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. + +## API + +- Category: Transformer +- Function name: `Plugin.Description()`. +- Source: [`quartz/plugins/transformers/description.ts`](https://github.com/jackyzha0/quartz/blob/v4/quartz/plugins/transformers/description.ts). diff --git a/docs/plugins/ExplicitPublish.md b/docs/plugins/ExplicitPublish.md new file mode 100644 index 000000000..7ef2dd4d0 --- /dev/null +++ b/docs/plugins/ExplicitPublish.md @@ -0,0 +1,18 @@ +--- +title: ExplicitPublish +tags: + - plugin/filter +--- + +This plugin filters content based on an explicit `publish` flag in the frontmatter, allowing only content that is explicitly marked for publication to pass through. It's the opt-in version of [[RemoveDrafts]]. See [[private pages]] for more information. + +> [!note] +> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. + +This plugin has no configuration options. + +## API + +- Category: Emitter +- Function name: `Plugin.ExplicitPublish()`. +- Source: [`quartz/plugins/filters/explicit.ts`](https://github.com/jackyzha0/quartz/blob/v4/quartz/plugins/filters/explicit.ts). diff --git a/docs/plugins/FolderPage.md b/docs/plugins/FolderPage.md new file mode 100644 index 000000000..92a700ae9 --- /dev/null +++ b/docs/plugins/FolderPage.md @@ -0,0 +1,22 @@ +--- +title: FolderPage +tags: + - plugin/emitter +--- + +This plugin generates index pages for folders, creating a listing page for each folder that contains multiple content files. See [[folder and tag listings]] for more information. + +Example: [[advanced/|Advanced]] + +> [!note] +> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. + +This plugin has no configuration options. + +The pages are displayed using the `defaultListPageLayout` in `quartz.layouts.ts`. For the content, the `FolderContent` component is used. If you want to modify the layout, you must edit it directly (`quartz/components/pages/FolderContent.tsx`). + +## API + +- Category: Emitter +- Function name: `Plugin.FolderPage()`. +- Source: [`quartz/plugins/emitters/folderPage.tsx`](https://github.com/jackyzha0/quartz/blob/v4/quartz/plugins/emitters/folderPage.tsx). diff --git a/docs/plugins/Frontmatter.md b/docs/plugins/Frontmatter.md new file mode 100644 index 000000000..960417a80 --- /dev/null +++ b/docs/plugins/Frontmatter.md @@ -0,0 +1,24 @@ +--- +title: "Frontmatter" +tags: + - plugin/transformer +--- + +This plugin parses the frontmatter of the page using the [gray-matter](https://github.com/jonschlinkert/gray-matter) library. See [[authoring content#Syntax]], [[Obsidian compatibility]] and [[OxHugo compatibility]] for more information. + +> [!note] +> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. + +This plugin accepts the following configuration options: + +- `delimiters`: the delimiters to use for the frontmatter. Can have one value (e.g. `"---"`) or separate values for opening and closing delimiters (e.g. `["---", "~~~"]`). Defaults to `"---"`. +- `language`: the language to use for parsing the frontmatter. Can be `yaml` (default) or `toml`. + +> [!warning] +> This plugin must not be removed, otherwise Quartz will break. + +## API + +- Category: Transformer +- Function name: `Plugin.Frontmatter()`. +- Source: [`quartz/plugins/transformers/frontmatter.ts`](https://github.com/jackyzha0/quartz/blob/v4/quartz/plugins/transformers/frontmatter.ts). diff --git a/docs/plugins/GitHubFlavoredMarkdown.md b/docs/plugins/GitHubFlavoredMarkdown.md new file mode 100644 index 000000000..2ea8f8d38 --- /dev/null +++ b/docs/plugins/GitHubFlavoredMarkdown.md @@ -0,0 +1,23 @@ +--- +title: GitHubFlavoredMarkdown +tags: + - plugin/transformer +--- + +This plugin enhances Markdown processing to support GitHub Flavored Markdown (GFM) which adds features like autolink literals, footnotes, strikethrough, tables and tasklists. + +In addition, this plugin adds optional features for typographic refinement (such as converting straight quotes to curly quotes, dashes to en-dashes/em-dashes, and ellipses) and automatic heading links as a symbol that appears next to the heading on hover. + +> [!note] +> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. + +This plugin accepts the following configuration options: + +- `enableSmartyPants`: When true, enables typographic enhancements. Default is true. +- `linkHeadings`: When true, automatically adds links to headings. Default is true. + +## API + +- Category: Transformer +- Function name: `Plugin.GitHubFlavoredMarkdown()`. +- Source: [`quartz/plugins/transformers/gfm.ts`](https://github.com/jackyzha0/quartz/blob/v4/quartz/plugins/transformers/gfm.ts). diff --git a/docs/plugins/HardLineBreaks.md b/docs/plugins/HardLineBreaks.md new file mode 100644 index 000000000..d35d74cf9 --- /dev/null +++ b/docs/plugins/HardLineBreaks.md @@ -0,0 +1,18 @@ +--- +title: HardLineBreaks +tags: + - plugin/transformer +--- + +This plugin automatically converts single line breaks in Markdown text into hard line breaks in the HTML output. This plugin is not enabled by default as this doesn't follow the semantics of actual Markdown but you may enable it if you'd like parity with [[Obsidian compatibility|Obsidian]]. + +> [!note] +> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. + +This plugin has no configuration options. + +## API + +- Category: Transformer +- Function name: `Plugin.HardLineBreaks()`. +- Source: [`quartz/plugins/transformers/linebreaks.ts`](https://github.com/jackyzha0/quartz/blob/v4/quartz/plugins/transformers/linebreaks.ts). diff --git a/docs/plugins/Latex.md b/docs/plugins/Latex.md new file mode 100644 index 000000000..8a8999e86 --- /dev/null +++ b/docs/plugins/Latex.md @@ -0,0 +1,20 @@ +--- +title: "Latex" +tags: + - plugin/transformer +--- + +This plugin adds LaTeX support to Quartz. See [[features/Latex|Latex]] for more information. + +> [!note] +> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. + +This plugin accepts the following configuration options: + +- `renderEngine`: the engine to use to render LaTeX equations. Can be `"katex"` for [KaTeX](https://katex.org/) or `"mathjax"` for [MathJax](https://www.mathjax.org/) [SVG rendering](https://docs.mathjax.org/en/latest/output/svg.html). Defaults to KaTeX. + +## API + +- Category: Transformer +- Function name: `Plugin.Latex()`. +- Source: [`quartz/plugins/transformers/latex.ts`](https://github.com/jackyzha0/quartz/blob/v4/quartz/plugins/transformers/latex.ts). diff --git a/docs/plugins/NotFoundPage.md b/docs/plugins/NotFoundPage.md new file mode 100644 index 000000000..082f86425 --- /dev/null +++ b/docs/plugins/NotFoundPage.md @@ -0,0 +1,18 @@ +--- +title: NotFoundPage +tags: + - plugin/emitter +--- + +This plugin emits a 404 (Not Found) page for broken or non-existent URLs. + +> [!note] +> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. + +This plugin has no configuration options. + +## API + +- Category: Emitter +- Function name: `Plugin.NotFoundPage()`. +- Source: [`quartz/plugins/emitters/404.tsx`](https://github.com/jackyzha0/quartz/blob/v4/quartz/plugins/emitters/404.tsx). diff --git a/docs/plugins/ObsidianFlavoredMarkdown.md b/docs/plugins/ObsidianFlavoredMarkdown.md new file mode 100644 index 000000000..7700a5cfb --- /dev/null +++ b/docs/plugins/ObsidianFlavoredMarkdown.md @@ -0,0 +1,34 @@ +--- +title: ObsidianFlavoredMarkdown +tags: + - plugin/transformer +--- + +This plugin provides support for [[Obsidian compatibility]]. + +> [!note] +> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. + +This plugin accepts the following configuration options: + +- `comments`: If `true` (default), enables parsing of `%%` style Obsidian comment blocks. +- `highlight`: If `true` (default), enables parsing of `==` style highlights within content. +- `wikilinks`:If `true` (default), turns [[wikilinks]] into regular links. +- `callouts`: If `true` (default), adds support for [[callouts|callout]] blocks for emphasizing content. +- `mermaid`: If `true` (default), enables [[Mermaid diagrams|Mermaid diagram]] rendering within Markdown files. +- `parseTags`: If `true` (default), parses and links tags within the content. +- `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. +- `enableVideoEmbed`: If `true` (default), enables the embedding of video files. +- `enableCheckbox`: If `true`, adds support for interactive checkboxes in content. Defaults to `false`. + +> [!warning] +> Don't remove this plugin if you're using [[Obsidian compatibility|Obsidian]] to author the content! + +## API + +- Category: Transformer +- Function name: `Plugin.ObsidianFlavoredMarkdown()`. +- Source: [`quartz/plugins/transformers/toc.ts`](https://github.com/jackyzha0/quartz/blob/v4/quartz/plugins/transformers/toc.ts). diff --git a/docs/plugins/OxHugoFlavoredMarkdown.md b/docs/plugins/OxHugoFlavoredMarkdown.md new file mode 100644 index 000000000..523a21589 --- /dev/null +++ b/docs/plugins/OxHugoFlavoredMarkdown.md @@ -0,0 +1,29 @@ +--- +title: OxHugoFlavoredMarkdown +tags: + - plugin/transformer +--- + +This plugin provides support for [ox-hugo](https://github.com/kaushalmodi/ox-hugo) compatibility. See [[OxHugo compatibility]] for more information. + +> [!note] +> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. + +This plugin accepts the following configuration options: + +- `wikilinks`: If `true` (default), converts Hugo `{{ relref }}` shortcodes to Quartz [[wikilinks]]. +- `removePredefinedAnchor`: If `true` (default), strips predefined anchors from headings. +- `removeHugoShortcode`: If `true` (default), removes Hugo shortcode syntax (`{{}}`) from the content. +- `replaceFigureWithMdImg`: If `true` (default), replaces `
` with `![]()`. +- `replaceOrgLatex`: If `true` (default), converts Org-mode [[features/Latex|Latex]] fragments to Quartz-compatible LaTeX wrapped in `$` (for inline) and `$$` (for block equations). + +> [!warning] +> While you can use this together with [[ObsidianFlavoredMarkdown]], it's not recommended because it might mutate the file in unexpected ways. Use with caution. +> +> If you use `toml` frontmatter, make sure to configure the [[Frontmatter]] plugin accordingly. See [[OxHugo compatibility]] for an example. + +## API + +- Category: Transformer +- Function name: `Plugin.OxHugoFlavoredMarkdown()`. +- Source: [`quartz/plugins/transformers/oxhugofm.ts`](https://github.com/jackyzha0/quartz/blob/v4/quartz/plugins/transformers/oxhugofm.ts). diff --git a/docs/plugins/RemoveDrafts.md b/docs/plugins/RemoveDrafts.md new file mode 100644 index 000000000..729ac86a7 --- /dev/null +++ b/docs/plugins/RemoveDrafts.md @@ -0,0 +1,18 @@ +--- +title: RemoveDrafts +tags: + - plugin/filter +--- + +This plugin filters out content from your vault, so that only finalized content is made available. This prevents [[private pages]] from being published. By default, it filters out all pages with `draft: true` in the frontmatter and leaves all other pages intact. + +> [!note] +> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. + +This plugin has no configuration options. + +## API + +- Category: Filter +- Function name: `Plugin.RemoveDrafts()`. +- Source: [`quartz/plugins/filters/draft.ts`](https://github.com/jackyzha0/quartz/blob/v4/quartz/plugins/filters/draft.ts). diff --git a/docs/plugins/Static.md b/docs/plugins/Static.md new file mode 100644 index 000000000..c660eabf4 --- /dev/null +++ b/docs/plugins/Static.md @@ -0,0 +1,21 @@ +--- +title: Static +tags: + - plugin/emitter +--- + +This plugin emits all static resources needed by Quartz. This is used, for example, for fonts and images that need a stable position, such as banners and icons. The plugin respects the `ignorePatterns` in the global [[configuration]]. + +> [!important] +> This is different from [[Assets]]. The resources from the [[Static]] plugin are located under `quartz/static`, whereas [[Assets]] renders all static resources under `content` and is used for images, videos, audio, etc. that are directly referenced by your markdown content. + +> [!note] +> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. + +This plugin has no configuration options. + +## API + +- Category: Emitter +- Function name: `Plugin.Static()`. +- Source: [`quartz/plugins/emitters/static.ts`](https://github.com/jackyzha0/quartz/blob/v4/quartz/plugins/emitters/static.ts). diff --git a/docs/plugins/SyntaxHighlighting.md b/docs/plugins/SyntaxHighlighting.md new file mode 100644 index 000000000..8bf581eb4 --- /dev/null +++ b/docs/plugins/SyntaxHighlighting.md @@ -0,0 +1,23 @@ +--- +title: "SyntaxHighlighting" +tags: + - plugin/transformer +--- + +This plugin is used to add syntax highlighting to code blocks in Quartz. See [[syntax highlighting]] for more information. + +> [!note] +> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. + +This plugin accepts the following configuration options: + +- `theme`: a separate id of one of the [themes bundled with Shikiji](https://shikiji.netlify.app/themes). One for light mode and one for dark mode. Defaults to `theme: { light: "github-light", dark: "github-dark" }`. +- `keepBackground`: If set to `true`, the background of the Shikiji theme will be used. With `false` (default) the Quartz theme color for background will be used instead. + +In addition, you can further override the colours in the `quartz/styles/syntax.scss` file. + +## API + +- Category: Transformer +- Function name: `Plugin.SyntaxHighlighting()`. +- Source: [`quartz/plugins/transformers/syntax.ts`](https://github.com/jackyzha0/quartz/blob/v4/quartz/plugins/transformers/syntax.ts). diff --git a/docs/plugins/TableOfContents.md b/docs/plugins/TableOfContents.md new file mode 100644 index 000000000..d443d0eaa --- /dev/null +++ b/docs/plugins/TableOfContents.md @@ -0,0 +1,26 @@ +--- +title: TableOfContents +tags: + - plugin/transformer +--- + +This plugin generates a table of contents (TOC) for Markdown documents. See [[table of contents]] for more information. + +> [!note] +> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. + +This plugin accepts the following configuration options: + +- `maxDepth`: Limits the depth of headings included in the TOC, ranging from `1` (top level headings only) to `6` (all heading levels). Default is `3`. +- `minEntries`: The minimum number of heading entries required for the TOC to be displayed. Default is `1`. +- `showByDefault`: If `true` (default), the TOC should be displayed by default. Can be overridden by frontmatter settings. +- `collapseByDefault`: If `true`, the TOC will start in a collapsed state. Default is `false`. + +> [!warning] +> This plugin needs the `Component.TableOfContents` component in `quartz.layout.ts` to determine where to display the TOC. Without it, nothing will be displayed. They should always be added or removed together. + +## API + +- Category: Transformer +- Function name: `Plugin.TableOfContents()`. +- Source: [`quartz/plugins/transformers/toc.ts`](https://github.com/jackyzha0/quartz/blob/v4/quartz/plugins/transformers/toc.ts). diff --git a/docs/plugins/TagPage.md b/docs/plugins/TagPage.md new file mode 100644 index 000000000..4dabfd06c --- /dev/null +++ b/docs/plugins/TagPage.md @@ -0,0 +1,20 @@ +--- +title: TagPage +tags: + - plugin/emitter +--- + +This plugin emits dedicated pages for each tag used in the content. See [[folder and tag listings]] for more information. + +> [!note] +> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. + +This plugin has no configuration options. + +The pages are displayed using the `defaultListPageLayout` in `quartz.layouts.ts`. For the content, the `TagContent` component is used. If you want to modify the layout, you must edit it directly (`quartz/components/pages/TagContent.tsx`). + +## API + +- Category: Emitter +- Function name: `Plugin.AliasRedirects()`. +- Source: [`quartz/plugins/emitters/tagPage.tsx`](https://github.com/jackyzha0/quartz/blob/v4/quartz/plugins/emitters/tagPage.tsx). diff --git a/docs/plugins/index.md b/docs/plugins/index.md new file mode 100644 index 000000000..298ff164c --- /dev/null +++ b/docs/plugins/index.md @@ -0,0 +1,3 @@ +--- +title: Plugins +--- diff --git a/docs/tags/plugin.md b/docs/tags/plugin.md new file mode 100644 index 000000000..298ff164c --- /dev/null +++ b/docs/tags/plugin.md @@ -0,0 +1,3 @@ +--- +title: Plugins +--- diff --git a/quartz.config.ts b/quartz.config.ts index 8c479ac78..2cdadb740 100644 --- a/quartz.config.ts +++ b/quartz.config.ts @@ -1,6 +1,11 @@ import { QuartzConfig } from "./quartz/cfg" import * as Plugin from "./quartz/plugins" +/** + * Quartz 4.0 Configuration + * + * See https://quartz.jzhao.xyz/configuration for more information. + */ const config: QuartzConfig = { configuration: { pageTitle: "🪴 Quartz 4.0", @@ -48,19 +53,14 @@ const config: QuartzConfig = { transformers: [ Plugin.FrontMatter(), Plugin.CreatedModifiedDate({ - // you can add 'git' here for last modified from Git - // if you do rely on git for dates, ensure defaultDateType is 'modified' priority: ["frontmatter", "filesystem"], }), Plugin.Latex({ renderEngine: "katex" }), Plugin.SyntaxHighlighting({ - // uses themes bundled with Shikiji, see https://shikiji.netlify.app/themes theme: { light: "github-light", dark: "github-dark", }, - // set this to 'true' to use the background color of the Shikiji theme - // if set to 'false', will use Quartz theme colors for background keepBackground: false, }), Plugin.ObsidianFlavoredMarkdown({ enableInHtmlEmbed: false }), From 6be1ed1ea2ab6602f1d77d98cd9972aa391a5e7f Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Fri, 23 Feb 2024 17:45:41 -0800 Subject: [PATCH 036/135] 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 037/135] 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 038/135] 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 039/135] 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 040/135] 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 041/135] 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 042/135] 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 043/135] 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 044/135] 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 045/135] 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 046/135] 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 047/135] 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 048/135] 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 049/135] 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 050/135] 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 051/135] 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 052/135] 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 053/135] 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 054/135] 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 055/135] 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 056/135] 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 057/135] 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 058/135] 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 059/135] 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 060/135] 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 061/135] =?UTF-8?q?revert:=20"fix(callout):=20reorder=20th?= =?UTF-8?q?e=20plugins=20to=20render=20latex=20on=20callout=E2=80=A6=20(#9?= =?UTF-8?q?65)?= 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 062/135] 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 063/135] 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 064/135] 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 065/135] 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 066/135] 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 067/135] 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 068/135] 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 069/135] 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 070/135] 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 } }, From 6d59aa8201a1fd3abea32ef36206af6471d85435 Mon Sep 17 00:00:00 2001 From: Emile Bangma Date: Fri, 8 Mar 2024 10:04:44 +0100 Subject: [PATCH 071/135] fix(description): counts characters instead of words (#972) * fix(description): make sure description counts characters instead of words * ref: removed duplicate ternary --- quartz/plugins/transformers/description.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/quartz/plugins/transformers/description.ts b/quartz/plugins/transformers/description.ts index b582feea6..2ec88804a 100644 --- a/quartz/plugins/transformers/description.ts +++ b/quartz/plugins/transformers/description.ts @@ -42,22 +42,25 @@ export const Description: QuartzTransformerPlugin | undefined> const finalDesc: string[] = [] const len = opts.descriptionLength let sentenceIdx = 0 + let currentDescriptionLength = 0 if (sentences[0] !== undefined && sentences[0].length >= len) { const firstSentence = sentences[0].split(" ") - while (finalDesc.length < len) { + while (currentDescriptionLength < len) { const sentence = firstSentence[sentenceIdx] if (!sentence) break finalDesc.push(sentence) + currentDescriptionLength += sentence.length sentenceIdx++ } finalDesc.push("...") } else { - while (finalDesc.length < len) { + while (currentDescriptionLength < len) { const sentence = sentences[sentenceIdx] if (!sentence) break - finalDesc.push(sentence.endsWith(".") ? sentence : sentence + ".") - sentenceIdx++ + const currentSentence = sentence.endsWith(".") ? sentence : sentence + "." + finalDesc.push(currentSentence) + currentDescriptionLength += currentSentence.length } } From b30a200bd4ddc64f4fd3d2124fcda0b354847073 Mon Sep 17 00:00:00 2001 From: Aaron Pham <29749331+aarnphm@users.noreply.github.com> Date: Fri, 8 Mar 2024 12:14:22 -0500 Subject: [PATCH 072/135] fix(i18n): make sure to use correct fileData for manual localization (#975) Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com> --- quartz/components/renderPage.tsx | 2 +- quartz/plugins/transformers/frontmatter.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/quartz/components/renderPage.tsx b/quartz/components/renderPage.tsx index 7a97edbc2..0c1854448 100644 --- a/quartz/components/renderPage.tsx +++ b/quartz/components/renderPage.tsx @@ -209,7 +209,7 @@ export function renderPage(
    ) - const lang = componentData.frontmatter?.lang ?? cfg.locale?.split("-")[0] ?? "en" + const lang = componentData.fileData.frontmatter?.lang ?? cfg.locale?.split("-")[0] ?? "en" const doc = ( diff --git a/quartz/plugins/transformers/frontmatter.ts b/quartz/plugins/transformers/frontmatter.ts index 79aa5f313..5ab239a31 100644 --- a/quartz/plugins/transformers/frontmatter.ts +++ b/quartz/plugins/transformers/frontmatter.ts @@ -90,6 +90,7 @@ declare module "vfile" { description: string publish: boolean draft: boolean + lang: string enableToc: string cssclasses: string[] }> From 2e9a0c21db717c324a74f761fb0910b1218fdd72 Mon Sep 17 00:00:00 2001 From: Emile Bangma Date: Sat, 9 Mar 2024 17:43:40 +0100 Subject: [PATCH 073/135] fix(description): first sentence no longer repeats until max length (#981) --- quartz/plugins/transformers/description.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/quartz/plugins/transformers/description.ts b/quartz/plugins/transformers/description.ts index 2ec88804a..5900745c4 100644 --- a/quartz/plugins/transformers/description.ts +++ b/quartz/plugins/transformers/description.ts @@ -61,6 +61,7 @@ export const Description: QuartzTransformerPlugin | undefined> const currentSentence = sentence.endsWith(".") ? sentence : sentence + "." finalDesc.push(currentSentence) currentDescriptionLength += currentSentence.length + sentenceIdx++ } } From 94a54698ab7f29a609ca90033c1384a7ec5f5e65 Mon Sep 17 00:00:00 2001 From: Emile Bangma Date: Sat, 9 Mar 2024 17:59:55 +0100 Subject: [PATCH 074/135] fix(resources): Use full path to font when cdnCache is false (#976) --- 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 7d1a01d20..eae496ea0 100644 --- a/quartz/plugins/emitters/componentResources.ts +++ b/quartz/plugins/emitters/componentResources.ts @@ -228,7 +228,7 @@ export const ComponentResources: QuartzEmitterPlugin = (opts?: Partial< googleFontsStyleSheet = googleFontsStyleSheet.replace( url, - `/static/fonts/${filename}.ttf`, + `https://${cfg.baseUrl}/static/fonts/${filename}.ttf`, ) promises.push( From 6e0c10297095a918109a058762beb47efc384a21 Mon Sep 17 00:00:00 2001 From: Emile Bangma Date: Sun, 10 Mar 2024 01:14:31 +0100 Subject: [PATCH 075/135] fix(transclusion): prevent duplicate transclusion if multiple transclusions are present. (#982) --- quartz/components/renderPage.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/quartz/components/renderPage.tsx b/quartz/components/renderPage.tsx index 0c1854448..251a53f2e 100644 --- a/quartz/components/renderPage.tsx +++ b/quartz/components/renderPage.tsx @@ -118,11 +118,12 @@ export function renderPage( // skip until we find the blockref that matches if (el.properties?.id === blockRef) { startIdx = i - startDepth = Number(el.tagName.substring(1)) + startDepth = depth } } else if (depth <= startDepth) { // looking for new header that is same level or higher endIdx = i + break } } From b4236e5142c31829cf809c0fbc8370ac22b6d1ba Mon Sep 17 00:00:00 2001 From: kabirgh <15871468+kabirgh@users.noreply.github.com> Date: Sun, 10 Mar 2024 00:42:23 +0000 Subject: [PATCH 076/135] feat(perf:fast-rebuilds): Stop mutating resources param in ComponentResources emitter (#977) * Stop mutating resources param in ComponentResources emitter * Add done rebuilding log for fast rebuilds * Move google font loading to Head component * Simplify code and fix comment --- quartz.config.ts | 3 +- quartz/build.ts | 2 + quartz/components/Head.tsx | 4 +- quartz/plugins/emitters/componentResources.ts | 143 ++++++------------ quartz/plugins/index.ts | 17 +++ quartz/util/theme.ts | 1 + 6 files changed, 72 insertions(+), 98 deletions(-) diff --git a/quartz.config.ts b/quartz.config.ts index 2cdadb740..4b98325dd 100644 --- a/quartz.config.ts +++ b/quartz.config.ts @@ -19,6 +19,7 @@ const config: QuartzConfig = { ignorePatterns: ["private", "templates", ".obsidian"], defaultDateType: "created", theme: { + fontOrigin: "googleFonts", cdnCaching: true, typography: { header: "Schibsted Grotesk", @@ -72,7 +73,7 @@ const config: QuartzConfig = { filters: [Plugin.RemoveDrafts()], emitters: [ Plugin.AliasRedirects(), - Plugin.ComponentResources({ fontOrigin: "googleFonts" }), + Plugin.ComponentResources(), Plugin.ContentPage(), Plugin.FolderPage(), Plugin.TagPage(), diff --git a/quartz/build.ts b/quartz/build.ts index d72b8ddf4..972a7e850 100644 --- a/quartz/build.ts +++ b/quartz/build.ts @@ -309,6 +309,8 @@ async function partialRebuildFromEntrypoint( } await rimraf([...destinationsToDelete]) + console.log(chalk.green(`Done rebuilding in ${perf.timeSince()}`)) + toRemove.clear() release() clientRefresh() diff --git a/quartz/components/Head.tsx b/quartz/components/Head.tsx index 3cb6bea66..46ba5e002 100644 --- a/quartz/components/Head.tsx +++ b/quartz/components/Head.tsx @@ -1,6 +1,7 @@ import { i18n } from "../i18n" import { FullSlug, joinSegments, pathToRoot } from "../util/path" import { JSResourceToScriptElement } from "../util/resources" +import { googleFontHref } from "../util/theme" import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" export default (() => { @@ -21,10 +22,11 @@ export default (() => { {title} - {cfg.theme.cdnCaching && ( + {cfg.theme.cdnCaching && cfg.theme.fontOrigin === "googleFonts" && ( <> + )} diff --git a/quartz/plugins/emitters/componentResources.ts b/quartz/plugins/emitters/componentResources.ts index eae496ea0..0bccb6075 100644 --- a/quartz/plugins/emitters/componentResources.ts +++ b/quartz/plugins/emitters/componentResources.ts @@ -8,7 +8,6 @@ import popoverScript from "../../components/scripts/popover.inline" import styles from "../../styles/custom.scss" import popoverStyle from "../../components/styles/popover.scss" import { BuildCtx } from "../../util/ctx" -import { StaticResources } from "../../util/resources" import { QuartzComponent } from "../../components/types" import { googleFontHref, joinStyles } from "../../util/theme" import { Features, transform } from "lightningcss" @@ -69,13 +68,8 @@ async function joinScripts(scripts: string[]): Promise { return res.code } -function addGlobalPageResources( - ctx: BuildCtx, - staticResources: StaticResources, - componentResources: ComponentResources, -) { +function addGlobalPageResources(ctx: BuildCtx, componentResources: ComponentResources) { const cfg = ctx.cfg.configuration - const reloadScript = ctx.argv.serve // popovers if (cfg.enablePopovers) { @@ -85,12 +79,12 @@ function addGlobalPageResources( if (cfg.analytics?.provider === "google") { const tagId = cfg.analytics.tagId - staticResources.js.push({ - src: `https://www.googletagmanager.com/gtag/js?id=${tagId}`, - contentType: "external", - loadTime: "afterDOMReady", - }) componentResources.afterDOMLoaded.push(` + const gtagScript = document.createElement("script") + gtagScript.src = "https://www.googletagmanager.com/gtag/js?id=${tagId}" + gtagScript.async = true + document.head.appendChild(gtagScript) + window.dataLayer = window.dataLayer || []; function gtag() { dataLayer.push(arguments); } gtag("js", new Date()); @@ -147,115 +141,72 @@ function addGlobalPageResources( document.dispatchEvent(event) `) } - - let wsUrl = `ws://localhost:${ctx.argv.wsPort}` - - if (ctx.argv.remoteDevHost) { - wsUrl = `wss://${ctx.argv.remoteDevHost}:${ctx.argv.wsPort}` - } - - if (reloadScript) { - staticResources.js.push({ - loadTime: "afterDOMReady", - contentType: "inline", - script: ` - const socket = new WebSocket('${wsUrl}') - // reload(true) ensures resources like images and scripts are fetched again in firefox - socket.addEventListener('message', () => document.location.reload(true)) - `, - }) - } } -interface Options { - fontOrigin: "googleFonts" | "local" -} - -const defaultOptions: Options = { - fontOrigin: "googleFonts", -} - -export const ComponentResources: QuartzEmitterPlugin = (opts?: Partial) => { - const { fontOrigin } = { ...defaultOptions, ...opts } +// This emitter should not update the `resources` parameter. If it does, partial +// rebuilds may not work as expected. +export const ComponentResources: QuartzEmitterPlugin = () => { return { name: "ComponentResources", getQuartzComponents() { return [] }, - async getDependencyGraph(ctx, content, _resources) { - // This emitter adds static resources to the `resources` parameter. One - // important resource this emitter adds is the code to start a websocket - // connection and listen to rebuild messages, which triggers a page reload. - // The resources parameter with the reload logic is later used by the - // ContentPage emitter while creating the final html page. In order for - // the reload logic to be included, and so for partial rebuilds to work, - // we need to run this emitter for all markdown files. - const graph = new DepGraph() - - for (const [_tree, file] of content) { - const sourcePath = file.data.filePath! - const slug = file.data.slug! - graph.addEdge(sourcePath, joinSegments(ctx.argv.output, slug + ".html") as FilePath) - } - - return graph + async getDependencyGraph(_ctx, _content, _resources) { + return new DepGraph() }, - async emit(ctx, _content, resources): Promise { + async emit(ctx, _content, _resources): Promise { const promises: Promise[] = [] const cfg = ctx.cfg.configuration // component specific scripts and styles const componentResources = getComponentResources(ctx) let googleFontsStyleSheet = "" - if (fontOrigin === "local") { + if (cfg.theme.fontOrigin === "local") { // let the user do it themselves in css - } else if (fontOrigin === "googleFonts") { - if (cfg.theme.cdnCaching) { - resources.css.push(googleFontHref(cfg.theme)) - } else { - let match + } else if (cfg.theme.fontOrigin === "googleFonts" && !cfg.theme.cdnCaching) { + // when cdnCaching is true, we link to google fonts in Head.tsx + let match - const fontSourceRegex = /url\((https:\/\/fonts.gstatic.com\/s\/[^)]+\.(woff2|ttf))\)/g + const fontSourceRegex = /url\((https:\/\/fonts.gstatic.com\/s\/[^)]+\.(woff2|ttf))\)/g - googleFontsStyleSheet = await ( - await fetch(googleFontHref(ctx.cfg.configuration.theme)) - ).text() + googleFontsStyleSheet = await ( + await fetch(googleFontHref(ctx.cfg.configuration.theme)) + ).text() - while ((match = fontSourceRegex.exec(googleFontsStyleSheet)) !== null) { - // match[0] is the `url(path)`, match[1] is the `path` - const url = match[1] - // the static name of this file. - const [filename, ext] = url.split("/").pop()!.split(".") + while ((match = fontSourceRegex.exec(googleFontsStyleSheet)) !== null) { + // match[0] is the `url(path)`, match[1] is the `path` + const url = match[1] + // the static name of this file. + const [filename, ext] = url.split("/").pop()!.split(".") - googleFontsStyleSheet = googleFontsStyleSheet.replace( - url, - `https://${cfg.baseUrl}/static/fonts/${filename}.ttf`, - ) + googleFontsStyleSheet = googleFontsStyleSheet.replace( + url, + `https://${cfg.baseUrl}/static/fonts/${filename}.ttf`, + ) - promises.push( - fetch(url) - .then((res) => { - if (!res.ok) { - throw new Error(`Failed to fetch font`) - } - return res.arrayBuffer() - }) - .then((buf) => - write({ - ctx, - slug: joinSegments("static", "fonts", filename) as FullSlug, - ext: `.${ext}`, - content: Buffer.from(buf), - }), - ), - ) - } + promises.push( + fetch(url) + .then((res) => { + if (!res.ok) { + throw new Error(`Failed to fetch font`) + } + return res.arrayBuffer() + }) + .then((buf) => + write({ + ctx, + slug: joinSegments("static", "fonts", filename) as FullSlug, + ext: `.${ext}`, + content: Buffer.from(buf), + }), + ), + ) } } // important that this goes *after* component scripts // as the "nav" event gets triggered here and we should make sure // that everyone else had the chance to register a listener for it - addGlobalPageResources(ctx, resources, componentResources) + addGlobalPageResources(ctx, componentResources) const stylesheet = joinStyles( ctx.cfg.configuration.theme, diff --git a/quartz/plugins/index.ts b/quartz/plugins/index.ts index f35d05353..554b1170b 100644 --- a/quartz/plugins/index.ts +++ b/quartz/plugins/index.ts @@ -18,6 +18,23 @@ export function getStaticResourcesFromPlugins(ctx: BuildCtx) { } } + // if serving locally, listen for rebuilds and reload the page + if (ctx.argv.serve) { + const wsUrl = ctx.argv.remoteDevHost + ? `wss://${ctx.argv.remoteDevHost}:${ctx.argv.wsPort}` + : `ws://localhost:${ctx.argv.wsPort}` + + staticResources.js.push({ + loadTime: "afterDOMReady", + contentType: "inline", + script: ` + const socket = new WebSocket('${wsUrl}') + // reload(true) ensures resources like images and scripts are fetched again in firefox + socket.addEventListener('message', () => document.location.reload(true)) + `, + }) + } + return staticResources } diff --git a/quartz/util/theme.ts b/quartz/util/theme.ts index 49cc9cce8..d3bfb9a0d 100644 --- a/quartz/util/theme.ts +++ b/quartz/util/theme.ts @@ -22,6 +22,7 @@ export interface Theme { } cdnCaching: boolean colors: Colors + fontOrigin: "googleFonts" | "local" } export type ThemeKey = keyof Colors From 0f5a9d7b661a1f8610d7001f80a3fd2c52661e51 Mon Sep 17 00:00:00 2001 From: Matt Vogel Date: Sun, 10 Mar 2024 12:57:10 -0400 Subject: [PATCH 077/135] feat: separated content meta (#929) to allow for CSS styling --- quartz/components/ContentMeta.tsx | 22 ++++++++++++++-------- quartz/components/styles/contentMeta.scss | 14 ++++++++++++++ 2 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 quartz/components/styles/contentMeta.scss diff --git a/quartz/components/ContentMeta.tsx b/quartz/components/ContentMeta.tsx index bcbe4285d..5dfec1448 100644 --- a/quartz/components/ContentMeta.tsx +++ b/quartz/components/ContentMeta.tsx @@ -3,16 +3,20 @@ import { QuartzComponentConstructor, QuartzComponentProps } from "./types" import readingTime from "reading-time" import { classNames } from "../util/lang" import { i18n } from "../i18n" +import { JSX } from "preact" +import style from "./styles/contentMeta.scss" interface ContentMetaOptions { /** * Whether to display reading time */ showReadingTime: boolean + showComma: boolean } const defaultOptions: ContentMetaOptions = { showReadingTime: true, + showComma: true, } export default ((opts?: Partial) => { @@ -23,7 +27,7 @@ export default ((opts?: Partial) => { const text = fileData.text if (text) { - const segments: string[] = [] + const segments: (string | JSX.Element)[] = [] if (fileData.dates) { segments.push(formatDate(getDate(cfg, fileData)!, cfg.locale)) @@ -38,17 +42,19 @@ export default ((opts?: Partial) => { segments.push(displayedTime) } - return

    {segments.join(", ")}

    + const segmentsElements = segments.map((segment) => {segment}) + + return ( +

    + {segmentsElements} +

    + ) } else { return null } } - ContentMetadata.css = ` - .content-meta { - margin-top: 0; - color: var(--gray); - } - ` + ContentMetadata.css = style + return ContentMetadata }) satisfies QuartzComponentConstructor diff --git a/quartz/components/styles/contentMeta.scss b/quartz/components/styles/contentMeta.scss new file mode 100644 index 000000000..4d89f65d5 --- /dev/null +++ b/quartz/components/styles/contentMeta.scss @@ -0,0 +1,14 @@ +.content-meta { + margin-top: 0; + color: var(--gray); + + &[show-comma="true"] { + > span:not(:last-child) { + margin-right: 8px; + + &::after { + content: ","; + } + } + } +} From 9fff6d7d0dbaacad0f9988d4017b72738e6f6c58 Mon Sep 17 00:00:00 2001 From: Mara-Li Date: Mon, 11 Mar 2024 17:46:53 +0100 Subject: [PATCH 078/135] fix: spelling error (#987) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I really don't know why I translated this like that into "pas trouvé", and it bugged me a lot. I finally fixed it… Signed-off-by: Mara-Li --- quartz/i18n/locales/fr-FR.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quartz/i18n/locales/fr-FR.ts b/quartz/i18n/locales/fr-FR.ts index b485d2b6e..88ad5a27e 100644 --- a/quartz/i18n/locales/fr-FR.ts +++ b/quartz/i18n/locales/fr-FR.ts @@ -63,7 +63,7 @@ export default { lastFewNotes: ({ count }) => `Les dernières ${count} notes`, }, error: { - title: "Pas trouvé", + title: "Introuvable", notFound: "Cette page est soit privée, soit elle n'existe pas.", }, folderContent: { From a00324ddfdea9adf6aaec03abf4f076cb756ee7a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Mar 2024 13:41:41 -0700 Subject: [PATCH 079/135] chore(deps-dev): bump typescript from 5.3.3 to 5.4.2 (#989) Bumps [typescript](https://github.com/Microsoft/TypeScript) from 5.3.3 to 5.4.2. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml) - [Commits](https://github.com/Microsoft/TypeScript/compare/v5.3.3...v5.4.2) --- updated-dependencies: - dependency-name: typescript dependency-type: direct:development 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 b3e7eced9..869c0d845 100644 --- a/package-lock.json +++ b/package-lock.json @@ -81,7 +81,7 @@ "esbuild": "^0.19.9", "prettier": "^3.2.4", "tsx": "^4.7.1", - "typescript": "^5.3.3" + "typescript": "^5.4.2" }, "engines": { "node": ">=18.14", @@ -5649,9 +5649,9 @@ } }, "node_modules/typescript": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", - "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", + "version": "5.4.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.2.tgz", + "integrity": "sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==", "dev": true, "bin": { "tsc": "bin/tsc", diff --git a/package.json b/package.json index a0feb9670..a8c5b8e95 100644 --- a/package.json +++ b/package.json @@ -103,6 +103,6 @@ "esbuild": "^0.19.9", "prettier": "^3.2.4", "tsx": "^4.7.1", - "typescript": "^5.3.3" + "typescript": "^5.4.2" } } From 097abc3cda0d9a6f3cfedfa3c6351648efd8d6b8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Mar 2024 13:41:48 -0700 Subject: [PATCH 080/135] chore(deps): bump async-mutex from 0.4.1 to 0.5.0 (#991) Bumps [async-mutex](https://github.com/DirtyHairy/async-mutex) from 0.4.1 to 0.5.0. - [Changelog](https://github.com/DirtyHairy/async-mutex/blob/master/CHANGELOG.md) - [Commits](https://github.com/DirtyHairy/async-mutex/compare/v0.4.1...v0.5.0) --- updated-dependencies: - dependency-name: async-mutex 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 869c0d845..d02dad10b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@clack/prompts": "^0.7.0", "@floating-ui/dom": "^1.6.3", "@napi-rs/simple-git": "0.1.16", - "async-mutex": "^0.4.1", + "async-mutex": "^0.5.0", "chalk": "^5.3.0", "chokidar": "^3.6.0", "cli-spinner": "^0.2.10", @@ -1213,9 +1213,9 @@ } }, "node_modules/async-mutex": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/async-mutex/-/async-mutex-0.4.1.tgz", - "integrity": "sha512-WfoBo4E/TbCX1G95XTjbWTE3X2XLG0m1Xbv2cwOtuPdyH9CZvnaA5nCt1ucjaKEgW2A5IF71hxrRhr83Je5xjA==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/async-mutex/-/async-mutex-0.5.0.tgz", + "integrity": "sha512-1A94B18jkJ3DYq284ohPxoXbfTA5HsQ7/Mf4DEhcyLx3Bz27Rh59iScbB6EPiP+B+joue6YCxcMXSbFC1tZKwA==", "dependencies": { "tslib": "^2.4.0" } diff --git a/package.json b/package.json index a8c5b8e95..910e2bbbb 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "@clack/prompts": "^0.7.0", "@floating-ui/dom": "^1.6.3", "@napi-rs/simple-git": "0.1.16", - "async-mutex": "^0.4.1", + "async-mutex": "^0.5.0", "chalk": "^5.3.0", "chokidar": "^3.6.0", "cli-spinner": "^0.2.10", From 92cc23dc456ffc23285b83728fbc3434bbca5472 Mon Sep 17 00:00:00 2001 From: Linus Sehn <37184648+linozen@users.noreply.github.com> Date: Wed, 13 Mar 2024 08:59:37 +0100 Subject: [PATCH 081/135] feat(plugin): citations (#984) * feat: add rehype-citations * feat: add citations transformer plugin * feat: add rehype-rewrite * feat: add csl option and add no-popover to citation links * revert: add rehype-rewrite 04b2692 'feat: add rehype-rewrite' * feat: use existing package for html manipulation * fix: remove `console.log()` --- package-lock.json | 273 +++++++++++++++++++++++ package.json | 1 + quartz/plugins/transformers/citations.ts | 52 +++++ quartz/plugins/transformers/index.ts | 1 + 4 files changed, 327 insertions(+) create mode 100644 quartz/plugins/transformers/citations.ts diff --git a/package-lock.json b/package-lock.json index d02dad10b..1c042b2d6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -38,6 +38,7 @@ "pretty-time": "^1.1.0", "reading-time": "^1.5.0", "rehype-autolink-headings": "^7.1.0", + "rehype-citation": "^2.0.0", "rehype-katex": "^7.0.0", "rehype-mathjax": "^6.0.0", "rehype-pretty-code": "^0.13.0", @@ -98,6 +99,82 @@ "is-potential-custom-element-name": "^1.0.1" } }, + "node_modules/@citation-js/core": { + "version": "0.7.9", + "resolved": "https://registry.npmjs.org/@citation-js/core/-/core-0.7.9.tgz", + "integrity": "sha512-fSbkB32JayDChZnAYC/kB+sWHRvxxL7ibVetyBOyzOc+5aCnjb6UVsbcfhnkOIEyAMoRRvWDyFmakEoTtA5ttQ==", + "dependencies": { + "@citation-js/date": "^0.5.0", + "@citation-js/name": "^0.4.2", + "fetch-ponyfill": "^7.1.0", + "sync-fetch": "^0.4.1" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@citation-js/date": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/@citation-js/date/-/date-0.5.1.tgz", + "integrity": "sha512-1iDKAZ4ie48PVhovsOXQ+C6o55dWJloXqtznnnKy6CltJBQLIuLLuUqa8zlIvma0ZigjVjgDUhnVaNU1MErtZw==", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/@citation-js/name": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/@citation-js/name/-/name-0.4.2.tgz", + "integrity": "sha512-brSPsjs2fOVzSnARLKu0qncn6suWjHVQtrqSUrnqyaRH95r/Ad4wPF5EsoWr+Dx8HzkCGb/ogmoAzfCsqlTwTQ==", + "engines": { + "node": ">=6" + } + }, + "node_modules/@citation-js/plugin-bibjson": { + "version": "0.7.9", + "resolved": "https://registry.npmjs.org/@citation-js/plugin-bibjson/-/plugin-bibjson-0.7.9.tgz", + "integrity": "sha512-YNCWIrkhqZ3cZKewHkLBixABo2PvOWnU+8dBx6KfN47ysdECR76xENe86YYpJ0ska2D5ZnTP0jKZIrUHQoxYfQ==", + "dependencies": { + "@citation-js/date": "^0.5.0", + "@citation-js/name": "^0.4.2" + }, + "engines": { + "node": ">=16.0.0" + }, + "peerDependencies": { + "@citation-js/core": "^0.7.0" + } + }, + "node_modules/@citation-js/plugin-bibtex": { + "version": "0.7.9", + "resolved": "https://registry.npmjs.org/@citation-js/plugin-bibtex/-/plugin-bibtex-0.7.9.tgz", + "integrity": "sha512-gIJpCd6vmmTOcRfDrSOjtoNhw2Mi94UwFxmgJ7GwkXyTYcNheW5VlMMo1tlqjakJGARQ0eOsKcI57gSPqJSS2g==", + "dependencies": { + "@citation-js/date": "^0.5.0", + "@citation-js/name": "^0.4.2", + "moo": "^0.5.1" + }, + "engines": { + "node": ">=16.0.0" + }, + "peerDependencies": { + "@citation-js/core": "^0.7.0" + } + }, + "node_modules/@citation-js/plugin-csl": { + "version": "0.7.9", + "resolved": "https://registry.npmjs.org/@citation-js/plugin-csl/-/plugin-csl-0.7.9.tgz", + "integrity": "sha512-mbD7CnUiPOuVnjeJwo+d0RGUcY0PE8n01gHyjq0qpTeS42EGmQ9+LzqfsTUVWWBndTwc6zLRuIF1qFAUHKE4oA==", + "dependencies": { + "@citation-js/date": "^0.5.0", + "citeproc": "^2.4.6" + }, + "engines": { + "node": ">=16.0.0" + }, + "peerDependencies": { + "@citation-js/core": "^0.7.0" + } + }, "node_modules/@clack/core": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/@clack/core/-/core-0.3.3.tgz", @@ -1239,6 +1316,25 @@ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/bidi-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/bidi-js/-/bidi-js-1.0.3.tgz", @@ -1274,6 +1370,29 @@ "node": ">=8" } }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, "node_modules/buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", @@ -1366,6 +1485,11 @@ "fsevents": "~2.3.2" } }, + "node_modules/citeproc": { + "version": "2.4.63", + "resolved": "https://registry.npmjs.org/citeproc/-/citeproc-2.4.63.tgz", + "integrity": "sha512-68F95Bp4UbgZU/DBUGQn0qV3HDZLCdI9+Bb2ByrTaNJDL5VEm9LqaiNaxljsvoaExSLEXe1/r6n2Z06SCzW3/Q==" + }, "node_modules/cli-spinner": { "version": "0.2.10", "resolved": "https://registry.npmjs.org/cli-spinner/-/cli-spinner-0.2.10.tgz", @@ -1497,6 +1621,14 @@ "node": ">= 0.6" } }, + "node_modules/cross-fetch": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz", + "integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==", + "dependencies": { + "node-fetch": "^2.6.12" + } + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -2172,6 +2304,52 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/fetch-ponyfill": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/fetch-ponyfill/-/fetch-ponyfill-7.1.0.tgz", + "integrity": "sha512-FhbbL55dj/qdVO3YNK7ZEkshvj3eQ7EuIGV2I6ic/2YiocvyWv+7jg2s4AyS0wdRU75s3tA8ZxI/xPigb0v5Aw==", + "dependencies": { + "node-fetch": "~2.6.1" + } + }, + "node_modules/fetch-ponyfill/node_modules/node-fetch": { + "version": "2.6.13", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.13.tgz", + "integrity": "sha512-StxNAxh15zr77QvvkmveSQ8uCQ4+v5FkvNTj0OESmiHu+VRi/gXArXtkWMElOsOUNLtUEvI4yS+rdtOHZTwlQA==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/fetch-ponyfill/node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "node_modules/fetch-ponyfill/node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/fetch-ponyfill/node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -2748,6 +2926,25 @@ "node": ">=0.10.0" } }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/ignore": { "version": "5.2.4", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", @@ -4316,6 +4513,11 @@ "resolved": "https://registry.npmjs.org/mj-context-menu/-/mj-context-menu-0.6.1.tgz", "integrity": "sha512-7NO5s6n10TIV96d4g2uDpG7ZDpIhMh0QNfGdJw/W47JswFcosz457wqz/b5sAKvl12sxINGFCn80NZHKwxQEXA==" }, + "node_modules/moo": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/moo/-/moo-0.5.2.tgz", + "integrity": "sha512-iSAJLHYKnX41mKcJKjqvnAN9sf0LMDTXDEvFv+ffuRR9a1MIuXLjMNL6EsnDHSkKLTWNqQQ5uo61P4EbU4NU+Q==" + }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -4333,6 +4535,44 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/node-fetch/node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "node_modules/node-fetch/node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/node-fetch/node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -4598,6 +4838,27 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/rehype-citation": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/rehype-citation/-/rehype-citation-2.0.0.tgz", + "integrity": "sha512-rGawTBI8SJA1Y4IRyROvpYF6oXBVNFXlJYHIJ2jJH3HgeuCbAC9AO8wE/NMPLDOPQ8+Q8QkZm93fKsnUNbvwZA==", + "dependencies": { + "@citation-js/core": "^0.7.1", + "@citation-js/date": "^0.5.1", + "@citation-js/name": "^0.4.2", + "@citation-js/plugin-bibjson": "^0.7.2", + "@citation-js/plugin-bibtex": "^0.7.2", + "@citation-js/plugin-csl": "^0.7.2", + "citeproc": "^2.4.63", + "cross-fetch": "^4.0.0", + "hast-util-from-dom": "^5.0.0", + "hast-util-from-parse5": "^8.0.1", + "js-yaml": "^4.1.0", + "parse5": "^7.1.2", + "unified": "^11.0.0", + "unist-util-visit": "^5.0.0" + } + }, "node_modules/rehype-katex": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/rehype-katex/-/rehype-katex-7.0.0.tgz", @@ -5537,6 +5798,18 @@ "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==" }, + "node_modules/sync-fetch": { + "version": "0.4.5", + "resolved": "https://registry.npmjs.org/sync-fetch/-/sync-fetch-0.4.5.tgz", + "integrity": "sha512-esiWJ7ixSKGpd9DJPBTC4ckChqdOjIwJfYhVHkcQ2Gnm41323p1TRmEI+esTQ9ppD+b5opps2OTEGTCGX5kF+g==", + "dependencies": { + "buffer": "^5.7.1", + "node-fetch": "^2.6.1" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", diff --git a/package.json b/package.json index 910e2bbbb..2395c7dc2 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,7 @@ "pretty-time": "^1.1.0", "reading-time": "^1.5.0", "rehype-autolink-headings": "^7.1.0", + "rehype-citation": "^2.0.0", "rehype-katex": "^7.0.0", "rehype-mathjax": "^6.0.0", "rehype-pretty-code": "^0.13.0", diff --git a/quartz/plugins/transformers/citations.ts b/quartz/plugins/transformers/citations.ts new file mode 100644 index 000000000..bb302e437 --- /dev/null +++ b/quartz/plugins/transformers/citations.ts @@ -0,0 +1,52 @@ +import rehypeCitation from "rehype-citation" +import { PluggableList } from "unified" +import { visit } from "unist-util-visit" +import { QuartzTransformerPlugin } from "../types" + +export interface Options { + bibliographyFile: string + suppressBibliography: boolean + linkCitations: boolean + csl: string +} + +const defaultOptions: Options = { + bibliographyFile: "./bibliography.bib", + suppressBibliography: false, + linkCitations: false, + csl: "apa", +} + +export const Citations: QuartzTransformerPlugin | undefined> = (userOpts) => { + const opts = { ...defaultOptions, ...userOpts } + return { + name: "Citations", + htmlPlugins() { + const plugins: PluggableList = [] + + // Add rehype-citation to the list of plugins + plugins.push([ + rehypeCitation, + { + bibliography: opts.bibliographyFile, + suppressBibliography: opts.suppressBibliography, + linkCitations: opts.linkCitations, + }, + ]) + + // Transform the HTML of the citattions; add data-no-popover property to the citation links + // using https://github.com/syntax-tree/unist-util-visit as they're just anochor links + plugins.push(() => { + return (tree, _file) => { + visit(tree, "element", (node, index, parent) => { + if (node.tagName === "a" && node.properties?.href?.startsWith("#bib")) { + node.properties["data-no-popover"] = true + } + }) + } + }) + + return plugins + }, + } +} diff --git a/quartz/plugins/transformers/index.ts b/quartz/plugins/transformers/index.ts index e340f10e7..7908c865e 100644 --- a/quartz/plugins/transformers/index.ts +++ b/quartz/plugins/transformers/index.ts @@ -1,5 +1,6 @@ export { FrontMatter } from "./frontmatter" export { GitHubFlavoredMarkdown } from "./gfm" +export { Citations } from "./citations" export { CreatedModifiedDate } from "./lastmod" export { Latex } from "./latex" export { Description } from "./description" From 8be51a0504a7d819a9dab66d854dbef77878520a Mon Sep 17 00:00:00 2001 From: catcodeme <1020082805@qq.com> Date: Fri, 15 Mar 2024 14:25:01 +0800 Subject: [PATCH 082/135] fix: wikiLink in table (#993) * fix: wikiLink in table - update regexp to make '\' to group in alias - handle alias using block_id * style: format with prettier * style: add comment for block_ref(without alias) in table --------- Co-authored-by: hulinjiang --- quartz/plugins/transformers/ofm.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/quartz/plugins/transformers/ofm.ts b/quartz/plugins/transformers/ofm.ts index 5058c8b35..40919607b 100644 --- a/quartz/plugins/transformers/ofm.ts +++ b/quartz/plugins/transformers/ofm.ts @@ -103,9 +103,9 @@ export const arrowRegex = new RegExp(/(-{1,2}>|={1,2}>|<-{1,2}|<={1,2})/, "g") // \[\[ -> open brace // ([^\[\]\|\#]+) -> one or more non-special characters ([,],|, or #) (name) // (#[^\[\]\|\#]+)? -> # then one or more non-special characters (heading link) -// (\|[^\[\]\#]+)? -> | then one or more non-special characters (alias) +// (\|[^\[\]\#]+)? -> \| then one or more non-special characters (alias) export const wikilinkRegex = new RegExp( - /!?\[\[([^\[\]\|\#]+)?(#+[^\[\]\|\#]+)?(\|[^\[\]\#]+)?\]\]/, + /!?\[\[([^\[\]\|\#\\]+)?(#+[^\[\]\|\#\\]+)?(\\?\|[^\[\]\#]+)?\]\]/, "g", ) const highlightRegex = new RegExp(/==([^=]+)==/, "g") @@ -176,13 +176,18 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin const anchor = rawHeader?.trim().replace(/^#+/, "") const blockRef = Boolean(anchor?.startsWith("^")) ? "^" : "" const displayAnchor = anchor ? `#${blockRef}${slugAnchor(anchor)}` : "" - const displayAlias = rawAlias ?? rawHeader?.replace("#", "|") ?? "" + let displayAlias = rawAlias ?? rawHeader?.replace("#", "|") ?? "" const embedDisplay = value.startsWith("!") ? "!" : "" if (rawFp?.match(externalLinkRegex)) { return `${embedDisplay}[${displayAlias.replace(/^\|/, "")}](${rawFp})` } + //transform `[[note#^block_ref|^block_ref]]` to `[[note#^block_ref\|^block_ref]]`, display correctly in table. + if (displayAlias && displayAlias.startsWith("|")) { + displayAlias = `\\${displayAlias}` + } + return `${embedDisplay}[[${fp}${displayAnchor}${displayAlias}]]` }) } From b98e4be66548e452419a1e4138d9d6d1981f891e Mon Sep 17 00:00:00 2001 From: Mara-Li Date: Fri, 15 Mar 2024 23:28:31 +0100 Subject: [PATCH 083/135] feat(i18n): Add French translation for reading time (#998) Signed-off-by: Mara-Li --- quartz/i18n/locales/fr-FR.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quartz/i18n/locales/fr-FR.ts b/quartz/i18n/locales/fr-FR.ts index 88ad5a27e..e1dfa48b7 100644 --- a/quartz/i18n/locales/fr-FR.ts +++ b/quartz/i18n/locales/fr-FR.ts @@ -54,7 +54,7 @@ export default { title: "Table des Matières", }, contentMeta: { - readingTime: ({ minutes }) => `${minutes} min read`, + readingTime: ({ minutes }) => `${minutes} min de lecture`, }, }, pages: { From 47024022e834e1bb6c70f671cb32597f42aabd94 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Mar 2024 18:29:14 -0400 Subject: [PATCH 084/135] chore(deps-dev): bump @types/node from 20.11.24 to 20.11.25 (#990) Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.24 to 20.11.25. - [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 1c042b2d6..92d41dd90 100644 --- a/package-lock.json +++ b/package-lock.json @@ -74,7 +74,7 @@ "@types/d3": "^7.4.3", "@types/hast": "^3.0.4", "@types/js-yaml": "^4.0.9", - "@types/node": "^20.11.24", + "@types/node": "^20.11.25", "@types/pretty-time": "^1.1.5", "@types/source-map-support": "^0.5.10", "@types/ws": "^8.5.10", @@ -1170,9 +1170,9 @@ } }, "node_modules/@types/node": { - "version": "20.11.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.24.tgz", - "integrity": "sha512-Kza43ewS3xoLgCEpQrsT+xRo/EJej1y0kVYGiLFE1NEODXGzTfwiC6tXTLMQskn1X4/Rjlh0MQUvx9W+L9long==", + "version": "20.11.25", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.25.tgz", + "integrity": "sha512-TBHyJxk2b7HceLVGFcpAUjsa5zIdsPWlR6XHfyGzd0SFu+/NFgQgMAl96MSDZgQDvJAvV6BKsFOrt6zIL09JDw==", "dev": true, "dependencies": { "undici-types": "~5.26.4" diff --git a/package.json b/package.json index 2395c7dc2..145804871 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "@types/d3": "^7.4.3", "@types/hast": "^3.0.4", "@types/js-yaml": "^4.0.9", - "@types/node": "^20.11.24", + "@types/node": "^20.11.25", "@types/pretty-time": "^1.1.5", "@types/source-map-support": "^0.5.10", "@types/ws": "^8.5.10", From 7164857f6e32aeba3da80112d604244aa8f557f4 Mon Sep 17 00:00:00 2001 From: Aaron Pham <29749331+aarnphm@users.noreply.github.com> Date: Fri, 15 Mar 2024 21:17:42 -0400 Subject: [PATCH 085/135] chore(ofm): remove unused (#999) Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com> --- quartz/plugins/transformers/ofm.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/quartz/plugins/transformers/ofm.ts b/quartz/plugins/transformers/ofm.ts index 40919607b..3b76f2533 100644 --- a/quartz/plugins/transformers/ofm.ts +++ b/quartz/plugins/transformers/ofm.ts @@ -194,9 +194,8 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin return src }, - markdownPlugins(ctx) { + markdownPlugins(_ctx) { const plugins: PluggableList = [] - const cfg = ctx.cfg.configuration // regex replacements plugins.push(() => { From 4691369abf0ccb763112cda10f8208c68814c046 Mon Sep 17 00:00:00 2001 From: Emile Bangma Date: Sat, 16 Mar 2024 14:23:08 +0100 Subject: [PATCH 086/135] fix(wikilinks): only escape alias in wikilinks inside tables (#1000) --- quartz/plugins/transformers/ofm.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/quartz/plugins/transformers/ofm.ts b/quartz/plugins/transformers/ofm.ts index 3b76f2533..50371c87a 100644 --- a/quartz/plugins/transformers/ofm.ts +++ b/quartz/plugins/transformers/ofm.ts @@ -99,13 +99,15 @@ export const externalLinkRegex = /^https?:\/\//i export const arrowRegex = new RegExp(/(-{1,2}>|={1,2}>|<-{1,2}|<={1,2})/, "g") +// (\|[^\|\[\n]*)? -> optional check if wikilink is inside a table cell // !? -> optional embedding // \[\[ -> open brace // ([^\[\]\|\#]+) -> one or more non-special characters ([,],|, or #) (name) // (#[^\[\]\|\#]+)? -> # then one or more non-special characters (heading link) -// (\|[^\[\]\#]+)? -> \| then one or more non-special characters (alias) +// (\|[^\[\]\#]+)? -> \| then one or more non-special characters (alias) +// ([^\|\n]*\|)? -> optional check if wikilink is inside a table cell export const wikilinkRegex = new RegExp( - /!?\[\[([^\[\]\|\#\\]+)?(#+[^\[\]\|\#\\]+)?(\\?\|[^\[\]\#]+)?\]\]/, + /(\|[^\|\[\n]*)?!?\[\[([^\[\]\|\#\\]+)?(#+[^\[\]\|\#\\]+)?(\\?\|[^\[\]\#]+)?\]\]([^\|\n]*\|)?/, "g", ) const highlightRegex = new RegExp(/==([^=]+)==/, "g") @@ -170,7 +172,8 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin } src = src.replace(wikilinkRegex, (value, ...capture) => { - const [rawFp, rawHeader, rawAlias]: (string | undefined)[] = capture + const [rawTablePre, rawFp, rawHeader, rawAlias, rawTablePost]: (string | undefined)[] = + capture const fp = rawFp ?? "" const anchor = rawHeader?.trim().replace(/^#+/, "") @@ -183,8 +186,9 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin return `${embedDisplay}[${displayAlias.replace(/^\|/, "")}](${rawFp})` } - //transform `[[note#^block_ref|^block_ref]]` to `[[note#^block_ref\|^block_ref]]`, display correctly in table. - if (displayAlias && displayAlias.startsWith("|")) { + // transform `[[note#^block_ref|^block_ref]]` to `[[note#^block_ref\|^block_ref]]`, + // when the wikilink with alias is inside a table. + if (displayAlias && displayAlias.startsWith("|") && rawTablePre && rawTablePost) { displayAlias = `\\${displayAlias}` } @@ -207,7 +211,7 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin replacements.push([ wikilinkRegex, (value: string, ...capture: string[]) => { - let [rawFp, rawHeader, rawAlias] = capture + let [_rawTablePre, rawFp, rawHeader, rawAlias, _rawTablePost] = capture const fp = rawFp?.trim() ?? "" const anchor = rawHeader?.trim() ?? "" const alias = rawAlias?.slice(1).trim() From 253497cad45b086aae3cc1c99e483146440ae8c2 Mon Sep 17 00:00:00 2001 From: Denis Bezykornov Date: Sat, 16 Mar 2024 20:16:58 +0300 Subject: [PATCH 087/135] docs: add config for Caddy server (#1002) --- docs/hosting.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/hosting.md b/docs/hosting.md index eeb930849..e5ef9a615 100644 --- a/docs/hosting.md +++ b/docs/hosting.md @@ -250,3 +250,21 @@ server { } } ``` + +### Using Caddy + +Here's and example of how to do this with Caddy: + +```caddy title="Caddyfile" +example.com { + root * /path/to/quartz/public + try_files {path} {path}.html {path}/ =404 + file_server + encode gzip + + handle_errors { + rewrite * /{err.status_code}.html + file_server + } +} +``` From 38d9d5213784ba3250326c66567be5a91d93c415 Mon Sep 17 00:00:00 2001 From: makondratev <69584771+makondratev@users.noreply.github.com> Date: Mon, 18 Mar 2024 03:48:00 +0300 Subject: [PATCH 088/135] feat(search): add search by title/content index and tag at the same time (#978) * feat(search): add search by title/content index and tag at the same time * fix(search): set search type to basic and remove tag from term for proper highlightning and scroll when searched by tag and title/content index * fix(search): use indexOf to find space so it is easier to read * fix(search): trim trailing whitespaces before splitting * fix(search): set limit to 10000 for combined search mode (to make filter by tag more accurate) --- quartz/components/scripts/search.inline.ts | 33 ++++++++++++++++++---- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/quartz/components/scripts/search.inline.ts b/quartz/components/scripts/search.inline.ts index a75f4ff46..72be6b8dd 100644 --- a/quartz/components/scripts/search.inline.ts +++ b/quartz/components/scripts/search.inline.ts @@ -21,6 +21,7 @@ let index = new FlexSearch.Document({ encode: encoder, document: { id: "id", + tag: "tags", index: [ { field: "title", @@ -405,11 +406,33 @@ document.addEventListener("nav", async (e: CustomEventMap["nav"]) => { let searchResults: FlexSearch.SimpleDocumentSearchResultSetUnit[] if (searchType === "tags") { - searchResults = await index.searchAsync({ - query: currentSearchTerm.substring(1), - limit: numSearchResults, - index: ["tags"], - }) + currentSearchTerm = currentSearchTerm.substring(1).trim() + const separatorIndex = currentSearchTerm.indexOf(" ") + if (separatorIndex != -1) { + // search by title and content index and then filter by tag (implemented in flexsearch) + const tag = currentSearchTerm.substring(0, separatorIndex) + const query = currentSearchTerm.substring(separatorIndex + 1).trim() + searchResults = await index.searchAsync({ + query: query, + // return at least 10000 documents, so it is enough to filter them by tag (implemented in flexsearch) + limit: Math.max(numSearchResults, 10000), + index: ["title", "content"], + tag: tag, + }) + for (let searchResult of searchResults) { + searchResult.result = searchResult.result.slice(0, numSearchResults) + } + // set search type to basic and remove tag from term for proper highlightning and scroll + searchType = "basic" + currentSearchTerm = query + } else { + // default search by tags index + searchResults = await index.searchAsync({ + query: currentSearchTerm, + limit: numSearchResults, + index: ["tags"], + }) + } } else if (searchType === "basic") { searchResults = await index.searchAsync({ query: currentSearchTerm, From 91f0a2abb2d186801244a0b63b64604ac7505031 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Sun, 17 Mar 2024 18:00:04 -0700 Subject: [PATCH 089/135] feat: support rich descriptions in tag listing page (closes #908) --- quartz/components/pages/TagContent.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/quartz/components/pages/TagContent.tsx b/quartz/components/pages/TagContent.tsx index 692585c2b..94061631e 100644 --- a/quartz/components/pages/TagContent.tsx +++ b/quartz/components/pages/TagContent.tsx @@ -52,8 +52,14 @@ const TagContent: QuartzComponent = (props: QuartzComponentProps) => { allFiles: pages, } - const contentPage = allFiles.filter((file) => file.slug === `tags/${tag}`)[0] - const content = contentPage?.description + const contentPage = allFiles.filter((file) => file.slug === `tags/${tag}`).at(0) + + const root = contentPage?.htmlAst + const content = + !root || root?.children.length === 0 + ? contentPage?.description + : htmlToJsx(contentPage.filePath!, root) + return (

    From daa8796554dea41d6fbf81f4eccea58153a4e850 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Sun, 17 Mar 2024 18:15:42 -0700 Subject: [PATCH 090/135] fix: format --- 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 94061631e..9e04359c1 100644 --- a/quartz/components/pages/TagContent.tsx +++ b/quartz/components/pages/TagContent.tsx @@ -56,7 +56,7 @@ const TagContent: QuartzComponent = (props: QuartzComponentProps) => { const root = contentPage?.htmlAst const content = - !root || root?.children.length === 0 + !root || root?.children.length === 0 ? contentPage?.description : htmlToJsx(contentPage.filePath!, root) From 7e22c38f8eaf8d9e3ae3a5b25f4611a5f4503b26 Mon Sep 17 00:00:00 2001 From: Emile Bangma Date: Mon, 18 Mar 2024 02:16:04 +0100 Subject: [PATCH 091/135] fix(wikilinks): handle wikilinks inside tables seperately from other wikilinks (#1005) * fix(wikilinks): handle wikilinks inside tables seperately from other wikilinks * Prettier * Cleaned up duplicate code * Remove test logging * Refactored and fixed for non-aliased wikilinks inside table * Updated naming and comments * Updated comment of wikilink regex * Updated regex to match previous formatting * Match table even if EOF is immediately after the table. * Update quartz/plugins/transformers/ofm.ts Co-authored-by: Jacky Zhao * Change table escape replace to non-regex version * Prettier * Prettier --------- Co-authored-by: Jacky Zhao --- quartz/plugins/transformers/ofm.ts | 53 ++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/quartz/plugins/transformers/ofm.ts b/quartz/plugins/transformers/ofm.ts index 50371c87a..3ee6480ca 100644 --- a/quartz/plugins/transformers/ofm.ts +++ b/quartz/plugins/transformers/ofm.ts @@ -99,17 +99,27 @@ export const externalLinkRegex = /^https?:\/\//i export const arrowRegex = new RegExp(/(-{1,2}>|={1,2}>|<-{1,2}|<={1,2})/, "g") -// (\|[^\|\[\n]*)? -> optional check if wikilink is inside a table cell -// !? -> optional embedding -// \[\[ -> open brace -// ([^\[\]\|\#]+) -> one or more non-special characters ([,],|, or #) (name) -// (#[^\[\]\|\#]+)? -> # then one or more non-special characters (heading link) -// (\|[^\[\]\#]+)? -> \| then one or more non-special characters (alias) -// ([^\|\n]*\|)? -> optional check if wikilink is inside a table cell +// !? -> optional embedding +// \[\[ -> open brace +// ([^\[\]\|\#]+) -> one or more non-special characters ([,],|, or #) (name) +// (#[^\[\]\|\#]+)? -> # then one or more non-special characters (heading link) +// (\\?\|[^\[\]\#]+)? -> optional escape \ then | then one or more non-special characters (alias) export const wikilinkRegex = new RegExp( - /(\|[^\|\[\n]*)?!?\[\[([^\[\]\|\#\\]+)?(#+[^\[\]\|\#\\]+)?(\\?\|[^\[\]\#]+)?\]\]([^\|\n]*\|)?/, + /!?\[\[([^\[\]\|\#\\]+)?(#+[^\[\]\|\#\\]+)?(\\?\|[^\[\]\#]+)?\]\]/, "g", ) + +// ^\|([^\n])+\|\n(\|) -> matches the header row +// ( ?:?-{3,}:? ?\|)+ -> matches the header row separator +// (\|([^\n])+\|\n)+ -> matches the body rows +export const tableRegex = new RegExp( + /^\|([^\n])+\|\n(\|)( ?:?-{3,}:? ?\|)+\n(\|([^\n])+\|\n?)+/, + "gm", +) + +// matches any wikilink, only used for escaping wikilinks inside tables +export const tableWikilinkRegex = new RegExp(/(!?\[\[[^\]]*?\]\])/, "g") + const highlightRegex = new RegExp(/==([^=]+)==/, "g") const commentRegex = new RegExp(/%%[\s\S]*?%%/, "g") // from https://github.com/escwxyz/remark-obsidian-callout/blob/main/src/index.ts @@ -171,27 +181,34 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin src = src.toString() } + // replace all wikilinks inside a table first + src = src.replace(tableRegex, (value) => { + // escape all aliases and headers in wikilinks inside a table + return value.replace(tableWikilinkRegex, (value, ...capture) => { + const [raw]: (string | undefined)[] = capture + let escaped = raw ?? "" + escaped = escaped.replace("#", "\\#") + escaped = escaped.replace("|", "\\|") + + return escaped + }) + }) + + // replace all other wikilinks src = src.replace(wikilinkRegex, (value, ...capture) => { - const [rawTablePre, rawFp, rawHeader, rawAlias, rawTablePost]: (string | undefined)[] = - capture + const [rawFp, rawHeader, rawAlias]: (string | undefined)[] = capture const fp = rawFp ?? "" const anchor = rawHeader?.trim().replace(/^#+/, "") const blockRef = Boolean(anchor?.startsWith("^")) ? "^" : "" const displayAnchor = anchor ? `#${blockRef}${slugAnchor(anchor)}` : "" - let displayAlias = rawAlias ?? rawHeader?.replace("#", "|") ?? "" + const displayAlias = rawAlias ?? rawHeader?.replace("#", "|") ?? "" const embedDisplay = value.startsWith("!") ? "!" : "" if (rawFp?.match(externalLinkRegex)) { return `${embedDisplay}[${displayAlias.replace(/^\|/, "")}](${rawFp})` } - // transform `[[note#^block_ref|^block_ref]]` to `[[note#^block_ref\|^block_ref]]`, - // when the wikilink with alias is inside a table. - if (displayAlias && displayAlias.startsWith("|") && rawTablePre && rawTablePost) { - displayAlias = `\\${displayAlias}` - } - return `${embedDisplay}[[${fp}${displayAnchor}${displayAlias}]]` }) } @@ -211,7 +228,7 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin replacements.push([ wikilinkRegex, (value: string, ...capture: string[]) => { - let [_rawTablePre, rawFp, rawHeader, rawAlias, _rawTablePost] = capture + let [rawFp, rawHeader, rawAlias] = capture const fp = rawFp?.trim() ?? "" const anchor = rawHeader?.trim() ?? "" const alias = rawAlias?.slice(1).trim() From 8007ec0f82b11d07c7e49175e5a866fe31fc12df Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Mar 2024 18:53:19 -0700 Subject: [PATCH 092/135] chore(deps): bump lightningcss from 1.24.0 to 1.24.1 (#1012) Bumps [lightningcss](https://github.com/parcel-bundler/lightningcss) from 1.24.0 to 1.24.1. - [Release notes](https://github.com/parcel-bundler/lightningcss/releases) - [Commits](https://github.com/parcel-bundler/lightningcss/compare/v1.24.0...v1.24.1) --- updated-dependencies: - dependency-name: lightningcss 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 | 80 +++++++++++++++++++++++------------------------ package.json | 2 +- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/package-lock.json b/package-lock.json index 92d41dd90..f661532cd 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.24.0", + "lightningcss": "^1.24.1", "mdast-util-find-and-replace": "^3.0.1", "mdast-util-to-hast": "^13.1.0", "mdast-util-to-string": "^4.0.0", @@ -3229,9 +3229,9 @@ } }, "node_modules/lightningcss": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.24.0.tgz", - "integrity": "sha512-y36QEEDVx4IM7/yIZNsZJMRREIu26WzTsauIysf5s76YeCmlSbRZS7aC97IGPuoFRnyZ5Wx43OBsQBFB5Ne7ng==", + "version": "1.24.1", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.24.1.tgz", + "integrity": "sha512-kUpHOLiH5GB0ERSv4pxqlL0RYKnOXtgGtVe7shDGfhS0AZ4D1ouKFYAcLcZhql8aMspDNzaUCumGHZ78tb2fTg==", "dependencies": { "detect-libc": "^1.0.3" }, @@ -3243,21 +3243,21 @@ "url": "https://opencollective.com/parcel" }, "optionalDependencies": { - "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" + "lightningcss-darwin-arm64": "1.24.1", + "lightningcss-darwin-x64": "1.24.1", + "lightningcss-freebsd-x64": "1.24.1", + "lightningcss-linux-arm-gnueabihf": "1.24.1", + "lightningcss-linux-arm64-gnu": "1.24.1", + "lightningcss-linux-arm64-musl": "1.24.1", + "lightningcss-linux-x64-gnu": "1.24.1", + "lightningcss-linux-x64-musl": "1.24.1", + "lightningcss-win32-x64-msvc": "1.24.1" } }, "node_modules/lightningcss-darwin-arm64": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.24.0.tgz", - "integrity": "sha512-rTNPkEiynOu4CfGdd5ZfVOQe2gd2idfQd4EfX1l2ZUUwd+2SwSdbb7cG4rlwfnZckbzCAygm85xkpekRE5/wFw==", + "version": "1.24.1", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.24.1.tgz", + "integrity": "sha512-1jQ12jBy+AE/73uGQWGSafK5GoWgmSiIQOGhSEXiFJSZxzV+OXIx+a9h2EYHxdJfX864M+2TAxWPWb0Vv+8y4w==", "cpu": [ "arm64" ], @@ -3274,9 +3274,9 @@ } }, "node_modules/lightningcss-darwin-x64": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.24.0.tgz", - "integrity": "sha512-4KCeF2RJjzp9xdGY8zIH68CUtptEg8uz8PfkHvsIdrP4t9t5CIgfDBhiB8AmuO75N6SofdmZexDZIKdy9vA7Ww==", + "version": "1.24.1", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.24.1.tgz", + "integrity": "sha512-R4R1d7VVdq2mG4igMU+Di8GPf0b64ZLnYVkubYnGG0Qxq1KaXQtAzcLI43EkpnoWvB/kUg8JKCWH4S13NfiLcQ==", "cpu": [ "x64" ], @@ -3293,9 +3293,9 @@ } }, "node_modules/lightningcss-freebsd-x64": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.24.0.tgz", - "integrity": "sha512-FJAYlek1wXuVTsncNU0C6YD41q126dXcIUm97KAccMn9C4s/JfLSqGWT2gIzAblavPFkyGG2gIADTWp3uWfN1g==", + "version": "1.24.1", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.24.1.tgz", + "integrity": "sha512-z6NberUUw5ALES6Ixn2shmjRRrM1cmEn1ZQPiM5IrZ6xHHL5a1lPin9pRv+w6eWfcrEo+qGG6R9XfJrpuY3e4g==", "cpu": [ "x64" ], @@ -3312,9 +3312,9 @@ } }, "node_modules/lightningcss-linux-arm-gnueabihf": { - "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==", + "version": "1.24.1", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.24.1.tgz", + "integrity": "sha512-NLQLnBQW/0sSg74qLNI8F8QKQXkNg4/ukSTa+XhtkO7v3BnK19TS1MfCbDHt+TTdSgNEBv0tubRuapcKho2EWw==", "cpu": [ "arm" ], @@ -3331,9 +3331,9 @@ } }, "node_modules/lightningcss-linux-arm64-gnu": { - "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==", + "version": "1.24.1", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.24.1.tgz", + "integrity": "sha512-AQxWU8c9E9JAjAi4Qw9CvX2tDIPjgzCTrZCSXKELfs4mCwzxRkHh2RCxX8sFK19RyJoJAjA/Kw8+LMNRHS5qEg==", "cpu": [ "arm64" ], @@ -3350,9 +3350,9 @@ } }, "node_modules/lightningcss-linux-arm64-musl": { - "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==", + "version": "1.24.1", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.24.1.tgz", + "integrity": "sha512-JCgH/SrNrhqsguUA0uJUM1PvN5+dVuzPIlXcoWDHSv2OU/BWlj2dUYr3XNzEw748SmNZPfl2NjQrAdzaPOn1lA==", "cpu": [ "arm64" ], @@ -3369,9 +3369,9 @@ } }, "node_modules/lightningcss-linux-x64-gnu": { - "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==", + "version": "1.24.1", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.24.1.tgz", + "integrity": "sha512-TYdEsC63bHV0h47aNRGN3RiK7aIeco3/keN4NkoSQ5T8xk09KHuBdySltWAvKLgT8JvR+ayzq8ZHnL1wKWY0rw==", "cpu": [ "x64" ], @@ -3388,9 +3388,9 @@ } }, "node_modules/lightningcss-linux-x64-musl": { - "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==", + "version": "1.24.1", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.24.1.tgz", + "integrity": "sha512-HLfzVik3RToot6pQ2Rgc3JhfZkGi01hFetHt40HrUMoeKitLoqUUT5owM6yTZPTytTUW9ukLBJ1pc3XNMSvlLw==", "cpu": [ "x64" ], @@ -3407,9 +3407,9 @@ } }, "node_modules/lightningcss-win32-x64-msvc": { - "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==", + "version": "1.24.1", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.24.1.tgz", + "integrity": "sha512-joEupPjYJ7PjZtDsS5lzALtlAudAbgIBMGJPNeFe5HfdmJXFd13ECmEM+5rXNxYVMRHua2w8132R6ab5Z6K9Ow==", "cpu": [ "x64" ], diff --git a/package.json b/package.json index 145804871..b3cb9d2b7 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.24.0", + "lightningcss": "^1.24.1", "mdast-util-find-and-replace": "^3.0.1", "mdast-util-to-hast": "^13.1.0", "mdast-util-to-string": "^4.0.0", From 668640d641edb466e967b2bdc36ad0f09b108252 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Mar 2024 18:54:01 -0700 Subject: [PATCH 093/135] chore(deps): bump shiki from 1.1.7 to 1.2.0 (#1011) Bumps [shiki](https://github.com/shikijs/shiki/tree/HEAD/packages/shiki) from 1.1.7 to 1.2.0. - [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.2.0/packages/shiki) --- updated-dependencies: - dependency-name: shiki 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 | 16 ++++++++-------- package.json | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index f661532cd..1a39efa4d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -55,7 +55,7 @@ "rfdc": "^1.3.1", "rimraf": "^5.0.5", "serve-handler": "^6.1.5", - "shiki": "^1.1.7", + "shiki": "^1.2.0", "source-map-support": "^0.5.21", "to-vfile": "^8.0.0", "toml": "^3.0.0", @@ -820,9 +820,9 @@ } }, "node_modules/@shikijs/core": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.1.7.tgz", - "integrity": "sha512-gTYLUIuD1UbZp/11qozD3fWpUTuMqPSf3svDMMrL0UmlGU7D9dPw/V1FonwAorCUJBltaaESxq90jrSjQyGixg==" + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.2.0.tgz", + "integrity": "sha512-OlFvx+nyr5C8zpcMBnSGir0YPD6K11uYhouqhNmm1qLiis4GA7SsGtu07r9gKS9omks8RtQqHrJL4S+lqWK01A==" }, "node_modules/@sindresorhus/merge-streams": { "version": "2.3.0", @@ -5571,11 +5571,11 @@ } }, "node_modules/shiki": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.1.7.tgz", - "integrity": "sha512-9kUTMjZtcPH3i7vHunA6EraTPpPOITYTdA5uMrvsJRexktqP0s7P3s9HVK80b4pP42FRVe03D7fT3NmJv2yYhw==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.2.0.tgz", + "integrity": "sha512-xLhiTMOIUXCv5DqJ4I70GgQCtdlzsTqFLZWcMHHG3TAieBUbvEGthdrlPDlX4mL/Wszx9C6rEcxU6kMlg4YlxA==", "dependencies": { - "@shikijs/core": "1.1.7" + "@shikijs/core": "1.2.0" } }, "node_modules/signal-exit": { diff --git a/package.json b/package.json index b3cb9d2b7..0651297a4 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "rfdc": "^1.3.1", "rimraf": "^5.0.5", "serve-handler": "^6.1.5", - "shiki": "^1.1.7", + "shiki": "^1.2.0", "source-map-support": "^0.5.21", "to-vfile": "^8.0.0", "toml": "^3.0.0", From de6f469011e15f82ddffa8aad75f628d1ca612da Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Mar 2024 18:54:12 -0700 Subject: [PATCH 094/135] chore(deps-dev): bump @types/node from 20.11.25 to 20.11.29 (#1010) Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.25 to 20.11.29. - [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 1a39efa4d..8ef3e9f0a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -74,7 +74,7 @@ "@types/d3": "^7.4.3", "@types/hast": "^3.0.4", "@types/js-yaml": "^4.0.9", - "@types/node": "^20.11.25", + "@types/node": "^20.11.29", "@types/pretty-time": "^1.1.5", "@types/source-map-support": "^0.5.10", "@types/ws": "^8.5.10", @@ -1170,9 +1170,9 @@ } }, "node_modules/@types/node": { - "version": "20.11.25", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.25.tgz", - "integrity": "sha512-TBHyJxk2b7HceLVGFcpAUjsa5zIdsPWlR6XHfyGzd0SFu+/NFgQgMAl96MSDZgQDvJAvV6BKsFOrt6zIL09JDw==", + "version": "20.11.29", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.29.tgz", + "integrity": "sha512-P99thMkD/1YkCvAtOd6/zGedKNA0p2fj4ZpjCzcNiSCBWgm3cNRTBfa/qjFnsKkkojxu4vVLtWpesnZ9+ap+gA==", "dev": true, "dependencies": { "undici-types": "~5.26.4" diff --git a/package.json b/package.json index 0651297a4..f785b4b33 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "@types/d3": "^7.4.3", "@types/hast": "^3.0.4", "@types/js-yaml": "^4.0.9", - "@types/node": "^20.11.25", + "@types/node": "^20.11.29", "@types/pretty-time": "^1.1.5", "@types/source-map-support": "^0.5.10", "@types/ws": "^8.5.10", From 85a737b4ee72fb4dba12e1aacbd87d1636cfc30e Mon Sep 17 00:00:00 2001 From: Xinyang Yu <47915643+xy-241@users.noreply.github.com> Date: Mon, 25 Mar 2024 00:33:53 +0800 Subject: [PATCH 095/135] docs: Update showcase.md (#1031) --- docs/showcase.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/showcase.md b/docs/showcase.md index 0509e93ab..4860e0be1 100644 --- a/docs/showcase.md +++ b/docs/showcase.md @@ -26,5 +26,6 @@ Want to see what Quartz can do? Here are some cool community gardens: - [Data Dictionary 🧠](https://glossary.airbyte.com/) - [sspaeti.com's Second Brain](https://brain.sspaeti.com/) - [🪴Aster's notebook](https://notes.asterhu.com) +- [🥷🏻🌳🍃 Computer Science & Thinkering Garden](https://notes.yxy.ninja) 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 6efc4dd724870c9e4fbc2e17651cc2a4f943c4a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kun-Szab=C3=B3=20Krist=C3=B3f?= Date: Sun, 24 Mar 2024 17:35:07 +0100 Subject: [PATCH 096/135] i18n: add Hungarian translations (#1023) * add Hungarian translations * typo: _ instead of - in hu-HU * run prettier * revert prettier messing up tsconfig * Update hu-HU.ts --- quartz/i18n/index.ts | 2 + quartz/i18n/locales/hu-HU.ts | 81 ++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 quartz/i18n/locales/hu-HU.ts diff --git a/quartz/i18n/index.ts b/quartz/i18n/index.ts index b97368d96..53650098f 100644 --- a/quartz/i18n/index.ts +++ b/quartz/i18n/index.ts @@ -13,6 +13,7 @@ import ru from "./locales/ru-RU" import ko from "./locales/ko-KR" import zh from "./locales/zh-CN" import vi from "./locales/vi-VN" +import hu from "./locales/hu-HU" export const TRANSLATIONS = { "en-US": en, @@ -50,6 +51,7 @@ export const TRANSLATIONS = { "ko-KR": ko, "zh-CN": zh, "vi-VN": vi, + "hu-HU": hu, } as const export const defaultTranslation = "en-US" diff --git a/quartz/i18n/locales/hu-HU.ts b/quartz/i18n/locales/hu-HU.ts new file mode 100644 index 000000000..6397309b7 --- /dev/null +++ b/quartz/i18n/locales/hu-HU.ts @@ -0,0 +1,81 @@ +import { Translation } from "./definition" + +export default { + propertyDefaults: { + title: "Névtelen", + description: "Nincs leírás", + }, + components: { + callout: { + note: "Jegyzet", + abstract: "Abstract", + info: "Információ", + todo: "Tennivaló", + tip: "Tipp", + success: "Siker", + question: "Kérdés", + warning: "Figyelmeztetés", + failure: "Hiba", + danger: "Veszély", + bug: "Bug", + example: "Példa", + quote: "Idézet", + }, + backlinks: { + title: "Visszautalások", + noBacklinksFound: "Nincs visszautalás", + }, + themeToggle: { + lightMode: "Világos mód", + darkMode: "Sötét mód", + }, + explorer: { + title: "Fájlböngésző", + }, + footer: { + createdWith: "Készítve ezzel:", + }, + graph: { + title: "Grafikonnézet", + }, + recentNotes: { + title: "Legutóbbi jegyzetek", + seeRemainingMore: ({ remaining }) => `${remaining} további megtekintése →`, + }, + transcludes: { + transcludeOf: ({ targetSlug }) => `${targetSlug} áthivatkozása`, + linkToOriginal: "Hivatkozás az eredetire", + }, + search: { + title: "Keresés", + searchBarPlaceholder: "Keress valamire", + }, + tableOfContents: { + title: "Tartalomjegyzék", + }, + contentMeta: { + readingTime: ({ minutes }) => `${minutes} perces olvasás`, + }, + }, + pages: { + rss: { + recentNotes: "Legutóbbi jegyzetek", + lastFewNotes: ({ count }) => `Legutóbbi ${count} jegyzet`, + }, + error: { + title: "Nem található", + notFound: "Ez a lap vagy privát vagy nem létezik.", + }, + folderContent: { + folder: "Mappa", + itemsUnderFolder: ({ count }) => `Ebben a mappában ${count} elem található.`, + }, + tagContent: { + tag: "Címke", + tagIndex: "Címke index", + itemsUnderTag: ({ count }) => `${count} elem található ezzel a címkével.`, + showingFirst: ({ count }) => `Első ${count} címke megjelenítve.`, + totalTags: ({ count }) => `Összesen ${count} címke található.`, + }, + }, +} as const satisfies Translation From 70d86ff096a5f7ebe2bd75791b5fac865598b80b Mon Sep 17 00:00:00 2001 From: Jorge Marcelo Risco <61189874+jorgemrisco@users.noreply.github.com> Date: Sun, 24 Mar 2024 13:40:01 -0300 Subject: [PATCH 097/135] i18n: pt-BR translation (#1024) * i18n: pt-br * i18n: pt-br translation --------- Co-authored-by: Jacky Zhao --- quartz/i18n/index.ts | 2 + quartz/i18n/locales/pt-BR.ts | 83 ++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 quartz/i18n/locales/pt-BR.ts diff --git a/quartz/i18n/index.ts b/quartz/i18n/index.ts index 53650098f..6707ea35d 100644 --- a/quartz/i18n/index.ts +++ b/quartz/i18n/index.ts @@ -13,6 +13,7 @@ import ru from "./locales/ru-RU" import ko from "./locales/ko-KR" import zh from "./locales/zh-CN" import vi from "./locales/vi-VN" +import pt from "./locales/pt-BR" import hu from "./locales/hu-HU" export const TRANSLATIONS = { @@ -51,6 +52,7 @@ export const TRANSLATIONS = { "ko-KR": ko, "zh-CN": zh, "vi-VN": vi, + "pt-BR": pt, "hu-HU": hu, } as const diff --git a/quartz/i18n/locales/pt-BR.ts b/quartz/i18n/locales/pt-BR.ts new file mode 100644 index 000000000..b59c7b47b --- /dev/null +++ b/quartz/i18n/locales/pt-BR.ts @@ -0,0 +1,83 @@ +import { Translation } from "./definition" + +export default { + propertyDefaults: { + title: "Sem título", + description: "Sem descrição", + }, + components: { + callout: { + note: "Nota", + abstract: "Abstrato", + info: "Info", + todo: "Pendência", + tip: "Dica", + success: "Sucesso", + question: "Pergunta", + warning: "Aviso", + failure: "Falha", + danger: "Perigo", + bug: "Bug", + example: "Exemplo", + quote: "Citação", + }, + backlinks: { + title: "Backlinks", + noBacklinksFound: "Sem backlinks encontrados", + }, + themeToggle: { + lightMode: "Tema claro", + darkMode: "Tema escuro", + }, + explorer: { + title: "Explorador", + }, + footer: { + createdWith: "Criado com", + }, + graph: { + title: "Visão de gráfico", + }, + recentNotes: { + title: "Notas recentes", + seeRemainingMore: ({ remaining }) => `Veja mais ${remaining} →`, + }, + transcludes: { + transcludeOf: ({ targetSlug }) => `Transcrever de ${targetSlug}`, + linkToOriginal: "Link ao original", + }, + search: { + title: "Pesquisar", + searchBarPlaceholder: "Pesquisar por algo", + }, + tableOfContents: { + title: "Sumário", + }, + contentMeta: { + readingTime: ({ minutes }) => `Leitura de ${minutes} min`, + }, + }, + pages: { + rss: { + recentNotes: "Notas recentes", + lastFewNotes: ({ count }) => `Últimas ${count} notas`, + }, + error: { + title: "Não encontrado", + notFound: "Esta página é privada ou não existe.", + }, + folderContent: { + folder: "Arquivo", + itemsUnderFolder: ({ count }) => + count === 1 ? "1 item mneste arquivo." : `${count} items neste arquivo.`, + }, + tagContent: { + tag: "Tag", + tagIndex: "Sumário de Tags", + itemsUnderTag: ({ count }) => + count === 1 ? "1 item com esta tag." : `${count} items com esta tag.`, + showingFirst: ({ count }) => `Mostrando as ${count} primeiras tags.`, + totalTags: ({ count }) => `Encontradas ${count} tags.`, + }, + }, +} as const satisfies Translation From 8437d9da7242543c4903ecd7e4687cb2679af867 Mon Sep 17 00:00:00 2001 From: Emile Bangma Date: Sun, 24 Mar 2024 23:43:36 +0100 Subject: [PATCH 098/135] fix(style): LaTex/KaTeX overflow (#1027) * LaTex/KaTeX overflow fix * prettier * Add !important modifier * Added overflow-x override * Refactor without !important * Refactor scss notation * Formatting scss --- quartz/styles/base.scss | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/quartz/styles/base.scss b/quartz/styles/base.scss index 868dfdc79..1af96f6b0 100644 --- a/quartz/styles/base.scss +++ b/quartz/styles/base.scss @@ -513,3 +513,15 @@ ol.overflow { padding-left: 1rem; } } + +.katex-display { + overflow-x: auto; + overflow-y: visible; + + & > .katex .katex-html { + .base, + .strut { + display: inline; + } + } +} From 0a2b52f618c8a76a2f2a0e29223b5289c0225634 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Sun, 24 Mar 2024 15:50:38 -0700 Subject: [PATCH 099/135] simpler katex fix --- docs/features/Latex.md | 11 +++++++++++ quartz/styles/base.scss | 9 +-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/docs/features/Latex.md b/docs/features/Latex.md index b2bdb2dfb..fdc9d277b 100644 --- a/docs/features/Latex.md +++ b/docs/features/Latex.md @@ -39,6 +39,17 @@ a & b & c \end{bmatrix} $$ +$$ +\begin{array}{rll} +E \psi &= H\psi & \text{Expanding the Hamiltonian Operator} \\ +&= -\frac{\hbar^2}{2m}\frac{\partial^2}{\partial x^2} \psi + \frac{1}{2}m\omega x^2 \psi & \text{Using the ansatz $\psi(x) = e^{-kx^2}f(x)$, hoping to cancel the $x^2$ term} \\ +&= -\frac{\hbar^2}{2m} [4k^2x^2f(x)+2(-2kx)f'(x) + f''(x)]e^{-kx^2} + \frac{1}{2}m\omega x^2 f(x)e^{-kx^2} &\text{Removing the $e^{-kx^2}$ term from both sides} \\ +& \Downarrow \\ +Ef(x) &= -\frac{\hbar^2}{2m} [4k^2x^2f(x)-4kxf'(x) + f''(x)] + \frac{1}{2}m\omega x^2 f(x) & \text{Choosing $k=\frac{im}{2}\sqrt{\frac{\omega}{\hbar}}$ to cancel the $x^2$ term, via $-\frac{\hbar^2}{2m}4k^2=\frac{1}{2}m \omega$} \\ +&= -\frac{\hbar^2}{2m} [-4kxf'(x) + f''(x)] \\ +\end{array} +$$ + > [!warn] > Due to limitations in the [underlying parsing library](https://github.com/remarkjs/remark-math), block math in Quartz requires the `$$` delimiters to be on newlines like above. diff --git a/quartz/styles/base.scss b/quartz/styles/base.scss index 1af96f6b0..859bb433e 100644 --- a/quartz/styles/base.scss +++ b/quartz/styles/base.scss @@ -516,12 +516,5 @@ ol.overflow { .katex-display { overflow-x: auto; - overflow-y: visible; - - & > .katex .katex-html { - .base, - .strut { - display: inline; - } - } + overflow-y: hidden; } From d75928ad5cb99c87de40c1c884ddca6bf86163d5 Mon Sep 17 00:00:00 2001 From: Emile Bangma Date: Mon, 25 Mar 2024 00:23:25 +0100 Subject: [PATCH 100/135] fix(assets): pdf page linking support. (#1025) * github-slugger pdf workaround * Skip sluggifying on pdf file extension * Account for pdf files without anchor * Address feedback --- quartz/util/path.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/quartz/util/path.ts b/quartz/util/path.ts index dceb89bfa..c02bfb12d 100644 --- a/quartz/util/path.ts +++ b/quartz/util/path.ts @@ -168,6 +168,9 @@ export function resolveRelative(current: FullSlug, target: FullSlug | SimpleSlug export function splitAnchor(link: string): [string, string] { let [fp, anchor] = link.split("#", 2) + if (fp.endsWith(".pdf")) { + return [fp, anchor === undefined ? "" : `#${anchor}`] + } anchor = anchor === undefined ? "" : "#" + slugAnchor(anchor) return [fp, anchor] } From 8f13a38b5add5c89d7e02248fb5c986824e361dd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Mar 2024 04:46:52 -0400 Subject: [PATCH 101/135] chore(deps-dev): bump typescript from 5.4.2 to 5.4.3 (#1036) Bumps [typescript](https://github.com/Microsoft/TypeScript) from 5.4.2 to 5.4.3. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml) - [Commits](https://github.com/Microsoft/TypeScript/compare/v5.4.2...v5.4.3) --- updated-dependencies: - dependency-name: typescript 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 8ef3e9f0a..672df71d9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -82,7 +82,7 @@ "esbuild": "^0.19.9", "prettier": "^3.2.4", "tsx": "^4.7.1", - "typescript": "^5.4.2" + "typescript": "^5.4.3" }, "engines": { "node": ">=18.14", @@ -5922,9 +5922,9 @@ } }, "node_modules/typescript": { - "version": "5.4.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.2.tgz", - "integrity": "sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==", + "version": "5.4.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.3.tgz", + "integrity": "sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg==", "dev": true, "bin": { "tsc": "bin/tsc", diff --git a/package.json b/package.json index f785b4b33..b46cbbf86 100644 --- a/package.json +++ b/package.json @@ -104,6 +104,6 @@ "esbuild": "^0.19.9", "prettier": "^3.2.4", "tsx": "^4.7.1", - "typescript": "^5.4.2" + "typescript": "^5.4.3" } } From fafe50b0c5726a5ef8db25d515c7d84808b86bde Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Mar 2024 04:47:15 -0400 Subject: [PATCH 102/135] chore(deps): bump preact from 10.19.6 to 10.20.1 (#1035) Bumps [preact](https://github.com/preactjs/preact) from 10.19.6 to 10.20.1. - [Release notes](https://github.com/preactjs/preact/releases) - [Commits](https://github.com/preactjs/preact/compare/10.19.6...10.20.1) --- updated-dependencies: - dependency-name: preact 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 672df71d9..b787090fb 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.6", + "preact": "^10.20.1", "preact-render-to-string": "^6.4.0", "pretty-bytes": "^6.1.1", "pretty-time": "^1.1.0", @@ -4696,9 +4696,9 @@ } }, "node_modules/preact": { - "version": "10.19.6", - "resolved": "https://registry.npmjs.org/preact/-/preact-10.19.6.tgz", - "integrity": "sha512-gympg+T2Z1fG1unB8NH29yHJwnEaCH37Z32diPDku316OTnRPeMbiRV9kTrfZpocXjdfnWuFUl/Mj4BHaf6gnw==", + "version": "10.20.1", + "resolved": "https://registry.npmjs.org/preact/-/preact-10.20.1.tgz", + "integrity": "sha512-JIFjgFg9B2qnOoGiYMVBtrcFxHqn+dNXbq76bVmcaHYJFYR4lW67AOcXgAYQQTDYXDOg/kTZrKPNCdRgJ2UJmw==", "funding": { "type": "opencollective", "url": "https://opencollective.com/preact" diff --git a/package.json b/package.json index b46cbbf86..adf60be2d 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.6", + "preact": "^10.20.1", "preact-render-to-string": "^6.4.0", "pretty-bytes": "^6.1.1", "pretty-time": "^1.1.0", From aa4f5294a3b0a8fa7e10d128c8f0258ad024ae73 Mon Sep 17 00:00:00 2001 From: Hydrophobefireman Date: Sun, 31 Mar 2024 12:44:20 -0400 Subject: [PATCH 103/135] fix: do not render

    inside FolderContent article (#1044) it can lead to nested

    's which is actually [invalid html](https://www.w3.org/TR/html401/struct/text.html#h-9.3.1:~:text=The%20P%20element%20represents%20a%20paragraph.%20It%20cannot%20contain%20block%2Dlevel%20elements%20(including%20P%20itself).) --- quartz/components/pages/FolderContent.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/quartz/components/pages/FolderContent.tsx b/quartz/components/pages/FolderContent.tsx index 55f1e427d..a13f135f8 100644 --- a/quartz/components/pages/FolderContent.tsx +++ b/quartz/components/pages/FolderContent.tsx @@ -47,9 +47,7 @@ export default ((opts?: Partial) => { return (

    -
    -

    {content}

    -
    +
    {content}
    {options.showFolderCount && (

    From 5ec61468d5e787b3c8ae32a2b4ef1595cf0bc3ee Mon Sep 17 00:00:00 2001 From: Emile Bangma Date: Sun, 31 Mar 2024 18:44:50 +0200 Subject: [PATCH 104/135] fix(wikilinks): proper escaping of pipe character in wikilinks inside tables (#1040) --- quartz/plugins/transformers/ofm.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/quartz/plugins/transformers/ofm.ts b/quartz/plugins/transformers/ofm.ts index 3ee6480ca..108f7f779 100644 --- a/quartz/plugins/transformers/ofm.ts +++ b/quartz/plugins/transformers/ofm.ts @@ -188,7 +188,8 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin const [raw]: (string | undefined)[] = capture let escaped = raw ?? "" escaped = escaped.replace("#", "\\#") - escaped = escaped.replace("|", "\\|") + // escape pipe characters if they are not already escaped + escaped = escaped.replace(/((^|[^\\])(\\\\)*)\|/g, "$1\\|") return escaped }) From 561dafce5f3e662d0c9c07fe7a526ed69dd386e0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Apr 2024 23:32:36 -0400 Subject: [PATCH 105/135] chore(deps): bump shiki from 1.2.0 to 1.2.3 (#1048) Bumps [shiki](https://github.com/shikijs/shiki/tree/HEAD/packages/shiki) from 1.2.0 to 1.2.3. - [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.2.3/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 b787090fb..156f2943d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -55,7 +55,7 @@ "rfdc": "^1.3.1", "rimraf": "^5.0.5", "serve-handler": "^6.1.5", - "shiki": "^1.2.0", + "shiki": "^1.2.3", "source-map-support": "^0.5.21", "to-vfile": "^8.0.0", "toml": "^3.0.0", @@ -820,9 +820,9 @@ } }, "node_modules/@shikijs/core": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.2.0.tgz", - "integrity": "sha512-OlFvx+nyr5C8zpcMBnSGir0YPD6K11uYhouqhNmm1qLiis4GA7SsGtu07r9gKS9omks8RtQqHrJL4S+lqWK01A==" + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.2.3.tgz", + "integrity": "sha512-SM+aiQVaEK2P53dEcsvhq9+LJPr0rzwezHbMQhHaSrPN4OlOB4vp1qTdhVEKfMg6atdq8s9ZotWW/CSCzWftwg==" }, "node_modules/@sindresorhus/merge-streams": { "version": "2.3.0", @@ -5571,11 +5571,11 @@ } }, "node_modules/shiki": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.2.0.tgz", - "integrity": "sha512-xLhiTMOIUXCv5DqJ4I70GgQCtdlzsTqFLZWcMHHG3TAieBUbvEGthdrlPDlX4mL/Wszx9C6rEcxU6kMlg4YlxA==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.2.3.tgz", + "integrity": "sha512-+v7lO5cJMeV2N2ySK4l+51YX3wTh5I49SLjAOs1ch1DbUfeEytU1Ac9KaZPoZJCVBGycDZ09OBQN5nbcPFc5FQ==", "dependencies": { - "@shikijs/core": "1.2.0" + "@shikijs/core": "1.2.3" } }, "node_modules/signal-exit": { diff --git a/package.json b/package.json index adf60be2d..84fc500ad 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "rfdc": "^1.3.1", "rimraf": "^5.0.5", "serve-handler": "^6.1.5", - "shiki": "^1.2.0", + "shiki": "^1.2.3", "source-map-support": "^0.5.21", "to-vfile": "^8.0.0", "toml": "^3.0.0", From dd82ab8d796c37249098a5b4dd11d55ad2dd88d8 Mon Sep 17 00:00:00 2001 From: Race Williams Date: Wed, 3 Apr 2024 16:30:41 -0400 Subject: [PATCH 106/135] fix: broken doc links on /plugins/* (#1053) * Update Assets.md * expand fix for every /plugins page --- docs/plugins/AliasRedirects.md | 2 +- docs/plugins/Assets.md | 2 +- docs/plugins/CNAME.md | 2 +- docs/plugins/ComponentResources.md | 2 +- docs/plugins/ContentIndex.md | 2 +- docs/plugins/ContentPage.md | 2 +- docs/plugins/CrawlLinks.md | 2 +- docs/plugins/CreatedModifiedDate.md | 2 +- docs/plugins/Description.md | 2 +- docs/plugins/ExplicitPublish.md | 2 +- docs/plugins/FolderPage.md | 2 +- docs/plugins/Frontmatter.md | 2 +- docs/plugins/GitHubFlavoredMarkdown.md | 2 +- docs/plugins/HardLineBreaks.md | 2 +- docs/plugins/Latex.md | 2 +- docs/plugins/NotFoundPage.md | 2 +- docs/plugins/ObsidianFlavoredMarkdown.md | 2 +- docs/plugins/OxHugoFlavoredMarkdown.md | 2 +- docs/plugins/RemoveDrafts.md | 2 +- docs/plugins/Static.md | 2 +- docs/plugins/SyntaxHighlighting.md | 2 +- docs/plugins/TableOfContents.md | 2 +- docs/plugins/TagPage.md | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/docs/plugins/AliasRedirects.md b/docs/plugins/AliasRedirects.md index 3a33ce649..8c0365377 100644 --- a/docs/plugins/AliasRedirects.md +++ b/docs/plugins/AliasRedirects.md @@ -26,7 +26,7 @@ The emitter supports the following aliases: - `alias` > [!note] -> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. +> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page. This plugin has no configuration options. diff --git a/docs/plugins/Assets.md b/docs/plugins/Assets.md index eb03994e1..47589b2c3 100644 --- a/docs/plugins/Assets.md +++ b/docs/plugins/Assets.md @@ -9,7 +9,7 @@ This plugin emits all non-Markdown static assets in your content folder (like im Note that all static assets will then be accessible through its path on your generated site, i.e: `host.me/path/to/static.pdf` > [!note] -> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. +> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page. This plugin has no configuration options. diff --git a/docs/plugins/CNAME.md b/docs/plugins/CNAME.md index 1cc0b5ccf..b81faee47 100644 --- a/docs/plugins/CNAME.md +++ b/docs/plugins/CNAME.md @@ -11,7 +11,7 @@ If you want to use a custom domain name like `quartz.example.com` for the site, See [[Hosting]] for more information. > [!note] -> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. +> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page. This plugin has no configuration options. diff --git a/docs/plugins/ComponentResources.md b/docs/plugins/ComponentResources.md index 739c17070..6e8c82ef8 100644 --- a/docs/plugins/ComponentResources.md +++ b/docs/plugins/ComponentResources.md @@ -7,7 +7,7 @@ tags: This plugin manages and emits the static resources required for the Quartz framework. This includes CSS stylesheets and JavaScript scripts that enhance the functionality and aesthetics of the generated site. See also the `cdnCaching` option in the `theme` section of the [[configuration]]. > [!note] -> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. +> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page. This plugin has no configuration options. diff --git a/docs/plugins/ContentIndex.md b/docs/plugins/ContentIndex.md index af235b057..eb7265d47 100644 --- a/docs/plugins/ContentIndex.md +++ b/docs/plugins/ContentIndex.md @@ -9,7 +9,7 @@ This plugin emits both RSS and an XML sitemap for your site. The [[RSS Feed]] al This plugin emits a comprehensive index of the site's content, generating additional resources such as a sitemap, an RSS feed, and a > [!note] -> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. +> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page. This plugin accepts the following configuration options: diff --git a/docs/plugins/ContentPage.md b/docs/plugins/ContentPage.md index 5d9016f3c..bd33e4ee1 100644 --- a/docs/plugins/ContentPage.md +++ b/docs/plugins/ContentPage.md @@ -7,7 +7,7 @@ tags: This plugin is a core component of the Quartz framework. It generates the HTML pages for each piece of Markdown content. It emits the full-page [[layout]], including headers, footers, and body content, among others. > [!note] -> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. +> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page. This plugin has no configuration options. diff --git a/docs/plugins/CrawlLinks.md b/docs/plugins/CrawlLinks.md index 15a0d6607..47b7bdd77 100644 --- a/docs/plugins/CrawlLinks.md +++ b/docs/plugins/CrawlLinks.md @@ -7,7 +7,7 @@ tags: This plugin parses links and processes them to point to the right places. It is also needed for embedded links (like images). See [[Obsidian compatibility]] for more information. > [!note] -> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. +> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page. This plugin accepts the following configuration options: diff --git a/docs/plugins/CreatedModifiedDate.md b/docs/plugins/CreatedModifiedDate.md index 6a0f1371a..5d772aaa0 100644 --- a/docs/plugins/CreatedModifiedDate.md +++ b/docs/plugins/CreatedModifiedDate.md @@ -7,7 +7,7 @@ tags: This plugin determines the created, modified, and published dates for a document using three potential data sources: frontmatter metadata, Git history, and the filesystem. See [[authoring content#Syntax]] for more information. > [!note] -> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. +> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page. This plugin accepts the following configuration options: diff --git a/docs/plugins/Description.md b/docs/plugins/Description.md index 526bb0175..af1c8b7c2 100644 --- a/docs/plugins/Description.md +++ b/docs/plugins/Description.md @@ -9,7 +9,7 @@ This plugin generates descriptions that are used as metadata for the HTML `head` If the frontmatter contains a `description` property, it is used (see [[authoring content#Syntax]]). Otherwise, the plugin will do its best to use the first few sentences of the content to reach the target description length. > [!note] -> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. +> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page. This plugin accepts the following configuration options: diff --git a/docs/plugins/ExplicitPublish.md b/docs/plugins/ExplicitPublish.md index 7c7aceb65..2fd929b92 100644 --- a/docs/plugins/ExplicitPublish.md +++ b/docs/plugins/ExplicitPublish.md @@ -7,7 +7,7 @@ tags: This plugin filters content based on an explicit `publish` flag in the frontmatter, allowing only content that is explicitly marked for publication to pass through. It's the opt-in version of [[RemoveDrafts]]. See [[private pages]] for more information. > [!note] -> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. +> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page. This plugin has no configuration options. diff --git a/docs/plugins/FolderPage.md b/docs/plugins/FolderPage.md index 92a700ae9..ead8e75ff 100644 --- a/docs/plugins/FolderPage.md +++ b/docs/plugins/FolderPage.md @@ -9,7 +9,7 @@ This plugin generates index pages for folders, creating a listing page for each Example: [[advanced/|Advanced]] > [!note] -> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. +> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page. This plugin has no configuration options. diff --git a/docs/plugins/Frontmatter.md b/docs/plugins/Frontmatter.md index 960417a80..879d087db 100644 --- a/docs/plugins/Frontmatter.md +++ b/docs/plugins/Frontmatter.md @@ -7,7 +7,7 @@ tags: This plugin parses the frontmatter of the page using the [gray-matter](https://github.com/jonschlinkert/gray-matter) library. See [[authoring content#Syntax]], [[Obsidian compatibility]] and [[OxHugo compatibility]] for more information. > [!note] -> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. +> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page. This plugin accepts the following configuration options: diff --git a/docs/plugins/GitHubFlavoredMarkdown.md b/docs/plugins/GitHubFlavoredMarkdown.md index 2ea8f8d38..41fab6b23 100644 --- a/docs/plugins/GitHubFlavoredMarkdown.md +++ b/docs/plugins/GitHubFlavoredMarkdown.md @@ -9,7 +9,7 @@ This plugin enhances Markdown processing to support GitHub Flavored Markdown (GF In addition, this plugin adds optional features for typographic refinement (such as converting straight quotes to curly quotes, dashes to en-dashes/em-dashes, and ellipses) and automatic heading links as a symbol that appears next to the heading on hover. > [!note] -> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. +> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page. This plugin accepts the following configuration options: diff --git a/docs/plugins/HardLineBreaks.md b/docs/plugins/HardLineBreaks.md index d35d74cf9..e24f7e129 100644 --- a/docs/plugins/HardLineBreaks.md +++ b/docs/plugins/HardLineBreaks.md @@ -7,7 +7,7 @@ tags: This plugin automatically converts single line breaks in Markdown text into hard line breaks in the HTML output. This plugin is not enabled by default as this doesn't follow the semantics of actual Markdown but you may enable it if you'd like parity with [[Obsidian compatibility|Obsidian]]. > [!note] -> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. +> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page. This plugin has no configuration options. diff --git a/docs/plugins/Latex.md b/docs/plugins/Latex.md index 8a8999e86..ac4367841 100644 --- a/docs/plugins/Latex.md +++ b/docs/plugins/Latex.md @@ -7,7 +7,7 @@ tags: This plugin adds LaTeX support to Quartz. See [[features/Latex|Latex]] for more information. > [!note] -> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. +> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page. This plugin accepts the following configuration options: diff --git a/docs/plugins/NotFoundPage.md b/docs/plugins/NotFoundPage.md index 082f86425..b67994329 100644 --- a/docs/plugins/NotFoundPage.md +++ b/docs/plugins/NotFoundPage.md @@ -7,7 +7,7 @@ tags: This plugin emits a 404 (Not Found) page for broken or non-existent URLs. > [!note] -> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. +> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page. This plugin has no configuration options. diff --git a/docs/plugins/ObsidianFlavoredMarkdown.md b/docs/plugins/ObsidianFlavoredMarkdown.md index c4240865f..30d1f7179 100644 --- a/docs/plugins/ObsidianFlavoredMarkdown.md +++ b/docs/plugins/ObsidianFlavoredMarkdown.md @@ -7,7 +7,7 @@ tags: This plugin provides support for [[Obsidian compatibility]]. > [!note] -> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. +> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page. This plugin accepts the following configuration options: diff --git a/docs/plugins/OxHugoFlavoredMarkdown.md b/docs/plugins/OxHugoFlavoredMarkdown.md index 523a21589..5c2afeea6 100644 --- a/docs/plugins/OxHugoFlavoredMarkdown.md +++ b/docs/plugins/OxHugoFlavoredMarkdown.md @@ -7,7 +7,7 @@ tags: This plugin provides support for [ox-hugo](https://github.com/kaushalmodi/ox-hugo) compatibility. See [[OxHugo compatibility]] for more information. > [!note] -> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. +> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page. This plugin accepts the following configuration options: diff --git a/docs/plugins/RemoveDrafts.md b/docs/plugins/RemoveDrafts.md index 729ac86a7..07fb4d0e4 100644 --- a/docs/plugins/RemoveDrafts.md +++ b/docs/plugins/RemoveDrafts.md @@ -7,7 +7,7 @@ tags: This plugin filters out content from your vault, so that only finalized content is made available. This prevents [[private pages]] from being published. By default, it filters out all pages with `draft: true` in the frontmatter and leaves all other pages intact. > [!note] -> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. +> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page. This plugin has no configuration options. diff --git a/docs/plugins/Static.md b/docs/plugins/Static.md index c660eabf4..80bf5a158 100644 --- a/docs/plugins/Static.md +++ b/docs/plugins/Static.md @@ -10,7 +10,7 @@ This plugin emits all static resources needed by Quartz. This is used, for examp > This is different from [[Assets]]. The resources from the [[Static]] plugin are located under `quartz/static`, whereas [[Assets]] renders all static resources under `content` and is used for images, videos, audio, etc. that are directly referenced by your markdown content. > [!note] -> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. +> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page. This plugin has no configuration options. diff --git a/docs/plugins/SyntaxHighlighting.md b/docs/plugins/SyntaxHighlighting.md index 8bf581eb4..6fb67dba0 100644 --- a/docs/plugins/SyntaxHighlighting.md +++ b/docs/plugins/SyntaxHighlighting.md @@ -7,7 +7,7 @@ tags: This plugin is used to add syntax highlighting to code blocks in Quartz. See [[syntax highlighting]] for more information. > [!note] -> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. +> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page. This plugin accepts the following configuration options: diff --git a/docs/plugins/TableOfContents.md b/docs/plugins/TableOfContents.md index d443d0eaa..0e9e4ea73 100644 --- a/docs/plugins/TableOfContents.md +++ b/docs/plugins/TableOfContents.md @@ -7,7 +7,7 @@ tags: This plugin generates a table of contents (TOC) for Markdown documents. See [[table of contents]] for more information. > [!note] -> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. +> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page. This plugin accepts the following configuration options: diff --git a/docs/plugins/TagPage.md b/docs/plugins/TagPage.md index cd7dee609..9c704b380 100644 --- a/docs/plugins/TagPage.md +++ b/docs/plugins/TagPage.md @@ -7,7 +7,7 @@ tags: This plugin emits dedicated pages for each tag used in the content. See [[folder and tag listings]] for more information. > [!note] -> For information on how to add, remove or configure plugins, see the [[Configuration#Plugins|Configuration]] page. +> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page. This plugin has no configuration options. From 83bdcd58e6a88f234d399c0022742b1ee355d434 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 5 Apr 2024 16:02:00 -0400 Subject: [PATCH 107/135] chore(deps): bump d3 from 7.8.5 to 7.9.0 (#1047) Bumps [d3](https://github.com/d3/d3) from 7.8.5 to 7.9.0. - [Release notes](https://github.com/d3/d3/releases) - [Changelog](https://github.com/d3/d3/blob/main/CHANGES.md) - [Commits](https://github.com/d3/d3/compare/v7.8.5...v7.9.0) --- updated-dependencies: - dependency-name: d3 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 156f2943d..4b86ffbde 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "chalk": "^5.3.0", "chokidar": "^3.6.0", "cli-spinner": "^0.2.10", - "d3": "^7.8.5", + "d3": "^7.9.0", "esbuild-sass-plugin": "^2.16.1", "flexsearch": "0.7.43", "github-slugger": "^2.0.0", @@ -1666,9 +1666,9 @@ } }, "node_modules/d3": { - "version": "7.8.5", - "resolved": "https://registry.npmjs.org/d3/-/d3-7.8.5.tgz", - "integrity": "sha512-JgoahDG51ncUfJu6wX/1vWQEqOflgXyl4MaHqlcSruTez7yhaRKR9i8VjjcQGeS2en/jnFivXuaIMnseMMt0XA==", + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/d3/-/d3-7.9.0.tgz", + "integrity": "sha512-e1U46jVP+w7Iut8Jt8ri1YsPOvFpg46k+K8TpCb0P+zjCkjkPnV7WzfDJzMHy1LnA+wj5pLT1wjO901gLXeEhA==", "dependencies": { "d3-array": "3", "d3-axis": "3", diff --git a/package.json b/package.json index 84fc500ad..a2785b9b7 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "chalk": "^5.3.0", "chokidar": "^3.6.0", "cli-spinner": "^0.2.10", - "d3": "^7.8.5", + "d3": "^7.9.0", "esbuild-sass-plugin": "^2.16.1", "flexsearch": "0.7.43", "github-slugger": "^2.0.0", From 1f032f538b4ce9f477b92be2da68d50606802c6d Mon Sep 17 00:00:00 2001 From: kwyuan <72662648+joeyscave@users.noreply.github.com> Date: Tue, 9 Apr 2024 09:43:09 +0800 Subject: [PATCH 108/135] feat(analytics): PostHog support (#1072) --- docs/configuration.md | 1 + quartz/cfg.ts | 5 +++++ quartz/plugins/emitters/componentResources.ts | 7 +++++++ 3 files changed, 13 insertions(+) diff --git a/docs/configuration.md b/docs/configuration.md index 64968fbb4..1408f71e6 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -29,6 +29,7 @@ This part of the configuration concerns anything that can affect the whole site. - `{ 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) + - `{ provider: 'posthog', apiKey: '', host: '' }`: use [Posthog](https://posthog.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 2e32b1f80..09905e9f0 100644 --- a/quartz/cfg.ts +++ b/quartz/cfg.ts @@ -25,6 +25,11 @@ export type Analytics = host?: string scriptSrc?: string } + | { + provider: "posthog" + apiKey: string + host?: string + } export interface GlobalConfiguration { pageTitle: string diff --git a/quartz/plugins/emitters/componentResources.ts b/quartz/plugins/emitters/componentResources.ts index 0bccb6075..81d3af2e8 100644 --- a/quartz/plugins/emitters/componentResources.ts +++ b/quartz/plugins/emitters/componentResources.ts @@ -129,6 +129,13 @@ function addGlobalPageResources(ctx: BuildCtx, componentResources: ComponentReso "https://${cfg.analytics.websiteId}.${cfg.analytics.host ?? "goatcounter.com"}/count") document.head.appendChild(goatcounterScript) `) + } else if (cfg.analytics?.provider === "posthog") { + componentResources.afterDOMLoaded.push(` + const posthogScript = document.createElement("script") + posthogScript.innerHTML= \`!function(t,e){var o,n,p,r;e.__SV||(window.posthog=e,e._i=[],e.init=function(i,s,a){function g(t,e){var o=e.split(".");2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}(p=t.createElement("script")).type="text/javascript",p.async=!0,p.src=s.api_host+"/static/array.js",(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);var u=e;for(void 0!==a?u=e[a]=[]:a="posthog",u.people=u.people||[],u.toString=function(t){var e="posthog";return"posthog"!==a&&(e+="."+a),t||(e+=" (stub)"),e},u.people.toString=function(){return u.toString(1)+".people (stub)"},o="capture identify alias people.set people.set_once set_config register register_once unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled onFeatureFlags getFeatureFlag getFeatureFlagPayload reloadFeatureFlags group updateEarlyAccessFeatureEnrollment getEarlyAccessFeatures getActiveMatchingSurveys getSurveys onSessionId".split(" "),n=0;n Date: Fri, 12 Apr 2024 02:30:21 -0400 Subject: [PATCH 109/135] chore(deps-dev): bump @types/node from 20.11.29 to 20.12.5 (#1074) Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.29 to 20.12.5. - [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-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 4b86ffbde..3ad288626 100644 --- a/package-lock.json +++ b/package-lock.json @@ -74,7 +74,7 @@ "@types/d3": "^7.4.3", "@types/hast": "^3.0.4", "@types/js-yaml": "^4.0.9", - "@types/node": "^20.11.29", + "@types/node": "^20.12.5", "@types/pretty-time": "^1.1.5", "@types/source-map-support": "^0.5.10", "@types/ws": "^8.5.10", @@ -1170,9 +1170,9 @@ } }, "node_modules/@types/node": { - "version": "20.11.29", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.29.tgz", - "integrity": "sha512-P99thMkD/1YkCvAtOd6/zGedKNA0p2fj4ZpjCzcNiSCBWgm3cNRTBfa/qjFnsKkkojxu4vVLtWpesnZ9+ap+gA==", + "version": "20.12.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.5.tgz", + "integrity": "sha512-BD+BjQ9LS/D8ST9p5uqBxghlN+S42iuNxjsUGjeZobe/ciXzk2qb1B6IXc6AnRLS+yFJRpN2IPEHMzwspfDJNw==", "dev": true, "dependencies": { "undici-types": "~5.26.4" diff --git a/package.json b/package.json index a2785b9b7..e047e1b9c 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "@types/d3": "^7.4.3", "@types/hast": "^3.0.4", "@types/js-yaml": "^4.0.9", - "@types/node": "^20.11.29", + "@types/node": "^20.12.5", "@types/pretty-time": "^1.1.5", "@types/source-map-support": "^0.5.10", "@types/ws": "^8.5.10", From 4d73b8289d16fde3271e748b84fd7f90a56a8899 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 12 Apr 2024 02:33:05 -0400 Subject: [PATCH 110/135] chore(deps): bump workerpool from 9.1.0 to 9.1.1 (#1073) Bumps [workerpool](https://github.com/josdejong/workerpool) from 9.1.0 to 9.1.1. - [Changelog](https://github.com/josdejong/workerpool/blob/master/HISTORY.md) - [Commits](https://github.com/josdejong/workerpool/compare/v9.1.0...v9.1.1) --- updated-dependencies: - dependency-name: workerpool 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 3ad288626..7f424abec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -62,7 +62,7 @@ "unified": "^11.0.4", "unist-util-visit": "^5.0.0", "vfile": "^6.0.1", - "workerpool": "^9.1.0", + "workerpool": "^9.1.1", "ws": "^8.15.1", "yargs": "^17.7.2" }, @@ -6325,9 +6325,9 @@ "integrity": "sha512-Gd9+TUn5nXdwj/hFsPVx5cuHHiF5Bwuc30jZ4+ronF1qHK5O7HD0sgmXWSEgwKquT3ClLoKPVbO6qGwVwLzvAw==" }, "node_modules/workerpool": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-9.1.0.tgz", - "integrity": "sha512-+wRWfm9yyJghvXLSHMQj3WXDxHbibHAQmRrWbqKBfy0RjftZNeQaW+Std5bSYc83ydkrxoPTPOWVlXUR9RWJdQ==" + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-9.1.1.tgz", + "integrity": "sha512-EFoFTSEo9m4V4wNrwzVRjxnf/E/oBpOzcI/R5CIugJhl9RsCiq525rszo4AtqcjQQoqFdu2E3H82AnbtpaQHvg==" }, "node_modules/wrap-ansi": { "version": "8.1.0", diff --git a/package.json b/package.json index e047e1b9c..855ca227a 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ "unified": "^11.0.4", "unist-util-visit": "^5.0.0", "vfile": "^6.0.1", - "workerpool": "^9.1.0", + "workerpool": "^9.1.1", "ws": "^8.15.1", "yargs": "^17.7.2" }, From 6a019dae13c8800c36c763f31f716f0aeff7972e Mon Sep 17 00:00:00 2001 From: Lucas-BRT <93885104+Lucas-BRT@users.noreply.github.com> Date: Tue, 16 Apr 2024 22:02:59 -0300 Subject: [PATCH 111/135] fix: unnecessery 'm' letter removed in pt-BR (#1100) --- quartz/i18n/locales/pt-BR.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quartz/i18n/locales/pt-BR.ts b/quartz/i18n/locales/pt-BR.ts index b59c7b47b..489d64220 100644 --- a/quartz/i18n/locales/pt-BR.ts +++ b/quartz/i18n/locales/pt-BR.ts @@ -69,7 +69,7 @@ export default { folderContent: { folder: "Arquivo", itemsUnderFolder: ({ count }) => - count === 1 ? "1 item mneste arquivo." : `${count} items neste arquivo.`, + count === 1 ? "1 item neste arquivo." : `${count} items neste arquivo.`, }, tagContent: { tag: "Tag", From e763e1969e9796d8f55110f32f645f4ff009968a Mon Sep 17 00:00:00 2001 From: iacore <74560659+iacore@users.noreply.github.com> Date: Fri, 19 Apr 2024 20:02:49 +0000 Subject: [PATCH 112/135] Allow pnpm quartz (#1078) Co-authored-by: iacore --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 855ca227a..de49b55c8 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "url": "https://github.com/jackyzha0/quartz.git" }, "scripts": { + "quartz": "./quartz/bootstrap-cli.mjs", "docs": "npx quartz build --serve -d docs", "check": "tsc --noEmit && npx prettier . --check", "format": "npx prettier . --write", From a37c7775e771afff1adf4ebcaf3e04570a683b78 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 27 Apr 2024 21:04:38 -0700 Subject: [PATCH 113/135] chore(deps): bump preact-render-to-string from 6.4.0 to 6.4.2 (#1094) Bumps [preact-render-to-string](https://github.com/preactjs/preact-render-to-string) from 6.4.0 to 6.4.2. - [Release notes](https://github.com/preactjs/preact-render-to-string/releases) - [Changelog](https://github.com/preactjs/preact-render-to-string/blob/main/CHANGELOG.md) - [Commits](https://github.com/preactjs/preact-render-to-string/compare/6.4.0...v6.4.2) --- updated-dependencies: - dependency-name: preact-render-to-string 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 7f424abec..b8c9e16c4 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.20.1", - "preact-render-to-string": "^6.4.0", + "preact-render-to-string": "^6.4.2", "pretty-bytes": "^6.1.1", "pretty-time": "^1.1.0", "reading-time": "^1.5.0", @@ -4705,9 +4705,9 @@ } }, "node_modules/preact-render-to-string": { - "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==", + "version": "6.4.2", + "resolved": "https://registry.npmjs.org/preact-render-to-string/-/preact-render-to-string-6.4.2.tgz", + "integrity": "sha512-Sio5SvlyZSAXHuvnMgYzVQd67lNIuQe4uSjJ+2gfpJNC6L8zoHQR5xV7B/EjIqrAYWVyJ2eACkTCxVrIzZi6Vw==", "dependencies": { "pretty-format": "^3.8.0" }, diff --git a/package.json b/package.json index de49b55c8..7cf279856 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "mdast-util-to-string": "^4.0.0", "micromorph": "^0.4.5", "preact": "^10.20.1", - "preact-render-to-string": "^6.4.0", + "preact-render-to-string": "^6.4.2", "pretty-bytes": "^6.1.1", "pretty-time": "^1.1.0", "reading-time": "^1.5.0", From aee9145691a0f372419fa840168858229adaaa37 Mon Sep 17 00:00:00 2001 From: Emmanuel Ferdman Date: Sun, 28 Apr 2024 07:07:26 +0300 Subject: [PATCH 114/135] fix: update link to hosting page (#1054) * fix: update link to hosting page * chore: update correct path with using alias --------- Co-authored-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> --- docs/plugins/CNAME.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/plugins/CNAME.md b/docs/plugins/CNAME.md index b81faee47..bc12b5acc 100644 --- a/docs/plugins/CNAME.md +++ b/docs/plugins/CNAME.md @@ -8,7 +8,7 @@ This plugin emits a `CNAME` record that points your subdomain to the default dom If you want to use a custom domain name like `quartz.example.com` for the site, then this is needed. -See [[Hosting]] for more information. +See [[hosting|Hosting]] for more information. > [!note] > For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page. From d03fdc235a7926eed5ad127ffb9c4a5f9c1008b7 Mon Sep 17 00:00:00 2001 From: John Bowdre <61015723+jbowdre@users.noreply.github.com> Date: Mon, 6 May 2024 11:30:21 -0500 Subject: [PATCH 115/135] feat(analytics): Tinylytics support (#1118) * add tinylytics support * fix formatting * add trailing semicolon for consistency --- docs/configuration.md | 3 ++- quartz/cfg.ts | 4 ++++ quartz/plugins/emitters/componentResources.ts | 8 ++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/configuration.md b/docs/configuration.md index 1408f71e6..6c4c92850 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -28,8 +28,9 @@ 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) + - `{ 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); - `{ provider: 'posthog', apiKey: '', host: '' }`: use [Posthog](https://posthog.com/); + - `{ provider: 'tinylytics', siteId: '' }`: use [Tinylytics](https://tinylytics.app/); - `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 09905e9f0..13fb51668 100644 --- a/quartz/cfg.ts +++ b/quartz/cfg.ts @@ -30,6 +30,10 @@ export type Analytics = apiKey: string host?: string } + | { + provider: "tinylytics" + siteId: string + } export interface GlobalConfiguration { pageTitle: string diff --git a/quartz/plugins/emitters/componentResources.ts b/quartz/plugins/emitters/componentResources.ts index 81d3af2e8..e6725d99d 100644 --- a/quartz/plugins/emitters/componentResources.ts +++ b/quartz/plugins/emitters/componentResources.ts @@ -136,6 +136,14 @@ function addGlobalPageResources(ctx: BuildCtx, componentResources: ComponentReso posthog.init('${cfg.analytics.apiKey}',{api_host:'${cfg.analytics.host ?? "https://app.posthog.com"}'})\` document.head.appendChild(posthogScript) `) + } else if (cfg.analytics?.provider === "tinylytics") { + const siteId = cfg.analytics.siteId + componentResources.afterDOMLoaded.push(` + const tinylyticsScript = document.createElement("script") + tinylyticsScript.src = "https://tinylytics.app/embed/${siteId}.js" + tinylyticsScript.defer = true + document.head.appendChild(tinylyticsScript) + `) } if (cfg.enableSPA) { From 438ea6d73b5449c6e6737f6f1f3a06a02e2659c3 Mon Sep 17 00:00:00 2001 From: zenodotus280 <16273022+zenodotus280@users.noreply.github.com> Date: Sun, 12 May 2024 19:04:21 -0700 Subject: [PATCH 116/135] docs(showcase): add patternlanguage.cc (#1135) A self-contained hypertextual catalog of architectural ideas and aesthetic inquiry. --- docs/showcase.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/showcase.md b/docs/showcase.md index 4860e0be1..c33f34c8e 100644 --- a/docs/showcase.md +++ b/docs/showcase.md @@ -27,5 +27,6 @@ Want to see what Quartz can do? Here are some cool community gardens: - [sspaeti.com's Second Brain](https://brain.sspaeti.com/) - [🪴Aster's notebook](https://notes.asterhu.com) - [🥷🏻🌳🍃 Computer Science & Thinkering Garden](https://notes.yxy.ninja) +- [A Pattern Language - Christopher Alexander (Architecture)](https://patternlanguage.cc/) 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 67f3614f3d58d8c27e9dbf6ad2201493b1a627ca Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 12 May 2024 19:05:27 -0700 Subject: [PATCH 117/135] chore(deps-dev): bump tsx from 4.7.1 to 4.9.3 (#1120) Bumps [tsx](https://github.com/privatenumber/tsx) from 4.7.1 to 4.9.3. - [Release notes](https://github.com/privatenumber/tsx/releases) - [Changelog](https://github.com/privatenumber/tsx/blob/master/release.config.cjs) - [Commits](https://github.com/privatenumber/tsx/compare/v4.7.1...v4.9.3) --- updated-dependencies: - dependency-name: tsx dependency-type: direct:development 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 | 424 +++++++++++++++++++++++++++++++++++++++++++++- package.json | 2 +- 2 files changed, 416 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index b8c9e16c4..9cf994a25 100644 --- a/package-lock.json +++ b/package-lock.json @@ -81,7 +81,7 @@ "@types/yargs": "^17.0.32", "esbuild": "^0.19.9", "prettier": "^3.2.4", - "tsx": "^4.7.1", + "tsx": "^4.9.3", "typescript": "^5.4.3" }, "engines": { @@ -2432,9 +2432,9 @@ } }, "node_modules/get-tsconfig": { - "version": "4.7.2", - "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.2.tgz", - "integrity": "sha512-wuMsz4leaj5hbGgg4IvDU0bqJagpftG5l5cXIAvo8uZrqn0NJqwtfupTN00VnkQJPcIRrxYrm1Ue24btpCha2A==", + "version": "4.7.4", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.4.tgz", + "integrity": "sha512-ofbkKj+0pjXjhejr007J/fLf+sW+8H7K5GCm+msC8q3IpvgjobpyPqSRFemNyIMxklC0zeJpi7VDFna19FacvQ==", "dev": true, "dependencies": { "resolve-pkg-maps": "^1.0.0" @@ -5903,13 +5903,13 @@ "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, "node_modules/tsx": { - "version": "4.7.1", - "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.7.1.tgz", - "integrity": "sha512-8d6VuibXHtlN5E3zFkgY8u4DX7Y3Z27zvvPKVmLon/D4AjuKzarkUBTLDBgj9iTQ0hg5xM7c/mYiRVM+HETf0g==", + "version": "4.9.3", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.9.3.tgz", + "integrity": "sha512-czVbetlILiyJZI5zGlj2kw9vFiSeyra9liPD4nG+Thh4pKTi0AmMEQ8zdV/L2xbIVKrIqif4sUNrsMAOksx9Zg==", "dev": true, "dependencies": { - "esbuild": "~0.19.10", - "get-tsconfig": "^4.7.2" + "esbuild": "~0.20.2", + "get-tsconfig": "^4.7.3" }, "bin": { "tsx": "dist/cli.mjs" @@ -5921,6 +5921,412 @@ "fsevents": "~2.3.3" } }, + "node_modules/tsx/node_modules/@esbuild/aix-ppc64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.20.2.tgz", + "integrity": "sha512-D+EBOJHXdNZcLJRBkhENNG8Wji2kgc9AZ9KiPr1JuZjsNtyHzrsfLRrY0tk2H2aoFu6RANO1y1iPPUCDYWkb5g==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-arm": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.20.2.tgz", + "integrity": "sha512-t98Ra6pw2VaDhqNWO2Oph2LXbz/EJcnLmKLGBJwEwXX/JAN83Fym1rU8l0JUWK6HkIbWONCSSatf4sf2NBRx/w==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-arm64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.20.2.tgz", + "integrity": "sha512-mRzjLacRtl/tWU0SvD8lUEwb61yP9cqQo6noDZP/O8VkwafSYwZ4yWy24kan8jE/IMERpYncRt2dw438LP3Xmg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-x64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.20.2.tgz", + "integrity": "sha512-btzExgV+/lMGDDa194CcUQm53ncxzeBrWJcncOBxuC6ndBkKxnHdFJn86mCIgTELsooUmwUm9FkhSp5HYu00Rg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/darwin-arm64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.20.2.tgz", + "integrity": "sha512-4J6IRT+10J3aJH3l1yzEg9y3wkTDgDk7TSDFX+wKFiWjqWp/iCfLIYzGyasx9l0SAFPT1HwSCR+0w/h1ES/MjA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/darwin-x64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.20.2.tgz", + "integrity": "sha512-tBcXp9KNphnNH0dfhv8KYkZhjc+H3XBkF5DKtswJblV7KlT9EI2+jeA8DgBjp908WEuYll6pF+UStUCfEpdysA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/freebsd-arm64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.20.2.tgz", + "integrity": "sha512-d3qI41G4SuLiCGCFGUrKsSeTXyWG6yem1KcGZVS+3FYlYhtNoNgYrWcvkOoaqMhwXSMrZRl69ArHsGJ9mYdbbw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/freebsd-x64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.20.2.tgz", + "integrity": "sha512-d+DipyvHRuqEeM5zDivKV1KuXn9WeRX6vqSqIDgwIfPQtwMP4jaDsQsDncjTDDsExT4lR/91OLjRo8bmC1e+Cw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-arm": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.20.2.tgz", + "integrity": "sha512-VhLPeR8HTMPccbuWWcEUD1Az68TqaTYyj6nfE4QByZIQEQVWBB8vup8PpR7y1QHL3CpcF6xd5WVBU/+SBEvGTg==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-arm64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.20.2.tgz", + "integrity": "sha512-9pb6rBjGvTFNira2FLIWqDk/uaf42sSyLE8j1rnUpuzsODBq7FvpwHYZxQ/It/8b+QOS1RYfqgGFNLRI+qlq2A==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-ia32": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.20.2.tgz", + "integrity": "sha512-o10utieEkNPFDZFQm9CoP7Tvb33UutoJqg3qKf1PWVeeJhJw0Q347PxMvBgVVFgouYLGIhFYG0UGdBumROyiig==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-loong64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.20.2.tgz", + "integrity": "sha512-PR7sp6R/UC4CFVomVINKJ80pMFlfDfMQMYynX7t1tNTeivQ6XdX5r2XovMmha/VjR1YN/HgHWsVcTRIMkymrgQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-mips64el": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.20.2.tgz", + "integrity": "sha512-4BlTqeutE/KnOiTG5Y6Sb/Hw6hsBOZapOVF6njAESHInhlQAghVVZL1ZpIctBOoTFbQyGW+LsVYZ8lSSB3wkjA==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-ppc64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.20.2.tgz", + "integrity": "sha512-rD3KsaDprDcfajSKdn25ooz5J5/fWBylaaXkuotBDGnMnDP1Uv5DLAN/45qfnf3JDYyJv/ytGHQaziHUdyzaAg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-riscv64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.20.2.tgz", + "integrity": "sha512-snwmBKacKmwTMmhLlz/3aH1Q9T8v45bKYGE3j26TsaOVtjIag4wLfWSiZykXzXuE1kbCE+zJRmwp+ZbIHinnVg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-s390x": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.20.2.tgz", + "integrity": "sha512-wcWISOobRWNm3cezm5HOZcYz1sKoHLd8VL1dl309DiixxVFoFe/o8HnwuIwn6sXre88Nwj+VwZUvJf4AFxkyrQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-x64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.20.2.tgz", + "integrity": "sha512-1MdwI6OOTsfQfek8sLwgyjOXAu+wKhLEoaOLTjbijk6E2WONYpH9ZU2mNtR+lZ2B4uwr+usqGuVfFT9tMtGvGw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/netbsd-x64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.20.2.tgz", + "integrity": "sha512-K8/DhBxcVQkzYc43yJXDSyjlFeHQJBiowJ0uVL6Tor3jGQfSGHNNJcWxNbOI8v5k82prYqzPuwkzHt3J1T1iZQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/openbsd-x64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.20.2.tgz", + "integrity": "sha512-eMpKlV0SThJmmJgiVyN9jTPJ2VBPquf6Kt/nAoo6DgHAoN57K15ZghiHaMvqjCye/uU4X5u3YSMgVBI1h3vKrQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/sunos-x64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.20.2.tgz", + "integrity": "sha512-2UyFtRC6cXLyejf/YEld4Hajo7UHILetzE1vsRcGL3earZEW77JxrFjH4Ez2qaTiEfMgAXxfAZCm1fvM/G/o8w==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-arm64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.20.2.tgz", + "integrity": "sha512-GRibxoawM9ZCnDxnP3usoUDO9vUkpAxIIZ6GQI+IlVmr5kP3zUq+l17xELTHMWTWzjxa2guPNyrpq1GWmPvcGQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-ia32": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.20.2.tgz", + "integrity": "sha512-HfLOfn9YWmkSKRQqovpnITazdtquEW8/SoHW7pWpuEeguaZI4QnCRW6b+oZTztdBnZOS2hqJ6im/D5cPzBTTlQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-x64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.20.2.tgz", + "integrity": "sha512-N49X4lJX27+l9jbLKSqZ6bKNjzQvHaT8IIFUy+YIqmXQdjYCToGWwOItDrfby14c78aDd5NHQl29xingXfCdLQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/esbuild": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.20.2.tgz", + "integrity": "sha512-WdOOppmUNU+IbZ0PaDiTst80zjnrOkyJNHoKupIcVyU8Lvla3Ugx94VzkQ32Ijqd7UhHJy75gNWDMUekcrSJ6g==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.20.2", + "@esbuild/android-arm": "0.20.2", + "@esbuild/android-arm64": "0.20.2", + "@esbuild/android-x64": "0.20.2", + "@esbuild/darwin-arm64": "0.20.2", + "@esbuild/darwin-x64": "0.20.2", + "@esbuild/freebsd-arm64": "0.20.2", + "@esbuild/freebsd-x64": "0.20.2", + "@esbuild/linux-arm": "0.20.2", + "@esbuild/linux-arm64": "0.20.2", + "@esbuild/linux-ia32": "0.20.2", + "@esbuild/linux-loong64": "0.20.2", + "@esbuild/linux-mips64el": "0.20.2", + "@esbuild/linux-ppc64": "0.20.2", + "@esbuild/linux-riscv64": "0.20.2", + "@esbuild/linux-s390x": "0.20.2", + "@esbuild/linux-x64": "0.20.2", + "@esbuild/netbsd-x64": "0.20.2", + "@esbuild/openbsd-x64": "0.20.2", + "@esbuild/sunos-x64": "0.20.2", + "@esbuild/win32-arm64": "0.20.2", + "@esbuild/win32-ia32": "0.20.2", + "@esbuild/win32-x64": "0.20.2" + } + }, "node_modules/typescript": { "version": "5.4.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.3.tgz", diff --git a/package.json b/package.json index 7cf279856..f584951d9 100644 --- a/package.json +++ b/package.json @@ -104,7 +104,7 @@ "@types/yargs": "^17.0.32", "esbuild": "^0.19.9", "prettier": "^3.2.4", - "tsx": "^4.7.1", + "tsx": "^4.9.3", "typescript": "^5.4.3" } } From 3c4d54352d69b6274dd62b9510d62419cd15baf4 Mon Sep 17 00:00:00 2001 From: Eledah Date: Mon, 13 May 2024 19:42:06 +0330 Subject: [PATCH 118/135] feat(i18n): add Farsi (#1133) * Add fa-IR translation via upload * Add files via upload * Ran npm run format --- quartz/i18n/index.ts | 2 + quartz/i18n/locales/fa-IR.ts | 83 ++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 quartz/i18n/locales/fa-IR.ts diff --git a/quartz/i18n/index.ts b/quartz/i18n/index.ts index 6707ea35d..9a86d6108 100644 --- a/quartz/i18n/index.ts +++ b/quartz/i18n/index.ts @@ -15,6 +15,7 @@ import zh from "./locales/zh-CN" import vi from "./locales/vi-VN" import pt from "./locales/pt-BR" import hu from "./locales/hu-HU" +import fa from "./locales/fa-IR" export const TRANSLATIONS = { "en-US": en, @@ -54,6 +55,7 @@ export const TRANSLATIONS = { "vi-VN": vi, "pt-BR": pt, "hu-HU": hu, + "fa-IR": fa, } as const export const defaultTranslation = "en-US" diff --git a/quartz/i18n/locales/fa-IR.ts b/quartz/i18n/locales/fa-IR.ts new file mode 100644 index 000000000..6ea773026 --- /dev/null +++ b/quartz/i18n/locales/fa-IR.ts @@ -0,0 +1,83 @@ +import { Translation } from "./definition" + +export default { + propertyDefaults: { + title: "بدون عنوان", + description: "توضیح خاصی اضافه نشده است", + }, + components: { + callout: { + note: "یادداشت", + abstract: "چکیده", + info: "اطلاعات", + todo: "اقدام", + tip: "نکته", + success: "تیک", + question: "سؤال", + warning: "هشدار", + failure: "شکست", + danger: "خطر", + bug: "باگ", + example: "مثال", + quote: "نقل قول", + }, + backlinks: { + title: "بک‌لینک‌ها", + noBacklinksFound: "بدون بک‌لینک", + }, + themeToggle: { + lightMode: "حالت روشن", + darkMode: "حالت تاریک", + }, + explorer: { + title: "مطالب", + }, + footer: { + createdWith: "ساخته شده با", + }, + graph: { + title: "نمای گراف", + }, + recentNotes: { + title: "یادداشت‌های اخیر", + seeRemainingMore: ({ remaining }) => `${remaining} یادداشت دیگر →`, + }, + transcludes: { + transcludeOf: ({ targetSlug }) => `از ${targetSlug}`, + linkToOriginal: "پیوند به اصلی", + }, + search: { + title: "جستجو", + searchBarPlaceholder: "مطلبی را جستجو کنید", + }, + tableOfContents: { + title: "فهرست", + }, + contentMeta: { + readingTime: ({ minutes }) => `زمان تقریبی مطالعه: ${minutes} دقیقه`, + }, + }, + pages: { + rss: { + recentNotes: "یادداشت‌های اخیر", + lastFewNotes: ({ count }) => `${count} یادداشت اخیر`, + }, + error: { + title: "یافت نشد", + notFound: "این صفحه یا خصوصی است یا وجود ندارد", + }, + folderContent: { + folder: "پوشه", + itemsUnderFolder: ({ count }) => + count === 1 ? ".یک مطلب در این پوشه است" : `${count} مطلب در این پوشه است.`, + }, + tagContent: { + tag: "برچسب", + tagIndex: "فهرست برچسب‌ها", + itemsUnderTag: ({ count }) => + count === 1 ? "یک مطلب با این برچسب" : `${count} مطلب با این برچسب.`, + showingFirst: ({ count }) => `در حال نمایش ${count} برچسب.`, + totalTags: ({ count }) => `${count} برچسب یافت شد.`, + }, + }, +} as const satisfies Translation From 535af55ec8fca7e9138250c6cf33204c8469e613 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 May 2024 14:25:42 -0700 Subject: [PATCH 119/135] chore(deps): bump hast-util-to-html from 9.0.0 to 9.0.1 (#1137) Bumps [hast-util-to-html](https://github.com/syntax-tree/hast-util-to-html) from 9.0.0 to 9.0.1. - [Release notes](https://github.com/syntax-tree/hast-util-to-html/releases) - [Commits](https://github.com/syntax-tree/hast-util-to-html/compare/9.0.0...9.0.1) --- updated-dependencies: - dependency-name: hast-util-to-html 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 9cf994a25..303984cc4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,7 +22,7 @@ "github-slugger": "^2.0.0", "globby": "^14.0.1", "gray-matter": "^4.0.3", - "hast-util-to-html": "^9.0.0", + "hast-util-to-html": "^9.0.1", "hast-util-to-jsx-runtime": "^2.3.0", "hast-util-to-string": "^3.0.0", "is-absolute-url": "^4.0.1", @@ -2710,9 +2710,9 @@ "integrity": "sha512-dqId9J8K/vGi5Zr7oo212BGii5m3q5Hxlkwy3WpYuKPklmBEvsbMYYyLxAQpSffdLl/gdW0XUpKWFvYmyoWCoQ==" }, "node_modules/hast-util-to-html": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-9.0.0.tgz", - "integrity": "sha512-IVGhNgg7vANuUA2XKrT6sOIIPgaYZnmLx3l/CCOAK0PtgfoHrZwX7jCSYyFxHTrGmC6S9q8aQQekjp4JPZF+cw==", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-9.0.1.tgz", + "integrity": "sha512-hZOofyZANbyWo+9RP75xIDV/gq+OUKx+T46IlwERnKmfpwp81XBFbT9mi26ws+SJchA4RVUQwIBJpqEOBhMzEQ==", "dependencies": { "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", diff --git a/package.json b/package.json index f584951d9..35313a979 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "github-slugger": "^2.0.0", "globby": "^14.0.1", "gray-matter": "^4.0.3", - "hast-util-to-html": "^9.0.0", + "hast-util-to-html": "^9.0.1", "hast-util-to-jsx-runtime": "^2.3.0", "hast-util-to-string": "^3.0.0", "is-absolute-url": "^4.0.1", From e3cfe1f22fb5054c09f845bc3317b85eb4b0e426 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 May 2024 23:21:01 -0700 Subject: [PATCH 120/135] chore(deps-dev): bump typescript from 5.4.3 to 5.4.5 (#1092) Bumps [typescript](https://github.com/Microsoft/TypeScript) from 5.4.3 to 5.4.5. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml) - [Commits](https://github.com/Microsoft/TypeScript/compare/v5.4.3...v5.4.5) --- updated-dependencies: - dependency-name: typescript 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 303984cc4..a2a621f21 100644 --- a/package-lock.json +++ b/package-lock.json @@ -82,7 +82,7 @@ "esbuild": "^0.19.9", "prettier": "^3.2.4", "tsx": "^4.9.3", - "typescript": "^5.4.3" + "typescript": "^5.4.5" }, "engines": { "node": ">=18.14", @@ -6328,9 +6328,9 @@ } }, "node_modules/typescript": { - "version": "5.4.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.3.tgz", - "integrity": "sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg==", + "version": "5.4.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", + "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", "dev": true, "bin": { "tsc": "bin/tsc", diff --git a/package.json b/package.json index 35313a979..db20bd169 100644 --- a/package.json +++ b/package.json @@ -105,6 +105,6 @@ "esbuild": "^0.19.9", "prettier": "^3.2.4", "tsx": "^4.9.3", - "typescript": "^5.4.3" + "typescript": "^5.4.5" } } From a97e72f2192ebb07c221acd4bb39840d10ac2c49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Garbiec?= Date: Mon, 20 May 2024 21:36:32 +0200 Subject: [PATCH 121/135] i18n: add Polish translation (#1148) * Create pl-PL.ts * add pl-PL to index.ts * import pl-PL in index.ts --- quartz/i18n/index.ts | 2 + quartz/i18n/locales/pl-PL.ts | 83 ++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 quartz/i18n/locales/pl-PL.ts diff --git a/quartz/i18n/index.ts b/quartz/i18n/index.ts index 9a86d6108..eab1f1a78 100644 --- a/quartz/i18n/index.ts +++ b/quartz/i18n/index.ts @@ -16,6 +16,7 @@ import vi from "./locales/vi-VN" import pt from "./locales/pt-BR" import hu from "./locales/hu-HU" import fa from "./locales/fa-IR" +import pl from "./locales/pl-PL" export const TRANSLATIONS = { "en-US": en, @@ -56,6 +57,7 @@ export const TRANSLATIONS = { "pt-BR": pt, "hu-HU": hu, "fa-IR": fa, + "pl-PL": pl, } as const export const defaultTranslation = "en-US" diff --git a/quartz/i18n/locales/pl-PL.ts b/quartz/i18n/locales/pl-PL.ts new file mode 100644 index 000000000..7b193c109 --- /dev/null +++ b/quartz/i18n/locales/pl-PL.ts @@ -0,0 +1,83 @@ +import { Translation } from "./definition" + +export default { + propertyDefaults: { + title: "Bez nazwy", + description: "Brak opisu", + }, + components: { + callout: { + note: "Notatka", + abstract: "Streszczenie", + info: "informacja", + todo: "Do zrobienia", + tip: "Wskazówka", + success: "Zrobione", + question: "Pytanie", + warning: "Ostrzeżenie", + failure: "Usterka", + danger: "Niebiezpieczeństwo", + bug: "Błąd w kodzie", + example: "Przykład", + quote: "Cytat", + }, + backlinks: { + title: "Odnośniki zwrotne", + noBacklinksFound: "Brak połączeń zwrotnych", + }, + themeToggle: { + lightMode: "Trzyb jasny", + darkMode: "Tryb ciemny", + }, + explorer: { + title: "Przeglądaj", + }, + footer: { + createdWith: "Stworzone z użyciem", + }, + graph: { + title: "Graf", + }, + recentNotes: { + title: "Najnowsze notatki", + seeRemainingMore: ({ remaining }) => `Zobacz ${remaining} nastepnych →`, + }, + transcludes: { + transcludeOf: ({ targetSlug }) => `Osadzone ${targetSlug}`, + linkToOriginal: "Łącze do oryginału", + }, + search: { + title: "Szukaj", + searchBarPlaceholder: "Search for something", + }, + tableOfContents: { + title: "Spis treści", + }, + contentMeta: { + readingTime: ({ minutes }) => `${minutes} min. czytania `, + }, + }, + pages: { + rss: { + recentNotes: "Najnowsze notatki", + lastFewNotes: ({ count }) => `Ostatnie ${count} notatek`, + }, + error: { + title: "Nie znaleziono", + notFound: "Ta strona jest prywatna lub nie istnieje.", + }, + folderContent: { + folder: "Folder", + itemsUnderFolder: ({ count }) => + count === 1 ? "W tym folderze jest 1 element." : `Elementów w folderze: ${count}.`, + }, + tagContent: { + tag: "Znacznik", + tagIndex: "Spis znaczników", + itemsUnderTag: ({ count }) => + count === 1 ? "Oznaczony 1 element." : `Elementów z tym znacznikiem: ${count}.`, + showingFirst: ({ count }) => `Pokazuje ${count} pierwszych znaczników.`, + totalTags: ({ count }) => `Znalezionych wszystkich znaczników: ${count}.`, + }, + }, +} as const satisfies Translation From a655cec9f690bb045e81172b6cee532d9303ba02 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 May 2024 13:11:08 -0700 Subject: [PATCH 122/135] chore(deps): bump rimraf from 5.0.5 to 5.0.7 (#1150) updated-dependencies: - dependency-name: rimraf 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 | 10 +++++----- package.json | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index a2a621f21..96549aafd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -53,7 +53,7 @@ "remark-rehype": "^11.1.0", "remark-smartypants": "^2.1.0", "rfdc": "^1.3.1", - "rimraf": "^5.0.5", + "rimraf": "^5.0.7", "serve-handler": "^6.1.5", "shiki": "^1.2.3", "source-map-support": "^0.5.21", @@ -5419,9 +5419,9 @@ "integrity": "sha512-r5a3l5HzYlIC68TpmYKlxWjmOP6wiPJ1vWv2HeLhNsRZMrCkxeqxiHlQ21oXmQ4F3SiryXBHhAD7JZqvOJjFmg==" }, "node_modules/rimraf": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.5.tgz", - "integrity": "sha512-CqDakW+hMe/Bz202FPEymy68P+G50RfMQK+Qo5YUqc9SPipvbGjCGKd0RSKEelbsfQuw3g5NZDSrlZZAJurH1A==", + "version": "5.0.7", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.7.tgz", + "integrity": "sha512-nV6YcJo5wbLW77m+8KjH8aB/7/rxQy9SZ0HY5shnwULfS+9nmTtVXAJET5NdZmCzA4fPI/Hm1wo/Po/4mopOdg==", "dependencies": { "glob": "^10.3.7" }, @@ -5429,7 +5429,7 @@ "rimraf": "dist/esm/bin.mjs" }, "engines": { - "node": ">=14" + "node": ">=14.18" }, "funding": { "url": "https://github.com/sponsors/isaacs" diff --git a/package.json b/package.json index db20bd169..41939ceb4 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "remark-rehype": "^11.1.0", "remark-smartypants": "^2.1.0", "rfdc": "^1.3.1", - "rimraf": "^5.0.5", + "rimraf": "^5.0.7", "serve-handler": "^6.1.5", "shiki": "^1.2.3", "source-map-support": "^0.5.21", From cf1b3f270b2175aa8d5f2cf2860738988d14e711 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 May 2024 13:11:16 -0700 Subject: [PATCH 123/135] chore(deps): bump shiki from 1.2.3 to 1.6.0 (#1149) updated-dependencies: - dependency-name: shiki 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 | 16 ++++++++-------- package.json | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 96549aafd..58d334df3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -55,7 +55,7 @@ "rfdc": "^1.3.1", "rimraf": "^5.0.7", "serve-handler": "^6.1.5", - "shiki": "^1.2.3", + "shiki": "^1.6.0", "source-map-support": "^0.5.21", "to-vfile": "^8.0.0", "toml": "^3.0.0", @@ -820,9 +820,9 @@ } }, "node_modules/@shikijs/core": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.2.3.tgz", - "integrity": "sha512-SM+aiQVaEK2P53dEcsvhq9+LJPr0rzwezHbMQhHaSrPN4OlOB4vp1qTdhVEKfMg6atdq8s9ZotWW/CSCzWftwg==" + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.6.0.tgz", + "integrity": "sha512-NIEAi5U5R7BLkbW1pG/ZKu3eb1lzc3/+jD0lFsuxMT7zjaf9bbNwdNyMr7zh/Zl8EXQtQ+MYBAt5G+JLu+5DlA==" }, "node_modules/@sindresorhus/merge-streams": { "version": "2.3.0", @@ -5571,11 +5571,11 @@ } }, "node_modules/shiki": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.2.3.tgz", - "integrity": "sha512-+v7lO5cJMeV2N2ySK4l+51YX3wTh5I49SLjAOs1ch1DbUfeEytU1Ac9KaZPoZJCVBGycDZ09OBQN5nbcPFc5FQ==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.6.0.tgz", + "integrity": "sha512-P31ROeXcVgW/k3Z+vUUErcxoTah7ZRaimctOpzGuqAntqnnSmx1HOsvnbAB8Z2qfXPRhw61yptAzCsuKOhTHwQ==", "dependencies": { - "@shikijs/core": "1.2.3" + "@shikijs/core": "1.6.0" } }, "node_modules/signal-exit": { diff --git a/package.json b/package.json index 41939ceb4..7b3f11ac6 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,7 @@ "rfdc": "^1.3.1", "rimraf": "^5.0.7", "serve-handler": "^6.1.5", - "shiki": "^1.2.3", + "shiki": "^1.6.0", "source-map-support": "^0.5.21", "to-vfile": "^8.0.0", "toml": "^3.0.0", From 81a4e202362f42a82baa9df2b6b91a774098740b Mon Sep 17 00:00:00 2001 From: Yohann Bacha Date: Tue, 21 May 2024 18:50:58 +0200 Subject: [PATCH 124/135] feat: ability to hide tags in the recent notes component (#1147) * feat: ability to hide tags in the recent notes component * docs: recent notes custom parameters in a table * docs: revert recent notes doc to bullet points * fix: linter issues * Update docs/features/recent notes.md --------- Co-authored-by: Jacky Zhao --- docs/features/recent notes.md | 1 + quartz/components/RecentNotes.tsx | 28 ++++++++++++++++------------ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/docs/features/recent notes.md b/docs/features/recent notes.md index 9236b7ce2..75406e504 100644 --- a/docs/features/recent notes.md +++ b/docs/features/recent notes.md @@ -9,6 +9,7 @@ Quartz can generate a list of recent notes based on some filtering and sorting c - Changing the title from "Recent notes": pass in an additional parameter to `Component.RecentNotes({ title: "Recent writing" })` - Changing the number of recent notes: pass in an additional parameter to `Component.RecentNotes({ limit: 5 })` +- Display the note's tags (defaults to true): `Component.RecentNotes({ showTags: false })` - Show a 'see more' link: pass in an additional parameter to `Component.RecentNotes({ linkToMore: "tags/components" })`. This field should be a full slug to a page that exists. - Customize filtering: pass in an additional parameter to `Component.RecentNotes({ filter: someFilterFunction })`. The filter function should be a function that has the signature `(f: QuartzPluginData) => boolean`. - Customize sorting: pass in an additional parameter to `Component.RecentNotes({ sort: someSortFunction })`. By default, Quartz will sort by date and then tie break lexographically. The sort function should be a function that has the signature `(f1: QuartzPluginData, f2: QuartzPluginData) => number`. See `byDateAndAlphabetical` in `quartz/components/PageList.tsx` for an example. diff --git a/quartz/components/RecentNotes.tsx b/quartz/components/RecentNotes.tsx index d99878db9..2c32feadf 100644 --- a/quartz/components/RecentNotes.tsx +++ b/quartz/components/RecentNotes.tsx @@ -12,6 +12,7 @@ interface Options { title?: string limit: number linkToMore: SimpleSlug | false + showTags: boolean filter: (f: QuartzPluginData) => boolean sort: (f1: QuartzPluginData, f2: QuartzPluginData) => number } @@ -19,6 +20,7 @@ interface Options { const defaultOptions = (cfg: GlobalConfiguration): Options => ({ limit: 3, linkToMore: false, + showTags: true, filter: () => true, sort: byDateAndAlphabetical(cfg), }) @@ -56,18 +58,20 @@ export default ((userOpts?: Partial) => {

    )} - + {opts.showTags && ( + + )}
    ) From 9c726efa3329b647d4fdf346c67dc80762b68077 Mon Sep 17 00:00:00 2001 From: James Bennion-Pedley <35117353+BOJIT@users.noreply.github.com> Date: Wed, 22 May 2024 21:44:54 +0100 Subject: [PATCH 125/135] feat(i18n): homepage link for 404 pages (#1117) * Add homepage link with internationalization * Construct pathname from baseUrl config value * More robust URL manipulation * Add Farsi (#1133) * Fix bad rebase --- quartz/components/pages/404.tsx | 5 +++++ quartz/i18n/locales/ar-SA.ts | 1 + quartz/i18n/locales/de-DE.ts | 1 + quartz/i18n/locales/definition.ts | 1 + quartz/i18n/locales/en-US.ts | 1 + quartz/i18n/locales/es-ES.ts | 1 + quartz/i18n/locales/fa-IR.ts | 1 + quartz/i18n/locales/fr-FR.ts | 1 + quartz/i18n/locales/hu-HU.ts | 1 + quartz/i18n/locales/it-IT.ts | 1 + quartz/i18n/locales/ja-JP.ts | 1 + quartz/i18n/locales/ko-KR.ts | 1 + quartz/i18n/locales/nl-NL.ts | 1 + quartz/i18n/locales/pl-PL.ts | 1 + quartz/i18n/locales/pt-BR.ts | 1 + quartz/i18n/locales/ro-RO.ts | 1 + quartz/i18n/locales/ru-RU.ts | 1 + quartz/i18n/locales/uk-UA.ts | 1 + quartz/i18n/locales/vi-VN.ts | 1 + quartz/i18n/locales/zh-CN.ts | 1 + 20 files changed, 24 insertions(+) diff --git a/quartz/components/pages/404.tsx b/quartz/components/pages/404.tsx index 4ef1b912c..63da2c88a 100644 --- a/quartz/components/pages/404.tsx +++ b/quartz/components/pages/404.tsx @@ -2,10 +2,15 @@ import { i18n } from "../../i18n" import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "../types" const NotFound: QuartzComponent = ({ cfg }: QuartzComponentProps) => { + // If baseUrl contains a pathname after the domain, use this as the home link + const url = new URL(`https://${cfg.baseUrl ?? "example.com"}`) + const baseDir = url.pathname + return ( ) } diff --git a/quartz/i18n/locales/ar-SA.ts b/quartz/i18n/locales/ar-SA.ts index f7048103f..8463e2ff5 100644 --- a/quartz/i18n/locales/ar-SA.ts +++ b/quartz/i18n/locales/ar-SA.ts @@ -70,6 +70,7 @@ export default { error: { title: "غير موجود", notFound: "إما أن هذه الصفحة خاصة أو غير موجودة.", + home: "العوده للصفحة الرئيسية", }, folderContent: { folder: "مجلد", diff --git a/quartz/i18n/locales/de-DE.ts b/quartz/i18n/locales/de-DE.ts index 64c9ba9df..023d4be33 100644 --- a/quartz/i18n/locales/de-DE.ts +++ b/quartz/i18n/locales/de-DE.ts @@ -65,6 +65,7 @@ export default { error: { title: "Nicht gefunden", notFound: "Diese Seite ist entweder nicht öffentlich oder existiert nicht.", + home: "Return to Homepage", }, folderContent: { folder: "Ordner", diff --git a/quartz/i18n/locales/definition.ts b/quartz/i18n/locales/definition.ts index 1d5d3dda6..25a8cd7f2 100644 --- a/quartz/i18n/locales/definition.ts +++ b/quartz/i18n/locales/definition.ts @@ -67,6 +67,7 @@ export interface Translation { error: { title: string notFound: string + home: string } folderContent: { folder: string diff --git a/quartz/i18n/locales/en-US.ts b/quartz/i18n/locales/en-US.ts index ac283fdaf..22cf31e01 100644 --- a/quartz/i18n/locales/en-US.ts +++ b/quartz/i18n/locales/en-US.ts @@ -65,6 +65,7 @@ export default { error: { title: "Not Found", notFound: "Either this page is private or doesn't exist.", + home: "Return to Homepage", }, folderContent: { folder: "Folder", diff --git a/quartz/i18n/locales/es-ES.ts b/quartz/i18n/locales/es-ES.ts index 37a2a79c7..8b0adcc37 100644 --- a/quartz/i18n/locales/es-ES.ts +++ b/quartz/i18n/locales/es-ES.ts @@ -65,6 +65,7 @@ export default { error: { title: "No se encontró.", notFound: "Esta página es privada o no existe.", + home: "Regresar a la página principal", }, folderContent: { folder: "Carpeta", diff --git a/quartz/i18n/locales/fa-IR.ts b/quartz/i18n/locales/fa-IR.ts index 6ea773026..5bfef5aee 100644 --- a/quartz/i18n/locales/fa-IR.ts +++ b/quartz/i18n/locales/fa-IR.ts @@ -65,6 +65,7 @@ export default { error: { title: "یافت نشد", notFound: "این صفحه یا خصوصی است یا وجود ندارد", + home: "بازگشت به صفحه اصلی", }, folderContent: { folder: "پوشه", diff --git a/quartz/i18n/locales/fr-FR.ts b/quartz/i18n/locales/fr-FR.ts index e1dfa48b7..ef43fa876 100644 --- a/quartz/i18n/locales/fr-FR.ts +++ b/quartz/i18n/locales/fr-FR.ts @@ -65,6 +65,7 @@ export default { error: { title: "Introuvable", notFound: "Cette page est soit privée, soit elle n'existe pas.", + home: "Retour à la page d'accueil", }, folderContent: { folder: "Dossier", diff --git a/quartz/i18n/locales/hu-HU.ts b/quartz/i18n/locales/hu-HU.ts index 6397309b7..066b7770e 100644 --- a/quartz/i18n/locales/hu-HU.ts +++ b/quartz/i18n/locales/hu-HU.ts @@ -65,6 +65,7 @@ export default { error: { title: "Nem található", notFound: "Ez a lap vagy privát vagy nem létezik.", + home: "Vissza a kezdőlapra", }, folderContent: { folder: "Mappa", diff --git a/quartz/i18n/locales/it-IT.ts b/quartz/i18n/locales/it-IT.ts index ca8818a65..c8c597352 100644 --- a/quartz/i18n/locales/it-IT.ts +++ b/quartz/i18n/locales/it-IT.ts @@ -65,6 +65,7 @@ export default { error: { title: "Non trovato", notFound: "Questa pagina è privata o non esiste.", + home: "Ritorna alla home page", }, folderContent: { folder: "Cartella", diff --git a/quartz/i18n/locales/ja-JP.ts b/quartz/i18n/locales/ja-JP.ts index d429db411..9581b5ed3 100644 --- a/quartz/i18n/locales/ja-JP.ts +++ b/quartz/i18n/locales/ja-JP.ts @@ -65,6 +65,7 @@ export default { error: { title: "Not Found", notFound: "ページが存在しないか、非公開設定になっています。", + home: "ホームページに戻る", }, folderContent: { folder: "フォルダ", diff --git a/quartz/i18n/locales/ko-KR.ts b/quartz/i18n/locales/ko-KR.ts index ea735b00c..9be08d98f 100644 --- a/quartz/i18n/locales/ko-KR.ts +++ b/quartz/i18n/locales/ko-KR.ts @@ -65,6 +65,7 @@ export default { error: { title: "Not Found", notFound: "페이지가 존재하지 않거나 비공개 설정이 되어 있습니다.", + home: "홈페이지로 돌아가기", }, folderContent: { folder: "폴더", diff --git a/quartz/i18n/locales/nl-NL.ts b/quartz/i18n/locales/nl-NL.ts index d075d584a..ccbafa7b3 100644 --- a/quartz/i18n/locales/nl-NL.ts +++ b/quartz/i18n/locales/nl-NL.ts @@ -66,6 +66,7 @@ export default { error: { title: "Niet gevonden", notFound: "Deze pagina is niet zichtbaar of bestaat niet.", + home: "Keer terug naar de start pagina", }, folderContent: { folder: "Map", diff --git a/quartz/i18n/locales/pl-PL.ts b/quartz/i18n/locales/pl-PL.ts index 7b193c109..7fa0cd47a 100644 --- a/quartz/i18n/locales/pl-PL.ts +++ b/quartz/i18n/locales/pl-PL.ts @@ -65,6 +65,7 @@ export default { error: { title: "Nie znaleziono", notFound: "Ta strona jest prywatna lub nie istnieje.", + home: "Powrót do strony głównej", }, folderContent: { folder: "Folder", diff --git a/quartz/i18n/locales/pt-BR.ts b/quartz/i18n/locales/pt-BR.ts index 489d64220..c7b6bfb60 100644 --- a/quartz/i18n/locales/pt-BR.ts +++ b/quartz/i18n/locales/pt-BR.ts @@ -65,6 +65,7 @@ export default { error: { title: "Não encontrado", notFound: "Esta página é privada ou não existe.", + home: "Retornar a página inicial", }, folderContent: { folder: "Arquivo", diff --git a/quartz/i18n/locales/ro-RO.ts b/quartz/i18n/locales/ro-RO.ts index 556b18995..2de1c8cd9 100644 --- a/quartz/i18n/locales/ro-RO.ts +++ b/quartz/i18n/locales/ro-RO.ts @@ -66,6 +66,7 @@ export default { error: { title: "Pagina nu a fost găsită", notFound: "Fie această pagină este privată, fie nu există.", + home: "Reveniți la pagina de pornire", }, folderContent: { folder: "Dosar", diff --git a/quartz/i18n/locales/ru-RU.ts b/quartz/i18n/locales/ru-RU.ts index 8ead3cabe..18e081734 100644 --- a/quartz/i18n/locales/ru-RU.ts +++ b/quartz/i18n/locales/ru-RU.ts @@ -67,6 +67,7 @@ export default { error: { title: "Страница не найдена", notFound: "Эта страница приватная или не существует", + home: "Вернуться на главную страницу", }, folderContent: { folder: "Папка", diff --git a/quartz/i18n/locales/uk-UA.ts b/quartz/i18n/locales/uk-UA.ts index b63693837..d39febb75 100644 --- a/quartz/i18n/locales/uk-UA.ts +++ b/quartz/i18n/locales/uk-UA.ts @@ -65,6 +65,7 @@ export default { error: { title: "Не знайдено", notFound: "Ця сторінка або приватна, або не існує.", + home: "Повернутися на головну сторінку", }, folderContent: { folder: "Папка", diff --git a/quartz/i18n/locales/vi-VN.ts b/quartz/i18n/locales/vi-VN.ts index b72ced4ac..39a8fbcc1 100644 --- a/quartz/i18n/locales/vi-VN.ts +++ b/quartz/i18n/locales/vi-VN.ts @@ -65,6 +65,7 @@ export default { 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.", + home: "Trở về trang chủ", }, folderContent: { folder: "Thư Mục", diff --git a/quartz/i18n/locales/zh-CN.ts b/quartz/i18n/locales/zh-CN.ts index 43d011197..b710db539 100644 --- a/quartz/i18n/locales/zh-CN.ts +++ b/quartz/i18n/locales/zh-CN.ts @@ -65,6 +65,7 @@ export default { error: { title: "无法找到", notFound: "私有笔记或笔记不存在。", + home: "返回首页", }, folderContent: { folder: "文件夹", From 77d6d9623fc195f97de4d82f3498b4a5723e3d38 Mon Sep 17 00:00:00 2001 From: Alex Nordstrom <6267244+HyperEpsilon@users.noreply.github.com> Date: Tue, 28 May 2024 16:23:28 -0600 Subject: [PATCH 126/135] feat: add callout metadata parsing (#1172) --- quartz/plugins/transformers/ofm.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/quartz/plugins/transformers/ofm.ts b/quartz/plugins/transformers/ofm.ts index 108f7f779..c4072522f 100644 --- a/quartz/plugins/transformers/ofm.ts +++ b/quartz/plugins/transformers/ofm.ts @@ -123,8 +123,8 @@ export const tableWikilinkRegex = new RegExp(/(!?\[\[[^\]]*?\]\])/, "g") const highlightRegex = new RegExp(/==([^=]+)==/, "g") const commentRegex = new RegExp(/%%[\s\S]*?%%/, "g") // from https://github.com/escwxyz/remark-obsidian-callout/blob/main/src/index.ts -const calloutRegex = new RegExp(/^\[\!(\w+)\]([+-]?)/) -const calloutLineRegex = new RegExp(/^> *\[\!\w+\][+-]?.*$/, "gm") +const calloutRegex = new RegExp(/^\[\!(\w+)\|?(\w+)?\]([+-]?)/) +const calloutLineRegex = new RegExp(/^> *\[\!\w+\|?\w*\][+-]?.*$/, "gm") // (?:^| ) -> non-capturing group, tag should start be separated by a space or be the start of the line // #(...) -> capturing group, tag itself must start with # // (?:[-_\p{L}\d\p{Z}])+ -> non-capturing group, non-empty string of (Unicode-aware) alpha-numeric characters and symbols, hyphens and/or underscores @@ -427,7 +427,7 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin const match = firstLine.match(calloutRegex) if (match && match.input) { - const [calloutDirective, typeString, collapseChar] = match + const [calloutDirective, typeString, calloutMetaData, collapseChar] = match const calloutType = canonicalizeCallout(typeString.toLowerCase()) const collapse = collapseChar === "+" || collapseChar === "-" const defaultState = collapseChar === "-" ? "collapsed" : "expanded" @@ -489,6 +489,7 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin className: classNames.join(" "), "data-callout": calloutType, "data-callout-fold": collapse, + "data-callout-metadata": calloutMetaData, }, } } From a99e854d1e932f0d3f1f3e8b59e86f7b99c63086 Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 29 May 2024 14:47:45 -0500 Subject: [PATCH 127/135] docs: Update showcase.md (#1176) Added Gatekeeper Wiki. --- docs/showcase.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/showcase.md b/docs/showcase.md index c33f34c8e..9cff3a5f7 100644 --- a/docs/showcase.md +++ b/docs/showcase.md @@ -28,5 +28,6 @@ Want to see what Quartz can do? Here are some cool community gardens: - [🪴Aster's notebook](https://notes.asterhu.com) - [🥷🏻🌳🍃 Computer Science & Thinkering Garden](https://notes.yxy.ninja) - [A Pattern Language - Christopher Alexander (Architecture)](https://patternlanguage.cc/) +- [Gatekeeper Wiki](https://www.gatekeeper.wiki) 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 9ff4626d25aa28891e92d533f6513a43e3374e13 Mon Sep 17 00:00:00 2001 From: Alex Nordstrom <6267244+HyperEpsilon@users.noreply.github.com> Date: Wed, 29 May 2024 13:48:39 -0600 Subject: [PATCH 128/135] fix: change callout metadata regex to include non-letter characters (#1174) * fix: change callout metadata regex to include non-letter characters * fix: make metadata regex non-greedy This allows for users to have callouts such as > [!NOTE|left foo-bar 123] a ]+ title with square brackets [s] a > Contents --- quartz/plugins/transformers/ofm.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quartz/plugins/transformers/ofm.ts b/quartz/plugins/transformers/ofm.ts index c4072522f..414d8f65c 100644 --- a/quartz/plugins/transformers/ofm.ts +++ b/quartz/plugins/transformers/ofm.ts @@ -123,8 +123,8 @@ export const tableWikilinkRegex = new RegExp(/(!?\[\[[^\]]*?\]\])/, "g") const highlightRegex = new RegExp(/==([^=]+)==/, "g") const commentRegex = new RegExp(/%%[\s\S]*?%%/, "g") // from https://github.com/escwxyz/remark-obsidian-callout/blob/main/src/index.ts -const calloutRegex = new RegExp(/^\[\!(\w+)\|?(\w+)?\]([+-]?)/) -const calloutLineRegex = new RegExp(/^> *\[\!\w+\|?\w*\][+-]?.*$/, "gm") +const calloutRegex = new RegExp(/^\[\!(\w+)\|?(.+?)?\]([+-]?)/) +const calloutLineRegex = new RegExp(/^> *\[\!\w+\|?.*?\][+-]?.*$/, "gm") // (?:^| ) -> non-capturing group, tag should start be separated by a space or be the start of the line // #(...) -> capturing group, tag itself must start with # // (?:[-_\p{L}\d\p{Z}])+ -> non-capturing group, non-empty string of (Unicode-aware) alpha-numeric characters and symbols, hyphens and/or underscores From e57984dafc5f07b54af81b90dc4460c2bed8ae1a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 29 May 2024 12:48:55 -0700 Subject: [PATCH 129/135] chore(deps-dev): bump tsx from 4.9.3 to 4.11.0 (#1168) Bumps [tsx](https://github.com/privatenumber/tsx) from 4.9.3 to 4.11.0. - [Release notes](https://github.com/privatenumber/tsx/releases) - [Changelog](https://github.com/privatenumber/tsx/blob/master/release.config.cjs) - [Commits](https://github.com/privatenumber/tsx/compare/v4.9.3...v4.11.0) --- updated-dependencies: - dependency-name: tsx dependency-type: direct:development 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 | 16 ++++++++-------- package.json | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 58d334df3..e250129ac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -81,7 +81,7 @@ "@types/yargs": "^17.0.32", "esbuild": "^0.19.9", "prettier": "^3.2.4", - "tsx": "^4.9.3", + "tsx": "^4.11.0", "typescript": "^5.4.5" }, "engines": { @@ -2432,9 +2432,9 @@ } }, "node_modules/get-tsconfig": { - "version": "4.7.4", - "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.4.tgz", - "integrity": "sha512-ofbkKj+0pjXjhejr007J/fLf+sW+8H7K5GCm+msC8q3IpvgjobpyPqSRFemNyIMxklC0zeJpi7VDFna19FacvQ==", + "version": "4.7.5", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.5.tgz", + "integrity": "sha512-ZCuZCnlqNzjb4QprAzXKdpp/gh6KTxSJuw3IBsPnV/7fV4NxC9ckB+vPTt8w7fJA0TaSD7c55BR47JD6MEDyDw==", "dev": true, "dependencies": { "resolve-pkg-maps": "^1.0.0" @@ -5903,13 +5903,13 @@ "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, "node_modules/tsx": { - "version": "4.9.3", - "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.9.3.tgz", - "integrity": "sha512-czVbetlILiyJZI5zGlj2kw9vFiSeyra9liPD4nG+Thh4pKTi0AmMEQ8zdV/L2xbIVKrIqif4sUNrsMAOksx9Zg==", + "version": "4.11.0", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.11.0.tgz", + "integrity": "sha512-vzGGELOgAupsNVssAmZjbUDfdm/pWP4R+Kg8TVdsonxbXk0bEpE1qh0yV6/QxUVXaVlNemgcPajGdJJ82n3stg==", "dev": true, "dependencies": { "esbuild": "~0.20.2", - "get-tsconfig": "^4.7.3" + "get-tsconfig": "^4.7.5" }, "bin": { "tsx": "dist/cli.mjs" diff --git a/package.json b/package.json index 7b3f11ac6..082104036 100644 --- a/package.json +++ b/package.json @@ -104,7 +104,7 @@ "@types/yargs": "^17.0.32", "esbuild": "^0.19.9", "prettier": "^3.2.4", - "tsx": "^4.9.3", + "tsx": "^4.11.0", "typescript": "^5.4.5" } } From 3e0e06ff8ac0926b44a5b86e8ded5c2d89a630b3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 29 May 2024 12:49:55 -0700 Subject: [PATCH 130/135] chore(deps): bump ws from 8.16.0 to 8.17.0 (#1169) Bumps [ws](https://github.com/websockets/ws) from 8.16.0 to 8.17.0. - [Release notes](https://github.com/websockets/ws/releases) - [Commits](https://github.com/websockets/ws/compare/8.16.0...8.17.0) --- updated-dependencies: - dependency-name: ws 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 e250129ac..cef67f630 100644 --- a/package-lock.json +++ b/package-lock.json @@ -63,7 +63,7 @@ "unist-util-visit": "^5.0.0", "vfile": "^6.0.1", "workerpool": "^9.1.1", - "ws": "^8.15.1", + "ws": "^8.17.0", "yargs": "^17.7.2" }, "bin": { @@ -6817,9 +6817,9 @@ } }, "node_modules/ws": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", - "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.0.tgz", + "integrity": "sha512-uJq6108EgZMAl20KagGkzCKfMEjxmKvZHG7Tlq0Z6nOky7YF7aq4mOx6xK8TJ/i1LeK4Qus7INktacctDgY8Ow==", "engines": { "node": ">=10.0.0" }, diff --git a/package.json b/package.json index 082104036..aa6e35d52 100644 --- a/package.json +++ b/package.json @@ -89,7 +89,7 @@ "unist-util-visit": "^5.0.0", "vfile": "^6.0.1", "workerpool": "^9.1.1", - "ws": "^8.15.1", + "ws": "^8.17.0", "yargs": "^17.7.2" }, "devDependencies": { From 94fbf5b0668cc0f4352d433fcb37d621e8aed988 Mon Sep 17 00:00:00 2001 From: RunTheBot <58890327+RunTheBot@users.noreply.github.com> Date: Wed, 29 May 2024 15:52:53 -0400 Subject: [PATCH 131/135] fix: Reorder Unified.js plugins to fix #1132 (#1139) * Reorder Unified.js to fix #1132 * moved latex farther down for bette luck --- quartz.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quartz.config.ts b/quartz.config.ts index 4b98325dd..fa08723e9 100644 --- a/quartz.config.ts +++ b/quartz.config.ts @@ -56,7 +56,6 @@ const config: QuartzConfig = { Plugin.CreatedModifiedDate({ priority: ["frontmatter", "filesystem"], }), - Plugin.Latex({ renderEngine: "katex" }), Plugin.SyntaxHighlighting({ theme: { light: "github-light", @@ -69,6 +68,7 @@ const config: QuartzConfig = { Plugin.TableOfContents(), Plugin.CrawlLinks({ markdownLinkResolution: "shortest" }), Plugin.Description(), + Plugin.Latex({ renderEngine: "katex" }), ], filters: [Plugin.RemoveDrafts()], emitters: [ From 0b9f79e1b779d727588cb9aa475a1cad1c8f237d Mon Sep 17 00:00:00 2001 From: Dinu Blanovschi Date: Wed, 29 May 2024 21:53:23 +0200 Subject: [PATCH 132/135] feat(graph): obsidianLikeFocusOnHover (#1017) * feat(graph): obsidianLikeFocusOnHover * fix: prettier * fix: remove option from config * fix: for when opacityOld < 0.2 * fix: prettier --- quartz/components/scripts/graph.inline.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/quartz/components/scripts/graph.inline.ts b/quartz/components/scripts/graph.inline.ts index 1c9bb5d64..e8dec4c5f 100644 --- a/quartz/components/scripts/graph.inline.ts +++ b/quartz/components/scripts/graph.inline.ts @@ -223,6 +223,18 @@ async function renderGraph(container: string, fullSlug: FullSlug) { .transition() .duration(200) .style("opacity", 0.2) + + d3.selectAll(".node") + .filter((d) => !connectedNodes.includes(d.id)) + .nodes() + .map((it) => d3.select(it.parentNode as HTMLElement).select("text")) + .forEach((it) => { + let opacity = parseFloat(it.style("opacity")) + it.transition() + .duration(200) + .attr("opacityOld", opacity) + .style("opacity", Math.min(opacity, 0.2)) + }) } // highlight links @@ -245,6 +257,12 @@ async function renderGraph(container: string, fullSlug: FullSlug) { if (focusOnHover) { d3.selectAll(".link").transition().duration(200).style("opacity", 1) d3.selectAll(".node").transition().duration(200).style("opacity", 1) + + d3.selectAll(".node") + .filter((d) => !connectedNodes.includes(d.id)) + .nodes() + .map((it) => d3.select(it.parentNode as HTMLElement).select("text")) + .forEach((it) => it.transition().duration(200).style("opacity", it.attr("opacityOld"))) } const currentId = d.id const linkNodes = d3 From 520acbbf6fe3ef43e9b2b662bfb21e0f9c3bb982 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Wed, 29 May 2024 13:04:03 -0700 Subject: [PATCH 133/135] docs: inline code syntax highlighting (closes #1162) --- docs/features/syntax highlighting.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/features/syntax highlighting.md b/docs/features/syntax highlighting.md index 16fef2575..bf9baaeee 100644 --- a/docs/features/syntax highlighting.md +++ b/docs/features/syntax highlighting.md @@ -95,6 +95,16 @@ const [age, setAge] = useState(50) const [name, setName] = useState("Taylor") ``` +### Inline Highlighting + +Append {:lang} to the end of inline code to highlight it like a regular code block. + +``` +This is an array `[1, 2, 3]{:js}` of numbers 1 through 3. +``` + +This is an array `[1, 2, 3]{:js}` of numbers 1 through 3. + ### Line numbers Syntax highlighting has line numbers configured automatically. If you want to start line numbers at a specific number, use `showLineNumbers{number}`: From 73a5ec87f135b72e8f99c0e08ca867b03803c5cd Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Wed, 29 May 2024 13:04:58 -0700 Subject: [PATCH 134/135] docs: fix link to path tests (closes #1163) --- docs/advanced/paths.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/advanced/paths.md b/docs/advanced/paths.md index 9455b9819..16f6388d1 100644 --- a/docs/advanced/paths.md +++ b/docs/advanced/paths.md @@ -48,4 +48,4 @@ Here are the main types of slugs with a rough description of each type of path: - `SimpleSlug`: cannot be relative and shouldn't have `/index` as an ending or a file extension. It _can_ however have a trailing slash to indicate a folder path. - `RelativeURL`: must start with `.` or `..` to indicate it's a relative URL. Shouldn't have `/index` as an ending or a file extension but can contain a trailing slash. -To get a clearer picture of how these relate to each other, take a look at the path tests in `quartz/path.test.ts`. +To get a clearer picture of how these relate to each other, take a look at the path tests in `quartz/util/path.test.ts`. From 244801af65b9e628927c1f1b2518ae62ca2e354f Mon Sep 17 00:00:00 2001 From: Leo Lazou Date: Thu, 30 May 2024 19:42:22 +0200 Subject: [PATCH 135/135] idea: Tags appear as hollow circles on the graph (#1129) * Tags appear as hollow circles on the graph Added a few lines to make tags appear as hollow circles on the graph, as opposed to pages which are plain circles, for better visual separation. * Applied Prettier code style --- quartz/components/scripts/graph.inline.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/quartz/components/scripts/graph.inline.ts b/quartz/components/scripts/graph.inline.ts index e8dec4c5f..15a9a061c 100644 --- a/quartz/components/scripts/graph.inline.ts +++ b/quartz/components/scripts/graph.inline.ts @@ -282,6 +282,13 @@ async function renderGraph(container: string, fullSlug: FullSlug) { // @ts-ignore .call(drag(simulation)) + // make tags hollow circles + node + .filter((d) => d.id.startsWith("tags/")) + .attr("stroke", color) + .attr("stroke-width", 2) + .attr("fill", "var(--light)") + // draw labels const labels = graphNode .append("text")