diff --git a/package.json b/package.json index 22a293887..67a39fe5c 100644 --- a/package.json +++ b/package.json @@ -23,10 +23,6 @@ "check": "tsc --noEmit && npx prettier . --check", "format": "npx prettier . --write" }, - "engines": { - "npm": ">=9.3.1", - "node": "20 || >=22" - }, "keywords": [ "site generator", "ssg", @@ -108,5 +104,8 @@ "workerpool": "^9.1.3", "ws": "^8.17.1", "yargs": "^17.7.2" + }, + "dependencies": { + "@types/mdast": "^4.0.4" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0c137a0b6..2e2e26880 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,6 +4,11 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false +dependencies: + '@types/mdast': + specifier: ^4.0.4 + version: 4.0.4 + devDependencies: '@clack/prompts': specifier: ^0.7.0 @@ -1117,11 +1122,10 @@ packages: resolution: {integrity: sha512-rHusx08LCg92WJxrsM3SPjvLTSvK5C+gealtSuhKbEOcUZfWlwigaFoPLf6Dfxhg4oryN5qP9Sj7zOQ4HYXINw==} dev: true - /@types/mdast@4.0.3: - resolution: {integrity: sha512-LsjtqsyF+d2/yFOYaN22dHZI1Cpwkrj+g06G8+qtUKlhovPW89YhqSnfKtMbkgmEtYpH2gydRNULd6y8mciAFg==} + /@types/mdast@4.0.4: + resolution: {integrity: sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==} dependencies: '@types/unist': 3.0.2 - dev: true /@types/ms@0.7.34: resolution: {integrity: sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==} @@ -1155,7 +1159,6 @@ packages: /@types/unist@3.0.2: resolution: {integrity: sha512-dqId9J8K/vGi5Zr7oo212BGii5m3q5Hxlkwy3WpYuKPklmBEvsbMYYyLxAQpSffdLl/gdW0XUpKWFvYmyoWCoQ==} - dev: true /@types/ws@8.5.10: resolution: {integrity: sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==} @@ -2507,7 +2510,7 @@ packages: /mdast-util-find-and-replace@3.0.1: resolution: {integrity: sha512-SG21kZHGC3XRTSUhtofZkBzZTJNM5ecCi0SK2IMKmSXR8vO3peL+kb1O0z7Zl83jKtutG4k5Wv/W7V3/YHvzPA==} dependencies: - '@types/mdast': 4.0.3 + '@types/mdast': 4.0.4 escape-string-regexp: 5.0.0 unist-util-is: 6.0.0 unist-util-visit-parents: 6.0.1 @@ -2516,7 +2519,7 @@ packages: /mdast-util-from-markdown@2.0.0: resolution: {integrity: sha512-n7MTOr/z+8NAX/wmhhDji8O3bRvPTV/U0oTCaZJkjhPSKTPhS3xufVhKGF8s1pJ7Ox4QgoIU7KHseh09S+9rTA==} dependencies: - '@types/mdast': 4.0.3 + '@types/mdast': 4.0.4 '@types/unist': 3.0.2 decode-named-character-reference: 1.0.2 devlop: 1.1.0 @@ -2535,7 +2538,7 @@ packages: /mdast-util-frontmatter@2.0.1: resolution: {integrity: sha512-LRqI9+wdgC25P0URIJY9vwocIzCcksduHQ9OF2joxQoyTNVduwLAFUzjoopuRJbJAReaKrNQKAZKL3uCMugWJA==} dependencies: - '@types/mdast': 4.0.3 + '@types/mdast': 4.0.4 devlop: 1.1.0 escape-string-regexp: 5.0.0 mdast-util-from-markdown: 2.0.0 @@ -2548,7 +2551,7 @@ packages: /mdast-util-gfm-autolink-literal@2.0.0: resolution: {integrity: sha512-FyzMsduZZHSc3i0Px3PQcBT4WJY/X/RCtEJKuybiC6sjPqLv7h1yqAkmILZtuxMSsUyaLUWNp71+vQH2zqp5cg==} dependencies: - '@types/mdast': 4.0.3 + '@types/mdast': 4.0.4 ccount: 2.0.1 devlop: 1.1.0 mdast-util-find-and-replace: 3.0.1 @@ -2558,7 +2561,7 @@ packages: /mdast-util-gfm-footnote@2.0.0: resolution: {integrity: sha512-5jOT2boTSVkMnQ7LTrd6n/18kqwjmuYqo7JUPe+tRCY6O7dAuTFMtTPauYYrMPpox9hlN0uOx/FL8XvEfG9/mQ==} dependencies: - '@types/mdast': 4.0.3 + '@types/mdast': 4.0.4 devlop: 1.1.0 mdast-util-from-markdown: 2.0.0 mdast-util-to-markdown: 2.1.0 @@ -2570,7 +2573,7 @@ packages: /mdast-util-gfm-strikethrough@2.0.0: resolution: {integrity: sha512-mKKb915TF+OC5ptj5bJ7WFRPdYtuHv0yTRxK2tJvi+BDqbkiG7h7u/9SI89nRAYcmap2xHQL9D+QG/6wSrTtXg==} dependencies: - '@types/mdast': 4.0.3 + '@types/mdast': 4.0.4 mdast-util-from-markdown: 2.0.0 mdast-util-to-markdown: 2.1.0 transitivePeerDependencies: @@ -2580,7 +2583,7 @@ packages: /mdast-util-gfm-table@2.0.0: resolution: {integrity: sha512-78UEvebzz/rJIxLvE7ZtDd/vIQ0RHv+3Mh5DR96p7cS7HsBhYIICDBCu8csTNWNO6tBWfqXPWekRuj2FNOGOZg==} dependencies: - '@types/mdast': 4.0.3 + '@types/mdast': 4.0.4 devlop: 1.1.0 markdown-table: 3.0.3 mdast-util-from-markdown: 2.0.0 @@ -2592,7 +2595,7 @@ packages: /mdast-util-gfm-task-list-item@2.0.0: resolution: {integrity: sha512-IrtvNvjxC1o06taBAVJznEnkiHxLFTzgonUdy8hzFVeDun0uTjxxrRGVaNFqkU1wJR3RBPEfsxmU6jDWPofrTQ==} dependencies: - '@types/mdast': 4.0.3 + '@types/mdast': 4.0.4 devlop: 1.1.0 mdast-util-from-markdown: 2.0.0 mdast-util-to-markdown: 2.1.0 @@ -2618,7 +2621,7 @@ packages: resolution: {integrity: sha512-Tl9GBNeG/AhJnQM221bJR2HPvLOSnLE/T9cJI9tlc6zwQk2nPk/4f0cHkOdEixQPC/j8UtKDdITswvLAy1OZ1w==} dependencies: '@types/hast': 3.0.4 - '@types/mdast': 4.0.3 + '@types/mdast': 4.0.4 devlop: 1.1.0 longest-streak: 3.1.0 mdast-util-from-markdown: 2.0.0 @@ -2633,7 +2636,7 @@ packages: dependencies: '@types/estree-jsx': 1.0.5 '@types/hast': 3.0.4 - '@types/mdast': 4.0.3 + '@types/mdast': 4.0.4 devlop: 1.1.0 mdast-util-from-markdown: 2.0.0 mdast-util-to-markdown: 2.1.0 @@ -2646,7 +2649,7 @@ packages: dependencies: '@types/estree-jsx': 1.0.5 '@types/hast': 3.0.4 - '@types/mdast': 4.0.3 + '@types/mdast': 4.0.4 '@types/unist': 3.0.2 ccount: 2.0.1 devlop: 1.1.0 @@ -2666,7 +2669,7 @@ packages: dependencies: '@types/estree-jsx': 1.0.5 '@types/hast': 3.0.4 - '@types/mdast': 4.0.3 + '@types/mdast': 4.0.4 devlop: 1.1.0 mdast-util-from-markdown: 2.0.0 mdast-util-to-markdown: 2.1.0 @@ -2677,14 +2680,14 @@ packages: /mdast-util-newline-to-break@2.0.0: resolution: {integrity: sha512-MbgeFca0hLYIEx/2zGsszCSEJJ1JSCdiY5xQxRcLDDGa8EPvlLPupJ4DSajbMPAnC0je8jfb9TiUATnxxrHUog==} dependencies: - '@types/mdast': 4.0.3 + '@types/mdast': 4.0.4 mdast-util-find-and-replace: 3.0.1 dev: true /mdast-util-phrasing@4.1.0: resolution: {integrity: sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w==} dependencies: - '@types/mdast': 4.0.3 + '@types/mdast': 4.0.4 unist-util-is: 6.0.0 dev: true @@ -2692,7 +2695,7 @@ packages: resolution: {integrity: sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA==} dependencies: '@types/hast': 3.0.4 - '@types/mdast': 4.0.3 + '@types/mdast': 4.0.4 '@ungap/structured-clone': 1.2.0 devlop: 1.1.0 micromark-util-sanitize-uri: 2.0.0 @@ -2705,7 +2708,7 @@ packages: /mdast-util-to-markdown@2.1.0: resolution: {integrity: sha512-SR2VnIEdVNCJbP6y7kVTJgPLifdr8WEU440fQec7qHoHOUz/oJ2jmNRqdDQ3rbiStOXb2mCDGTuwsK5OPUgYlQ==} dependencies: - '@types/mdast': 4.0.3 + '@types/mdast': 4.0.4 '@types/unist': 3.0.2 longest-streak: 3.1.0 mdast-util-phrasing: 4.1.0 @@ -2718,7 +2721,7 @@ packages: /mdast-util-to-string@4.0.0: resolution: {integrity: sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==} dependencies: - '@types/mdast': 4.0.3 + '@types/mdast': 4.0.4 dev: true /mdn-data@2.0.30: @@ -3348,7 +3351,7 @@ packages: /remark-breaks@4.0.0: resolution: {integrity: sha512-IjEjJOkH4FuJvHZVIW0QCDWxcG96kCq7An/KVH2NfJe6rKZU2AsHeB3OEjPNRxi4QC34Xdx7I2KGYn6IpT7gxQ==} dependencies: - '@types/mdast': 4.0.3 + '@types/mdast': 4.0.4 mdast-util-newline-to-break: 2.0.0 unified: 11.0.5 dev: true @@ -3356,7 +3359,7 @@ packages: /remark-frontmatter@5.0.0: resolution: {integrity: sha512-XTFYvNASMe5iPN0719nPrdItC9aU0ssC4v14mH1BCi1u0n1gAocqcujWUrByftZTbLhRtiKRyjYTSIOcr69UVQ==} dependencies: - '@types/mdast': 4.0.3 + '@types/mdast': 4.0.4 mdast-util-frontmatter: 2.0.1 micromark-extension-frontmatter: 2.0.0 unified: 11.0.5 @@ -3367,7 +3370,7 @@ packages: /remark-gfm@4.0.0: resolution: {integrity: sha512-U92vJgBPkbw4Zfu/IiW2oTZLSL3Zpv+uI7My2eq8JxKgqraFdU8YUGicEJCEgSbeaG+QDFqIcwwfMTOEelPxuA==} dependencies: - '@types/mdast': 4.0.3 + '@types/mdast': 4.0.4 mdast-util-gfm: 3.0.0 micromark-extension-gfm: 3.0.0 remark-parse: 11.0.0 @@ -3380,7 +3383,7 @@ packages: /remark-math@6.0.0: resolution: {integrity: sha512-MMqgnP74Igy+S3WwnhQ7kqGlEerTETXMvJhrUzDikVZ2/uogJCb+WHUg97hK9/jcfc0dkD73s3LN8zU49cTEtA==} dependencies: - '@types/mdast': 4.0.3 + '@types/mdast': 4.0.4 mdast-util-math: 3.0.0 micromark-extension-math: 3.0.0 unified: 11.0.5 @@ -3391,7 +3394,7 @@ packages: /remark-parse@11.0.0: resolution: {integrity: sha512-FCxlKLNGknS5ba/1lmpYijMUzX2esxW5xQqjWxw2eHFfS2MSdaHVINFmhjo+qN1WhZhNimq0dZATN9pH0IDrpA==} dependencies: - '@types/mdast': 4.0.3 + '@types/mdast': 4.0.4 mdast-util-from-markdown: 2.0.0 micromark-util-types: 2.0.0 unified: 11.0.5 @@ -3403,7 +3406,7 @@ packages: resolution: {integrity: sha512-z3tJrAs2kIs1AqIIy6pzHmAHlF1hWQ+OdY4/hv+Wxe35EhyLKcajL33iUEn3ScxtFox9nUvRufR/Zre8Q08H/g==} dependencies: '@types/hast': 3.0.4 - '@types/mdast': 4.0.3 + '@types/mdast': 4.0.4 mdast-util-to-hast: 13.2.0 unified: 11.0.5 vfile: 6.0.1 @@ -3421,7 +3424,7 @@ packages: /remark-stringify@11.0.0: resolution: {integrity: sha512-1OSmLd3awB/t8qdoEOMazZkNsfVTeY4fTsgzcQFdXNq8ToTN4ZGwrMnlda4K6smTFKD+GRV6O48i6Z4iKgPPpw==} dependencies: - '@types/mdast': 4.0.3 + '@types/mdast': 4.0.4 mdast-util-to-markdown: 2.1.0 unified: 11.0.5 dev: true @@ -3429,7 +3432,7 @@ packages: /remark@15.0.1: resolution: {integrity: sha512-Eht5w30ruCXgFmxVUSlNWQ9iiimq07URKeFS3hNc8cUWy1llX4KDWfyEDZRycMc+znsN9Ux5/tJ/BFdgdOwA3A==} dependencies: - '@types/mdast': 4.0.3 + '@types/mdast': 4.0.4 remark-parse: 11.0.0 remark-stringify: 11.0.0 unified: 11.0.5 diff --git a/quartz.config.ts b/quartz.config.ts index 39103331a..32cdb3167 100644 --- a/quartz.config.ts +++ b/quartz.config.ts @@ -35,6 +35,7 @@ const config: QuartzConfig = { secondary: "#284B63", // #091217 tertiary: "#84A59D", // #AA336A highlight: "#8F9FA925", + textHighlight: "#fff23688", }, darkMode: { light: "#1E1E2E", // background // #161618 @@ -45,6 +46,7 @@ const config: QuartzConfig = { secondary: "#9BE895", // links, nodes // #7B97AA tertiary: "#C072C4", // hover states, visited links // #84A59D highlight: "#8F9FA925", // internal link background + textHighlight: "#b3aa0288", }, }, }, diff --git a/quartz/build.ts b/quartz/build.ts index e47be9b6e..342a27c92 100644 --- a/quartz/build.ts +++ b/quartz/build.ts @@ -1,24 +1,24 @@ import sourceMapSupport from "source-map-support" sourceMapSupport.install(options) import path from "path" -import {PerfTimer} from "./util/perf" -import {rimraf} from "rimraf" -import {GlobbyFilterFunction, isGitIgnored} from "globby" +import { PerfTimer } from "./util/perf" +import { rimraf } from "rimraf" +import { GlobbyFilterFunction, isGitIgnored } from "globby" import chalk from "chalk" -import {parseMarkdown} from "./processors/parse" -import {filterContent} from "./processors/filter" -import {emitContent} from "./processors/emit" +import { parseMarkdown } from "./processors/parse" +import { filterContent } from "./processors/filter" +import { emitContent } from "./processors/emit" import cfg from "../quartz.config" -import {FilePath, FullSlug, joinSegments, slugifyFilePath} from "./util/path" +import { FilePath, FullSlug, joinSegments, slugifyFilePath } from "./util/path" import chokidar from "chokidar" -import {ProcessedContent} from "./plugins/vfile" -import {Argv, BuildCtx} from "./util/ctx" -import {glob, toPosixPath} from "./util/glob" -import {trace} from "./util/trace" -import {options} from "./util/sourcemap" -import {Mutex} from "async-mutex" +import { ProcessedContent } from "./plugins/vfile" +import { Argv, BuildCtx } from "./util/ctx" +import { glob, toPosixPath } from "./util/glob" +import { trace } from "./util/trace" +import { options } from "./util/sourcemap" +import { Mutex } from "async-mutex" import DepGraph from "./depgraph" -import {getStaticResourcesFromPlugins} from "./plugins" +import { getStaticResourcesFromPlugins } from "./plugins" type Dependencies = Record | null> @@ -65,25 +65,17 @@ async function buildQuartz(argv: Argv, mut: Mutex, clientRefresh: () => void) { const release = await mut.acquire() perf.addEvent("clean") - await rimraf(path.join(output, "*"), {glob: true}) - console.log( - `Cleaned output directory \`${output}\` in ${perf.timeSince("clean")}`, - ) + await rimraf(path.join(output, "*"), { glob: true }) + console.log(`Cleaned output directory \`${output}\` in ${perf.timeSince("clean")}`) perf.addEvent("glob") - const allFiles = await glob( - "**/*.*", - argv.directory, - cfg.configuration.ignorePatterns, - ) + const allFiles = await glob("**/*.*", argv.directory, cfg.configuration.ignorePatterns) const fps = allFiles.filter((fp) => fp.endsWith(".md")).sort() console.log( `Found ${fps.length} input files from \`${argv.directory}\` in ${perf.timeSince("glob")}`, ) - const filePaths = fps.map( - (fp) => joinSegments(argv.directory, fp) as FilePath, - ) + const filePaths = fps.map((fp) => joinSegments(argv.directory, fp) as FilePath) ctx.allSlugs = allFiles.map((fp) => slugifyFilePath(fp as FilePath)) const parsedFiles = await parseMarkdown(ctx, filePaths) @@ -96,18 +88,12 @@ async function buildQuartz(argv: Argv, mut: Mutex, clientRefresh: () => void) { const staticResources = getStaticResourcesFromPlugins(ctx) for (const emitter of cfg.plugins.emitters) { dependencies[emitter.name] = - (await emitter.getDependencyGraph?.( - ctx, - filteredContent, - staticResources, - )) ?? null + (await emitter.getDependencyGraph?.(ctx, filteredContent, staticResources)) ?? null } } await emitContent(ctx, filteredContent) - console.log( - chalk.green(`Done processing ${fps.length} files in ${perf.timeSince()}`), - ) + console.log(chalk.green(`Done processing ${fps.length} files in ${perf.timeSince()}`)) release() if (argv.serve) { @@ -123,7 +109,7 @@ async function startServing( clientRefresh: () => void, dependencies: Dependencies, // emitter name: dep graph ) { - const {argv} = ctx + const { argv } = ctx // cache file parse results const contentMap = new Map() @@ -151,17 +137,11 @@ async function startServing( ignoreInitial: true, }) - const buildFromEntry = argv.fastRebuild - ? partialRebuildFromEntrypoint - : rebuildFromEntrypoint + const buildFromEntry = argv.fastRebuild ? partialRebuildFromEntrypoint : rebuildFromEntrypoint watcher .on("add", (fp) => buildFromEntry(fp, "add", clientRefresh, buildData)) - .on("change", (fp) => - buildFromEntry(fp, "change", clientRefresh, buildData), - ) - .on("unlink", (fp) => - buildFromEntry(fp, "delete", clientRefresh, buildData), - ) + .on("change", (fp) => buildFromEntry(fp, "change", clientRefresh, buildData)) + .on("unlink", (fp) => buildFromEntry(fp, "delete", clientRefresh, buildData)) return async () => { await watcher.close() @@ -174,8 +154,8 @@ async function partialRebuildFromEntrypoint( clientRefresh: () => void, buildData: BuildData, // note: this function mutates buildData ) { - const {ctx, ignored, dependencies, contentMap, mut, toRemove} = buildData - const {argv, cfg} = ctx + const { ctx, ignored, dependencies, contentMap, mut, toRemove } = buildData + const { argv, cfg } = ctx // don't do anything for gitignored files if (ignored(filepath)) { @@ -204,18 +184,12 @@ async function partialRebuildFromEntrypoint( case "add": // add to cache when new file is added processedFiles = await parseMarkdown(ctx, [fp]) - processedFiles.forEach(([tree, vfile]) => - contentMap.set(vfile.data.filePath!, [tree, vfile]), - ) + processedFiles.forEach(([tree, vfile]) => contentMap.set(vfile.data.filePath!, [tree, vfile])) // update the dep graph by asking all emitters whether they depend on this file for (const emitter of cfg.plugins.emitters) { const emitterGraph = - (await emitter.getDependencyGraph?.( - ctx, - processedFiles, - staticResources, - )) ?? null + (await emitter.getDependencyGraph?.(ctx, processedFiles, staticResources)) ?? null if (emitterGraph) { const existingGraph = dependencies[emitter.name] @@ -231,29 +205,20 @@ async function partialRebuildFromEntrypoint( case "change": // invalidate cache when file is changed processedFiles = await parseMarkdown(ctx, [fp]) - processedFiles.forEach(([tree, vfile]) => - contentMap.set(vfile.data.filePath!, [tree, vfile]), - ) + processedFiles.forEach(([tree, vfile]) => contentMap.set(vfile.data.filePath!, [tree, vfile])) // only content files can have added/removed dependencies because of transclusions if (path.extname(fp) === ".md") { for (const emitter of cfg.plugins.emitters) { // get new dependencies from all emitters for this file const emitterGraph = - (await emitter.getDependencyGraph?.( - ctx, - processedFiles, - staticResources, - )) ?? null + (await emitter.getDependencyGraph?.(ctx, processedFiles, staticResources)) ?? null // only update the graph if the emitter plugin uses the changed file // eg. Assets plugin ignores md files, so we skip updating the graph if (emitterGraph?.hasNode(fp)) { // merge the new dependencies into the dep graph - dependencies[emitter.name]?.updateIncomingEdgesForNode( - emitterGraph, - fp, - ) + dependencies[emitter.name]?.updateIncomingEdgesForNode(emitterGraph, fp) } } } @@ -316,11 +281,7 @@ async function partialRebuildFromEntrypoint( .filter((file) => !toRemove.has(file)) .map((file) => contentMap.get(file)!) - const emittedFps = await emitter.emit( - ctx, - upstreamContent, - staticResources, - ) + const emittedFps = await emitter.emit(ctx, upstreamContent, staticResources) if (ctx.argv.verbose) { for (const file of emittedFps) { @@ -332,9 +293,7 @@ async function partialRebuildFromEntrypoint( } } - console.log( - `Emitted ${emittedFiles} files to \`${argv.output}\` in ${perf.timeSince("rebuild")}`, - ) + console.log(`Emitted ${emittedFiles} files to \`${argv.output}\` in ${perf.timeSince("rebuild")}`) // CLEANUP const destinationsToDelete = new Set() @@ -369,18 +328,10 @@ async function rebuildFromEntrypoint( clientRefresh: () => void, buildData: BuildData, // note: this function mutates buildData ) { - const { - ctx, - ignored, - mut, - initialSlugs, - contentMap, - toRebuild, - toRemove, - trackedAssets, - } = buildData + const { ctx, ignored, mut, initialSlugs, contentMap, toRebuild, toRemove, trackedAssets } = + buildData - const {argv} = ctx + const { argv } = ctx // don't do anything for gitignored files if (ignored(fp)) { @@ -422,16 +373,6 @@ async function rebuildFromEntrypoint( try { const filesToRebuild = [...toRebuild].filter((fp) => !toRemove.has(fp)) - - const trackedSlugs = [ - ...new Set([...contentMap.keys(), ...toRebuild, ...trackedAssets]), - ] - .filter((fp) => !toRemove.has(fp)) - .map((fp) => - slugifyFilePath(path.posix.relative(argv.directory, fp) as FilePath), - ) - - ctx.allSlugs = [...new Set([...initialSlugs, ...trackedSlugs])] const parsedContent = await parseMarkdown(ctx, filesToRebuild) for (const content of parsedContent) { const [_tree, vfile] = content @@ -454,13 +395,11 @@ 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(path.join(argv.output, ".*"), {glob: true}) + await rimraf(path.join(argv.output, ".*"), { glob: true }) await emitContent(ctx, filteredContent) console.log(chalk.green(`Done rebuilding in ${perf.timeSince()}`)) } catch (err) { - console.log( - chalk.yellow(`Rebuild failed. Waiting on a change to fix the error...`), - ) + console.log(chalk.yellow(`Rebuild failed. Waiting on a change to fix the error...`)) if (argv.verbose) { console.log(chalk.red(err)) } diff --git a/quartz/components/ArticleTitle.tsx b/quartz/components/ArticleTitle.tsx index 58438c5de..318aeb24e 100644 --- a/quartz/components/ArticleTitle.tsx +++ b/quartz/components/ArticleTitle.tsx @@ -1,14 +1,7 @@ -import { - QuartzComponent, - QuartzComponentConstructor, - QuartzComponentProps, -} from "./types" -import {classNames} from "../util/lang" +import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" +import { classNames } from "../util/lang" -const ArticleTitle: QuartzComponent = ({ - 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 64f6d6843..aa412a2e0 100644 --- a/quartz/components/Backlinks.tsx +++ b/quartz/components/Backlinks.tsx @@ -1,12 +1,8 @@ -import { - QuartzComponent, - 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" +import { resolveRelative, simplifySlug } from "../util/path" +import { i18n } from "../i18n" +import { classNames } from "../util/lang" const Backlinks: QuartzComponent = ({ fileData, @@ -23,9 +19,7 @@ const Backlinks: QuartzComponent = ({ {backlinkFiles.length > 0 ? ( backlinkFiles.map((f) => (
  • - + {f.frontmatter?.title}
  • diff --git a/quartz/components/Body.tsx b/quartz/components/Body.tsx index ef40ef801..96b627883 100644 --- a/quartz/components/Body.tsx +++ b/quartz/components/Body.tsx @@ -1,13 +1,9 @@ // @ts-ignore import clipboardScript from "./scripts/clipboard.inline" import clipboardStyle from "./styles/clipboard.scss" -import { - QuartzComponent, - QuartzComponentConstructor, - QuartzComponentProps, -} from "./types" +import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" -const Body: QuartzComponent = ({children}: QuartzComponentProps) => { +const Body: QuartzComponent = ({ children }: QuartzComponentProps) => { return
    {children}
    } diff --git a/quartz/components/Breadcrumbs.tsx b/quartz/components/Breadcrumbs.tsx index 3a4d915ba..9ccfb9a6a 100644 --- a/quartz/components/Breadcrumbs.tsx +++ b/quartz/components/Breadcrumbs.tsx @@ -1,12 +1,8 @@ -import { - QuartzComponent, - QuartzComponentConstructor, - QuartzComponentProps, -} from "./types" +import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" import breadcrumbsStyle from "./styles/breadcrumbs.scss" -import {FullSlug, SimpleSlug, joinSegments, resolveRelative} from "../util/path" -import {QuartzPluginData} from "../plugins/vfile" -import {classNames} from "../util/lang" +import { FullSlug, SimpleSlug, joinSegments, resolveRelative } from "../util/path" +import { QuartzPluginData } from "../plugins/vfile" +import { classNames } from "../util/lang" type CrumbData = { displayName: string @@ -44,11 +40,7 @@ const defaultOptions: BreadcrumbOptions = { showCurrentPage: true, } -function formatCrumb( - displayName: string, - baseSlug: FullSlug, - currentSlug: SimpleSlug, -): CrumbData { +function formatCrumb(displayName: string, baseSlug: FullSlug, currentSlug: SimpleSlug): CrumbData { return { displayName: displayName.replaceAll("-", " "), path: resolveRelative(baseSlug, currentSlug), @@ -57,7 +49,7 @@ function formatCrumb( export default ((opts?: Partial) => { // Merge options with defaults - const options: BreadcrumbOptions = {...defaultOptions, ...opts} + const options: BreadcrumbOptions = { ...defaultOptions, ...opts } // computed index of folder name to its associated file data let folderIndex: Map | undefined @@ -73,11 +65,7 @@ export default ((opts?: Partial) => { } // Format entry for root element - const firstEntry = formatCrumb( - options.rootName, - fileData.slug!, - "/" as SimpleSlug, - ) + const firstEntry = formatCrumb(options.rootName, fileData.slug!, "/" as SimpleSlug) const crumbs: CrumbData[] = [firstEntry] if (!folderIndex && options.resolveFrontmatterTitle) { @@ -104,9 +92,7 @@ export default ((opts?: Partial) => { let curPathSegment = slugParts[i] // Try to resolve frontmatter folder title - const currentFile = folderIndex?.get( - slugParts.slice(0, i + 1).join("/"), - ) + const currentFile = folderIndex?.get(slugParts.slice(0, i + 1).join("/")) if (currentFile) { const title = currentFile.frontmatter!.title if (title !== "index") { @@ -137,15 +123,11 @@ export default ((opts?: Partial) => { } return ( -