From bcebc208081b8bf1bf50fa95563f5927bd94aeca Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Sat, 1 Jul 2023 13:35:27 -0700 Subject: [PATCH] rss + sitemap --- package-lock.json | 428 --------------------- package.json | 1 - quartz.config.ts | 13 +- quartz/cfg.ts | 5 + quartz/components/PageTitle.tsx | 27 +- quartz/path.ts | 3 + quartz/plugins/emitters/cname.ts | 25 -- quartz/plugins/emitters/contentIndex.ts | 103 ++++- quartz/plugins/emitters/index.ts | 1 - quartz/plugins/index.ts | 10 +- quartz/plugins/transformers/description.ts | 6 +- 11 files changed, 131 insertions(+), 491 deletions(-) delete mode 100644 quartz/plugins/emitters/cname.ts diff --git a/package-lock.json b/package-lock.json index c250a4bf..92e22eb0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,6 @@ "license": "MIT", "dependencies": { "@floating-ui/dom": "^1.4.0", - "@inquirer/prompts": "^1.0.3", "@napi-rs/simple-git": "^0.1.8", "chalk": "^4.1.2", "cli-spinner": "^0.2.10", @@ -411,290 +410,6 @@ "@floating-ui/core": "^1.3.1" } }, - "node_modules/@inquirer/checkbox": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@inquirer/checkbox/-/checkbox-1.3.1.tgz", - "integrity": "sha512-3l3aC6gYOPGaVOa9cNe4dZ8t96e3CFifC3Hee1MD+F7qaRxGAuXnhCQiUr4ngj2P7xd9U3DCDbLXNsLKQoHYCg==", - "dependencies": { - "@inquirer/core": "^2.1.0", - "@inquirer/type": "^1.1.0", - "ansi-escapes": "^4.3.2", - "chalk": "^4.1.2", - "figures": "^3.2.0" - }, - "engines": { - "node": ">=14.18.0" - } - }, - "node_modules/@inquirer/checkbox/node_modules/@inquirer/core": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@inquirer/core/-/core-2.1.0.tgz", - "integrity": "sha512-Hq9hZ5G/VUaeWkSs283HZwwMbe79lcOI5HWwW1GIM1ohouy2/x489Qf/A1BJYvMUj+QG4LSB5LtVMjn9P3Ge6Q==", - "dependencies": { - "@inquirer/type": "^1.1.0", - "ansi-escapes": "^4.3.2", - "chalk": "^4.1.2", - "cli-spinners": "^2.8.0", - "cli-width": "^4.0.0", - "figures": "^3.2.0", - "mute-stream": "^1.0.0", - "run-async": "^3.0.0", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1", - "wrap-ansi": "^6.0.1" - }, - "engines": { - "node": ">=14.18.0" - } - }, - "node_modules/@inquirer/confirm": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@inquirer/confirm/-/confirm-1.0.11.tgz", - "integrity": "sha512-UWYJ+0dN9rWw0czTPqqKRGLqHsLML9rrQlScn5oOVUtiL2WDTxs95JehP2axKsNkSBMxmFAdA7TdctJkZFJcxA==", - "dependencies": { - "@inquirer/core": "^1.3.0", - "@inquirer/type": "^1.0.5", - "chalk": "^4.1.2" - }, - "engines": { - "node": ">=14.18.0" - } - }, - "node_modules/@inquirer/core": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@inquirer/core/-/core-1.3.0.tgz", - "integrity": "sha512-W7EA48gIMahFLiGW/zF+rgoineqTDK5IQizsOmwvbFfYgiQ8Asetut94THBmB3KnW0nrZL5UPHUK6QzcjEzaCw==", - "dependencies": { - "@inquirer/type": "^1.0.5", - "ansi-escapes": "^4.3.2", - "chalk": "^4.1.2", - "cli-spinners": "^2.8.0", - "cli-width": "^4.0.0", - "figures": "^3.2.0", - "mute-stream": "^1.0.0", - "run-async": "^3.0.0", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1", - "wrap-ansi": "^6.0.1" - }, - "engines": { - "node": ">=14.18.0" - } - }, - "node_modules/@inquirer/editor": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@inquirer/editor/-/editor-1.2.0.tgz", - "integrity": "sha512-NMXLLNadvqIR6TD6mNZRa/PKHTvdaa4ndGGeXl+DwybQ4K7cVSJNRrztixpM1KDEoG8Ape5ightNwq25cyugTg==", - "dependencies": { - "@inquirer/core": "^2.1.0", - "@inquirer/type": "^1.1.0", - "chalk": "^4.1.2", - "external-editor": "^3.0.3" - }, - "engines": { - "node": ">=14.18.0" - } - }, - "node_modules/@inquirer/editor/node_modules/@inquirer/core": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@inquirer/core/-/core-2.1.0.tgz", - "integrity": "sha512-Hq9hZ5G/VUaeWkSs283HZwwMbe79lcOI5HWwW1GIM1ohouy2/x489Qf/A1BJYvMUj+QG4LSB5LtVMjn9P3Ge6Q==", - "dependencies": { - "@inquirer/type": "^1.1.0", - "ansi-escapes": "^4.3.2", - "chalk": "^4.1.2", - "cli-spinners": "^2.8.0", - "cli-width": "^4.0.0", - "figures": "^3.2.0", - "mute-stream": "^1.0.0", - "run-async": "^3.0.0", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1", - "wrap-ansi": "^6.0.1" - }, - "engines": { - "node": ">=14.18.0" - } - }, - "node_modules/@inquirer/expand": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@inquirer/expand/-/expand-1.1.1.tgz", - "integrity": "sha512-fXk5NG2FOAiluDWPYfXHuof3sklL/HhZh3NnXfnBZ2IhTCRzXvlXRcQcPlev2sGcZknHn0g6JdKlxjSa+7H2nQ==", - "dependencies": { - "@inquirer/core": "^2.1.0", - "@inquirer/type": "^1.1.0", - "chalk": "^4.1.2", - "figures": "^3.2.0" - }, - "engines": { - "node": ">=14.18.0" - } - }, - "node_modules/@inquirer/expand/node_modules/@inquirer/core": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@inquirer/core/-/core-2.1.0.tgz", - "integrity": "sha512-Hq9hZ5G/VUaeWkSs283HZwwMbe79lcOI5HWwW1GIM1ohouy2/x489Qf/A1BJYvMUj+QG4LSB5LtVMjn9P3Ge6Q==", - "dependencies": { - "@inquirer/type": "^1.1.0", - "ansi-escapes": "^4.3.2", - "chalk": "^4.1.2", - "cli-spinners": "^2.8.0", - "cli-width": "^4.0.0", - "figures": "^3.2.0", - "mute-stream": "^1.0.0", - "run-async": "^3.0.0", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1", - "wrap-ansi": "^6.0.1" - }, - "engines": { - "node": ">=14.18.0" - } - }, - "node_modules/@inquirer/input": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@inquirer/input/-/input-1.2.1.tgz", - "integrity": "sha512-OYwG3dEo1+lMAE6rYB8b1HTg8eSP++jk0pHSjKZu00gTlN5IHW/dliB82nsWe9Bn//93E9LJ1KrhjFMqOzkCFw==", - "dependencies": { - "@inquirer/core": "^2.1.0", - "@inquirer/type": "^1.1.0", - "chalk": "^4.1.2" - }, - "engines": { - "node": ">=14.18.0" - } - }, - "node_modules/@inquirer/input/node_modules/@inquirer/core": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@inquirer/core/-/core-2.1.0.tgz", - "integrity": "sha512-Hq9hZ5G/VUaeWkSs283HZwwMbe79lcOI5HWwW1GIM1ohouy2/x489Qf/A1BJYvMUj+QG4LSB5LtVMjn9P3Ge6Q==", - "dependencies": { - "@inquirer/type": "^1.1.0", - "ansi-escapes": "^4.3.2", - "chalk": "^4.1.2", - "cli-spinners": "^2.8.0", - "cli-width": "^4.0.0", - "figures": "^3.2.0", - "mute-stream": "^1.0.0", - "run-async": "^3.0.0", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1", - "wrap-ansi": "^6.0.1" - }, - "engines": { - "node": ">=14.18.0" - } - }, - "node_modules/@inquirer/password": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@inquirer/password/-/password-1.1.1.tgz", - "integrity": "sha512-3M03aA04hOA4lRjLviB9uGoNmmd1YDNo4CYSFM9Uh4qlXdgvhke3xPU07k3kVstRIo0Te1hF14RL7vEgHJQ8tA==", - "dependencies": { - "@inquirer/input": "^1.2.1", - "@inquirer/type": "^1.1.0", - "chalk": "^4.1.2" - }, - "engines": { - "node": ">=14.18.0" - } - }, - "node_modules/@inquirer/prompts": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@inquirer/prompts/-/prompts-1.2.3.tgz", - "integrity": "sha512-vcPUWXA/boMJc5IDVx/9+ihf1FupsBK1RThnEXnLTpF6hR1iJCoaBoSpREZRdDp/XcPHe/b+QovehBYJoWsUhg==", - "dependencies": { - "@inquirer/checkbox": "^1.2.8", - "@inquirer/confirm": "^1.0.11", - "@inquirer/core": "^1.3.0", - "@inquirer/editor": "^1.0.11", - "@inquirer/expand": "^1.0.11", - "@inquirer/input": "^1.1.2", - "@inquirer/password": "^1.0.11", - "@inquirer/rawlist": "^1.1.3", - "@inquirer/select": "^1.1.7" - }, - "engines": { - "node": ">=14.18.0" - } - }, - "node_modules/@inquirer/rawlist": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@inquirer/rawlist/-/rawlist-1.2.1.tgz", - "integrity": "sha512-t8lMbE3Gqook4PvQYQl9eVJrl/mBy5kCgolwY9El8HLyGZ7Wc3SGIqHnQUlha4qms8HPOdUIBzyPfcAXl5+3SQ==", - "dependencies": { - "@inquirer/core": "^2.1.0", - "@inquirer/type": "^1.1.0", - "chalk": "^4.1.2" - }, - "engines": { - "node": ">=14.18.0" - } - }, - "node_modules/@inquirer/rawlist/node_modules/@inquirer/core": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@inquirer/core/-/core-2.1.0.tgz", - "integrity": "sha512-Hq9hZ5G/VUaeWkSs283HZwwMbe79lcOI5HWwW1GIM1ohouy2/x489Qf/A1BJYvMUj+QG4LSB5LtVMjn9P3Ge6Q==", - "dependencies": { - "@inquirer/type": "^1.1.0", - "ansi-escapes": "^4.3.2", - "chalk": "^4.1.2", - "cli-spinners": "^2.8.0", - "cli-width": "^4.0.0", - "figures": "^3.2.0", - "mute-stream": "^1.0.0", - "run-async": "^3.0.0", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1", - "wrap-ansi": "^6.0.1" - }, - "engines": { - "node": ">=14.18.0" - } - }, - "node_modules/@inquirer/select": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@inquirer/select/-/select-1.2.1.tgz", - "integrity": "sha512-13JDLtlwFoqQUYRdMzz5wP3a4DWccJfNA/8M8MDUhhZ8HeKZ3MPaTMlpxwY+Q0Jgbmt56nf7xUuck0XXPce8Xw==", - "dependencies": { - "@inquirer/core": "^2.1.0", - "@inquirer/type": "^1.1.0", - "ansi-escapes": "^4.3.2", - "chalk": "^4.1.2", - "figures": "^3.2.0" - }, - "engines": { - "node": ">=14.18.0" - } - }, - "node_modules/@inquirer/select/node_modules/@inquirer/core": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@inquirer/core/-/core-2.1.0.tgz", - "integrity": "sha512-Hq9hZ5G/VUaeWkSs283HZwwMbe79lcOI5HWwW1GIM1ohouy2/x489Qf/A1BJYvMUj+QG4LSB5LtVMjn9P3Ge6Q==", - "dependencies": { - "@inquirer/type": "^1.1.0", - "ansi-escapes": "^4.3.2", - "chalk": "^4.1.2", - "cli-spinners": "^2.8.0", - "cli-width": "^4.0.0", - "figures": "^3.2.0", - "mute-stream": "^1.0.0", - "run-async": "^3.0.0", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1", - "wrap-ansi": "^6.0.1" - }, - "engines": { - "node": ">=14.18.0" - } - }, - "node_modules/@inquirer/type": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@inquirer/type/-/type-1.1.0.tgz", - "integrity": "sha512-XMaorygt2o/mXinZg/OOz6d3JKuV3o4jRc/3KDiVPeKLLkjiO4iJErbLKtKn+Od2ZC2lbiFQkrIuloVpEubisA==", - "engines": { - "node": ">=14.18.0" - } - }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -1386,20 +1101,6 @@ "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", "dev": true }, - "node_modules/ansi-escapes": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", - "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", - "dependencies": { - "type-fest": "^0.21.3" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -1539,11 +1240,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/chardet": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", - "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==" - }, "node_modules/chokidar": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", @@ -1578,25 +1274,6 @@ "node": ">=0.10" } }, - "node_modules/cli-spinners": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.0.tgz", - "integrity": "sha512-4/aL9X3Wh0yiMQlE+eeRhWP6vclO3QRtw1JHKIT0FFUs5FjpFmESqtMvYZ0+lbzBw900b95mS0hohy+qn2VK/g==", - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/cli-width": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-4.0.0.tgz", - "integrity": "sha512-ZksGS2xpa/bYkNzN3BAw1wEjsLV/ZKOf/CCrJ/QOBsxx6fOARIkwTutxp1XIOIohi6HKmOFjMoK/XaqDVUpEEw==", - "engines": { - "node": ">= 12" - } - }, "node_modules/cliui": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", @@ -2195,14 +1872,6 @@ "node": ">=6" } }, - "node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "engines": { - "node": ">=0.8.0" - } - }, "node_modules/esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", @@ -2231,30 +1900,6 @@ "node": ">=0.10.0" } }, - "node_modules/external-editor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", - "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", - "dependencies": { - "chardet": "^0.7.0", - "iconv-lite": "^0.4.24", - "tmp": "^0.0.33" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/external-editor/node_modules/iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/fast-glob": { "version": "3.2.12", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", @@ -2298,20 +1943,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/figures": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", - "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", - "dependencies": { - "escape-string-regexp": "^1.0.5" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -3881,14 +3512,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, - "node_modules/mute-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-1.0.0.tgz", - "integrity": "sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==", - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, "node_modules/nlcst-to-string": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/nlcst-to-string/-/nlcst-to-string-3.1.1.tgz", @@ -3909,14 +3532,6 @@ "node": ">=0.10.0" } }, - "node_modules/os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/parse-latin": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/parse-latin/-/parse-latin-5.0.1.tgz", @@ -4407,14 +4022,6 @@ "resolved": "https://registry.npmjs.org/robust-predicates/-/robust-predicates-3.0.2.tgz", "integrity": "sha512-IXgzBWvWQwE6PrDI05OvmXUIruQTcoMDzRsOd5CDvHCVLcLHMTSYvOK5Cm46kWqlV3yAbuSpBZdJ5oP5OUoStg==" }, - "node_modules/run-async": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/run-async/-/run-async-3.0.0.tgz", - "integrity": "sha512-540WwVDOMxA6dN6We19EcT9sc3hkXPw5mzRNGM3FkdN/vtE9NFvj5lFAPNwUDmJjXidm3v7TC1cTE7t17Ulm1Q==", - "engines": { - "node": ">=0.12.0" - } - }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -4698,17 +4305,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/tmp": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dependencies": { - "os-tmpdir": "~1.0.2" - }, - "engines": { - "node": ">=0.6.0" - } - }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -4751,17 +4347,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/type-fest": { - "version": "0.21.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", - "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/typescript": { "version": "5.1.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.3.tgz", @@ -5023,19 +4608,6 @@ "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.4.0.tgz", "integrity": "sha512-i3KR1mQMNwY2wx20ozq2EjISGtQWDIfV56We+yGJ5yDs8jTwQiLLaqHlkBHITlCuJnYlVRmXegxFxZg7gqI++A==" }, - "node_modules/wrap-ansi": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", - "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/wrap-ansi-cjs": { "name": "wrap-ansi", "version": "7.0.0", diff --git a/package.json b/package.json index e16c92f8..614bb761 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,6 @@ }, "dependencies": { "@floating-ui/dom": "^1.4.0", - "@inquirer/prompts": "^1.0.3", "@napi-rs/simple-git": "^0.1.8", "chalk": "^4.1.2", "cli-spinner": "^0.2.10", diff --git a/quartz.config.ts b/quartz.config.ts index 0f2ca8da..f58bc32e 100644 --- a/quartz.config.ts +++ b/quartz.config.ts @@ -5,7 +5,7 @@ import * as Plugin from "./quartz/plugins" const sharedPageComponents = { head: Component.Head(), header: [ - Component.PageTitle({ title: "🪴 Quartz 4.0" }), + Component.PageTitle(), Component.Spacer(), Component.Search(), Component.Darkmode() @@ -43,7 +43,10 @@ const listPageLayout: PageLayout = { const config: QuartzConfig = { configuration: { + pageTitle: "🪴 Quartz 4.0", enableSPA: true, + enablePopovers: true, + canonicalUrl: "quartz.jzhao.xyz", ignorePatterns: ["private", "templates"], theme: { typography: { // loaded from Google Fonts @@ -90,7 +93,7 @@ const config: QuartzConfig = { Plugin.Description(), ], filters: [ - Plugin.RemoveDrafts() + Plugin.RemoveDrafts(), ], emitters: [ Plugin.AliasRedirects(), @@ -109,8 +112,10 @@ const config: QuartzConfig = { ...listPageLayout, pageBody: Component.FolderContent(), }), - Plugin.ContentIndex(), // you can exclude this if you don't plan on using popovers, graph view, or backlinks - Plugin.CNAME({ domain: "quartz.jzhao.xyz" }) // set this to your final deployed domain + Plugin.ContentIndex({ + enableSiteMap: true, + enableRSS: true, + }), ] }, } diff --git a/quartz/cfg.ts b/quartz/cfg.ts index bb097c95..1c9ece8f 100644 --- a/quartz/cfg.ts +++ b/quartz/cfg.ts @@ -3,12 +3,17 @@ import { PluginTypes } from "./plugins/types" import { Theme } from "./theme" export interface GlobalConfiguration { + pageTitle: string, /** Whether to enable single-page-app style rendering. this prevents flashes of unstyled content and improves smoothness of Quartz */ enableSPA: boolean, /** Whether to display Wikipedia-style popovers when hovering over links */ enablePopovers: boolean, /** Glob patterns to not search */ ignorePatterns: string[], + /** Base URL to use for CNAME files, sitemaps, and RSS feeds that require an absolute URL. + * Quartz will avoid using this as much as possible and use relative URLs most of the time + */ + canonicalUrl?: string, theme: Theme } diff --git a/quartz/components/PageTitle.tsx b/quartz/components/PageTitle.tsx index e8377ee0..15cd4e47 100644 --- a/quartz/components/PageTitle.tsx +++ b/quartz/components/PageTitle.tsx @@ -1,22 +1,17 @@ import { resolveToRoot } from "../path" import { QuartzComponentConstructor, QuartzComponentProps } from "./types" -interface Options { - title: string +function PageTitle({ fileData, cfg }: QuartzComponentProps) { + const title = cfg?.pageTitle ?? "Untitled Quartz" + const slug = fileData.slug! + const baseDir = resolveToRoot(slug) + return

{title}

} -export default ((opts?: Options) => { - const title = opts?.title ?? "Untitled Quartz" - function PageTitle({ fileData }: QuartzComponentProps) { - const slug = fileData.slug! - const baseDir = resolveToRoot(slug) - return

{title}

- } - PageTitle.css = ` - .page-title { - margin: 0; - } - ` +PageTitle.css = ` +.page-title { + margin: 0; +} +` - return PageTitle -}) satisfies QuartzComponentConstructor +export default (() => PageTitle) satisfies QuartzComponentConstructor diff --git a/quartz/path.ts b/quartz/path.ts index 18d74d73..4755687e 100644 --- a/quartz/path.ts +++ b/quartz/path.ts @@ -27,6 +27,9 @@ export function slugify(s: string): string { // resolve /a/b/c to ../../ export function resolveToRoot(slug: string): string { let fp = trimPathSuffix(slug) + if (fp.endsWith("index")) { + fp = fp.slice(0, -"index".length) + } if (fp === "") { return "." diff --git a/quartz/plugins/emitters/cname.ts b/quartz/plugins/emitters/cname.ts deleted file mode 100644 index c783dfb6..00000000 --- a/quartz/plugins/emitters/cname.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { QuartzEmitterPlugin } from "../types" - -interface Options { - domain: string -} - -export const CNAME: QuartzEmitterPlugin = (opts?: Options) => ({ - name: "CNAME", - getQuartzComponents() { - return [] - }, - async emit(_contentFolder, _cfg, _content, _resources, emit): Promise { - const slug = "CNAME" - - if (opts?.domain) { - await emit({ - content: opts?.domain, - slug, - ext: "", - }) - } - - return ["CNAME"] - } -}) diff --git a/quartz/plugins/emitters/contentIndex.ts b/quartz/plugins/emitters/contentIndex.ts index cd7c9245..f75334a4 100644 --- a/quartz/plugins/emitters/contentIndex.ts +++ b/quartz/plugins/emitters/contentIndex.ts @@ -1,37 +1,120 @@ +import { GlobalConfiguration } from "../../cfg" import { QuartzEmitterPlugin } from "../types" import path from "path" export type ContentIndex = Map export type ContentDetails = { title: string, - links?: string[], - tags?: string[], + links: string[], + tags: string[], content: string, + date?: Date, + description?: string, } -export const ContentIndex: QuartzEmitterPlugin = () => { +interface Options { + enableSiteMap: boolean + enableRSS: boolean +} + +const defaultOptions: Options = { + enableSiteMap: true, + enableRSS: true, +} + +function generateSiteMap(cfg: GlobalConfiguration, idx: ContentIndex): string { + const base = cfg.canonicalUrl ?? "" + const createURLEntry = (slug: string, content: ContentDetails): string => ` + https://${base}/${slug} + ${content.date?.toISOString()} + ` + const urls = Array.from(idx).map(([slug, content]) => createURLEntry(slug, content)).join("") + return `${urls}` +} + +function generateRSSFeed(cfg: GlobalConfiguration, idx: ContentIndex): string { + const base = cfg.canonicalUrl ?? "" + const root = `https://${base}` + + // TODO: ogimage + const createURLEntry = (slug: string, content: ContentDetails): string => ` + ${content.title} + ${root}/${slug} + ${root}/${slug} + ${content.description} + ${content.date?.toUTCString()} + ` + + const items = Array.from(idx).map(([slug, content]) => createURLEntry(slug, content)).join("") + return ` + + ${cfg.pageTitle} + ${root} + Recent content on ${cfg.pageTitle} + Quartz -- quartz.jzhao.xyz + + + ${items} + ` +} + +export const ContentIndex: QuartzEmitterPlugin = (opts) => { + opts = { ...defaultOptions, ...opts } return { name: "ContentIndex", - async emit(_contentDir, _cfg, content, _resources, emit) { - const fp = path.join("static", "contentIndex") + async emit(_contentDir, cfg, content, _resources, emit) { + const emitted: string[] = [] const linkIndex: ContentIndex = new Map() for (const [_tree, file] of content) { - let slug = file.data.slug! + const slug = file.data.slug! + const date = file.data.dates?.modified ?? new Date() linkIndex.set(slug, { title: file.data.frontmatter?.title!, links: file.data.links ?? [], - tags: file.data.frontmatter?.tags, - content: file.data.text ?? "" + tags: file.data.frontmatter?.tags ?? [], + content: file.data.text ?? "", + date: date, + description: file.data.description ?? "" }) } + if (opts?.enableSiteMap) { + await emit({ + content: generateSiteMap(cfg, linkIndex), + slug: "sitemap", + ext: ".xml" + }) + emitted.push("sitemap.xml") + } + + if (opts?.enableRSS) { + await emit({ + content: generateRSSFeed(cfg, linkIndex), + slug: "index", + ext: ".xml" + }) + emitted.push("index.xml") + } + + const fp = path.join("static", "contentIndex") + const simplifiedIndex = Object.fromEntries( + Array.from(linkIndex).map(([slug, content]) => { + // remove description and from content index as nothing downstream + // actually uses it. we only keep it in the index as we need it + // for the RSS feed + delete content.description + delete content.date + return [slug, content] + }) + ) await emit({ - content: JSON.stringify(Object.fromEntries(linkIndex)), + content: JSON.stringify(simplifiedIndex), slug: fp, ext: ".json", }) + emitted.push(`${fp}.json`) - return [`${fp}.json`] + return emitted }, getQuartzComponents: () => [], } diff --git a/quartz/plugins/emitters/index.ts b/quartz/plugins/emitters/index.ts index ff684d52..435771d2 100644 --- a/quartz/plugins/emitters/index.ts +++ b/quartz/plugins/emitters/index.ts @@ -3,4 +3,3 @@ export { TagPage } from './tagPage' export { FolderPage } from './folderPage' export { ContentIndex } from './contentIndex' export { AliasRedirects } from './aliases' -export { CNAME } from './cname' diff --git a/quartz/plugins/index.ts b/quartz/plugins/index.ts index ae4593f1..88158113 100644 --- a/quartz/plugins/index.ts +++ b/quartz/plugins/index.ts @@ -50,6 +50,11 @@ export function emitComponentResources(cfg: GlobalConfiguration, resources: Stat componentResources.afterDOMLoaded.push(afterDOMLoaded) } } + + if (cfg.enablePopovers) { + componentResources.afterDOMLoaded.push(popoverScript) + componentResources.css.push(popoverStyle) + } if (cfg.enableSPA) { componentResources.afterDOMLoaded.push(spaRouterScript) @@ -61,11 +66,6 @@ export function emitComponentResources(cfg: GlobalConfiguration, resources: Stat ) } - if (cfg.enablePopovers) { - componentResources.afterDOMLoaded.push(popoverScript) - componentResources.css.push(popoverStyle) - } - emit({ slug: "index", ext: ".css", diff --git a/quartz/plugins/transformers/description.ts b/quartz/plugins/transformers/description.ts index 0e41c5bc..cc207697 100644 --- a/quartz/plugins/transformers/description.ts +++ b/quartz/plugins/transformers/description.ts @@ -10,6 +10,10 @@ const defaultOptions: Options = { descriptionLength: 150 } +const escapeHTML = (unsafe: string) => { + return unsafe.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>').replaceAll('"', '"').replaceAll("'", '''); +} + export const Description: QuartzTransformerPlugin | undefined> = (userOpts) => { const opts = { ...defaultOptions, ...userOpts } return { @@ -19,7 +23,7 @@ export const Description: QuartzTransformerPlugin | undefined> () => { return async (tree: HTMLRoot, file) => { const frontMatterDescription = file.data.frontmatter?.description - const text = toString(tree) + const text = escapeHTML(toString(tree)) const desc = frontMatterDescription ?? text const sentences = desc.replace(/\s+/g, ' ').split('.')