@quartz-community/recent-notes 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,19 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+
12
+ - Respect the `file.data.unlisted` convention. Pages marked `unlisted` are never shown in the recent notes list. The unlisted filter runs before any user-supplied `opts.filter`.
13
+ - Exported `filterListedPages` helper for reuse and testing.
14
+ - Unit tests for `filterListedPages`.
15
+ - New `hideTagPages` option (default `false`) that excludes tag index pages (slugs under the `tags/` prefix) from the recent notes list. The filter runs before any user-supplied `opts.filter`.
16
+ - New `hideFolderPages` option (default `false`) that excludes folder index pages (slugs matching Quartz's folder-path convention) from the recent notes list. The filter runs before any user-supplied `opts.filter`.
17
+ - Exported `isTagPageSlug` and `isFolderPageSlug` helpers for reuse and testing, plus unit tests for both.
18
+
19
+ - Initial Quartz community plugin template.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Quartz Community
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # @quartz-community/recent-notes
2
+
3
+ Displays a list of recently modified or created notes.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npx quartz plugin add github:quartz-community/recent-notes
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```yaml title="quartz.config.yaml"
14
+ plugins:
15
+ - source: github:quartz-community/recent-notes
16
+ enabled: true
17
+ ```
18
+
19
+ For advanced use cases, you can override in TypeScript:
20
+
21
+ ```ts title="quartz.ts (override)"
22
+ import * as ExternalPlugin from "./.quartz/plugins";
23
+
24
+ ExternalPlugin.RecentNotes({
25
+ title: "Recent Notes",
26
+ limit: 3,
27
+ showTags: true,
28
+ linkToMore: false,
29
+ });
30
+ ```
31
+
32
+ ## Configuration
33
+
34
+ | Option | Type | Default | Description |
35
+ | ----------------- | ----------------- | ----------------------- | ---------------------------------------------------------------------------------- |
36
+ | `title` | `string` | `undefined` | The title of the recent notes section. |
37
+ | `limit` | `number` | `3` | The maximum number of notes to display. |
38
+ | `linkToMore` | `string \| false` | `false` | A link to a page with more notes, or `false` to disable. |
39
+ | `showTags` | `boolean` | `true` | Whether to display tags for each note. |
40
+ | `hideTagPages` | `boolean` | `false` | Hide generated tag pages (slugs under `tags/`) from the list. |
41
+ | `hideFolderPages` | `boolean` | `false` | Hide generated folder index pages (slugs ending in `/` or `/index`) from the list. |
42
+ | `filter` | `function` | `() => true` | A function to filter the notes. |
43
+ | `sort` | `function` | `byDateAndAlphabetical` | A function to sort the notes. |
44
+
45
+ ## Documentation
46
+
47
+ See the [Quartz documentation](https://quartz.jzhao.xyz/features/recent%20notes) for more information.
48
+
49
+ ## License
50
+
51
+ MIT
@@ -0,0 +1,2 @@
1
+ export { RecentNotes, RecentNotesOptions } from '../index.js';
2
+ import '@quartz-community/types';
@@ -0,0 +1,541 @@
1
+ // node_modules/@quartz-community/utils/dist/date.js
2
+ function formatDate(d2, locale = "en-US") {
3
+ return d2.toLocaleDateString(locale, {
4
+ year: "numeric",
5
+ month: "short",
6
+ day: "2-digit"
7
+ });
8
+ }
9
+
10
+ // node_modules/@quartz-community/utils/dist/sort.js
11
+ function getDate(data) {
12
+ const defaultDateType = data.defaultDateType;
13
+ if (!defaultDateType) {
14
+ return void 0;
15
+ }
16
+ const dates = data.dates;
17
+ return dates?.[defaultDateType];
18
+ }
19
+ function byDateAndAlphabetical() {
20
+ return (f1, f22) => {
21
+ const f1Date = getDate(f1);
22
+ const f2Date = getDate(f22);
23
+ if (f1Date && f2Date) {
24
+ return f2Date.getTime() - f1Date.getTime();
25
+ } else if (f1Date && !f2Date) {
26
+ return -1;
27
+ } else if (!f1Date && f2Date) {
28
+ return 1;
29
+ }
30
+ const f1Title = (f1.frontmatter?.title ?? "").toLowerCase();
31
+ const f2Title = (f22.frontmatter?.title ?? "").toLowerCase();
32
+ return f1Title.localeCompare(f2Title);
33
+ };
34
+ }
35
+
36
+ // node_modules/@quartz-community/utils/dist/path.js
37
+ function endsWith(s2, suffix) {
38
+ return s2 === suffix || s2.endsWith("/" + suffix);
39
+ }
40
+ function isFolderPath(fplike) {
41
+ return fplike.endsWith("/") || endsWith(fplike, "index") || endsWith(fplike, "index.md") || endsWith(fplike, "index.html");
42
+ }
43
+
44
+ // node_modules/@quartz-community/utils/dist/lang.js
45
+ function classNames(...classes) {
46
+ return classes.filter(Boolean).join(" ");
47
+ }
48
+
49
+ // src/i18n/locales/en-US.ts
50
+ var en_US_default = {
51
+ components: {
52
+ recentNotes: {
53
+ title: "Recent Notes",
54
+ seeRemainingMore: ({ remaining }) => `See ${remaining} more \u2192`
55
+ }
56
+ }
57
+ };
58
+
59
+ // src/i18n/locales/ar-SA.ts
60
+ var ar_SA_default = {
61
+ components: {
62
+ recentNotes: {
63
+ title: "\u0622\u062E\u0631 \u0627\u0644\u0645\u0644\u0627\u062D\u0638\u0627\u062A",
64
+ seeRemainingMore: ({ remaining }) => `\u062A\u0635\u0641\u062D ${remaining} \u0623\u0643\u062B\u0631 \u2192`
65
+ }
66
+ }
67
+ };
68
+
69
+ // src/i18n/locales/ca-ES.ts
70
+ var ca_ES_default = {
71
+ components: {
72
+ recentNotes: {
73
+ title: "Notes Recents",
74
+ seeRemainingMore: ({ remaining }) => `Vegi ${remaining} m\xE9s \u2192`
75
+ }
76
+ }
77
+ };
78
+
79
+ // src/i18n/locales/cs-CZ.ts
80
+ var cs_CZ_default = {
81
+ components: {
82
+ recentNotes: {
83
+ title: "Nejnov\u011Bj\u0161\xED pozn\xE1mky",
84
+ seeRemainingMore: ({ remaining }) => `Zobraz ${remaining} dal\u0161\xEDch \u2192`
85
+ }
86
+ }
87
+ };
88
+
89
+ // src/i18n/locales/de-DE.ts
90
+ var de_DE_default = {
91
+ components: {
92
+ recentNotes: {
93
+ title: "Zuletzt bearbeitete Seiten",
94
+ seeRemainingMore: ({ remaining }) => `${remaining} weitere ansehen \u2192`
95
+ }
96
+ }
97
+ };
98
+
99
+ // src/i18n/locales/en-GB.ts
100
+ var en_GB_default = {
101
+ components: {
102
+ recentNotes: {
103
+ title: "Recent Notes",
104
+ seeRemainingMore: ({ remaining }) => `See ${remaining} more \u2192`
105
+ }
106
+ }
107
+ };
108
+
109
+ // src/i18n/locales/es-ES.ts
110
+ var es_ES_default = {
111
+ components: {
112
+ recentNotes: {
113
+ title: "Notas Recientes",
114
+ seeRemainingMore: ({ remaining }) => `Vea ${remaining} m\xE1s \u2192`
115
+ }
116
+ }
117
+ };
118
+
119
+ // src/i18n/locales/fa-IR.ts
120
+ var fa_IR_default = {
121
+ components: {
122
+ recentNotes: {
123
+ title: "\u06CC\u0627\u062F\u062F\u0627\u0634\u062A\u200C\u0647\u0627\u06CC \u0627\u062E\u06CC\u0631",
124
+ seeRemainingMore: ({ remaining }) => `${remaining} \u06CC\u0627\u062F\u062F\u0627\u0634\u062A \u062F\u06CC\u06AF\u0631 \u2192`
125
+ }
126
+ }
127
+ };
128
+
129
+ // src/i18n/locales/fi-FI.ts
130
+ var fi_FI_default = {
131
+ components: {
132
+ recentNotes: {
133
+ title: "Viimeisimm\xE4t muistiinpanot",
134
+ seeRemainingMore: ({ remaining }) => `N\xE4yt\xE4 ${remaining} lis\xE4\xE4 \u2192`
135
+ }
136
+ }
137
+ };
138
+
139
+ // src/i18n/locales/fr-FR.ts
140
+ var fr_FR_default = {
141
+ components: {
142
+ recentNotes: {
143
+ title: "Notes R\xE9centes",
144
+ seeRemainingMore: ({ remaining }) => `Voir ${remaining} de plus \u2192`
145
+ }
146
+ }
147
+ };
148
+
149
+ // src/i18n/locales/he-IL.ts
150
+ var he_IL_default = {
151
+ components: {
152
+ recentNotes: {
153
+ title: "\u05D4\u05E2\u05E8\u05D5\u05EA \u05D0\u05D7\u05E8\u05D5\u05E0\u05D5\u05EA",
154
+ seeRemainingMore: ({ remaining }) => `\u05E2\u05D9\u05D9\u05DF \u05D1 ${remaining} \u05E0\u05D5\u05E1\u05E4\u05D9\u05DD \u2192`
155
+ }
156
+ }
157
+ };
158
+
159
+ // src/i18n/locales/hu-HU.ts
160
+ var hu_HU_default = {
161
+ components: {
162
+ recentNotes: {
163
+ title: "Legut\xF3bbi jegyzetek",
164
+ seeRemainingMore: ({ remaining }) => `${remaining} tov\xE1bbi megtekint\xE9se \u2192`
165
+ }
166
+ }
167
+ };
168
+
169
+ // src/i18n/locales/id-ID.ts
170
+ var id_ID_default = {
171
+ components: {
172
+ recentNotes: {
173
+ title: "Catatan Terbaru",
174
+ seeRemainingMore: ({ remaining }) => `Lihat ${remaining} lagi \u2192`
175
+ }
176
+ }
177
+ };
178
+
179
+ // src/i18n/locales/it-IT.ts
180
+ var it_IT_default = {
181
+ components: {
182
+ recentNotes: {
183
+ title: "Note recenti",
184
+ seeRemainingMore: ({ remaining }) => remaining === 1 ? "Vedi 1 altra \u2192" : `Vedi altre ${remaining} \u2192`
185
+ }
186
+ }
187
+ };
188
+
189
+ // src/i18n/locales/ja-JP.ts
190
+ var ja_JP_default = {
191
+ components: {
192
+ recentNotes: {
193
+ title: "\u6700\u8FD1\u306E\u8A18\u4E8B",
194
+ seeRemainingMore: ({ remaining }) => `\u3055\u3089\u306B${remaining}\u4EF6 \u2192`
195
+ }
196
+ }
197
+ };
198
+
199
+ // src/i18n/locales/kk-KZ.ts
200
+ var kk_KZ_default = {
201
+ components: {
202
+ recentNotes: {
203
+ title: "\u0421\u043E\u04A3\u0493\u044B \u0436\u0430\u0437\u0431\u0430\u043B\u0430\u0440",
204
+ seeRemainingMore: ({ remaining }) => `\u0422\u0430\u0493\u044B ${remaining} \u0436\u0430\u0437\u0431\u0430\u043D\u044B \u049B\u0430\u0440\u0430\u0443 \u2192`
205
+ }
206
+ }
207
+ };
208
+
209
+ // src/i18n/locales/ko-KR.ts
210
+ var ko_KR_default = {
211
+ components: {
212
+ recentNotes: {
213
+ title: "\uCD5C\uADFC \uAC8C\uC2DC\uAE00",
214
+ seeRemainingMore: ({ remaining }) => `${remaining}\uAC74 \uB354\uBCF4\uAE30 \u2192`
215
+ }
216
+ }
217
+ };
218
+
219
+ // src/i18n/locales/lt-LT.ts
220
+ var lt_LT_default = {
221
+ components: {
222
+ recentNotes: {
223
+ title: "Naujausi U\u017Era\u0161ai",
224
+ seeRemainingMore: ({ remaining }) => `Per\u017Ei\u016Br\u0117ti dar ${remaining} \u2192`
225
+ }
226
+ }
227
+ };
228
+
229
+ // src/i18n/locales/nb-NO.ts
230
+ var nb_NO_default = {
231
+ components: {
232
+ recentNotes: {
233
+ title: "Nylige notater",
234
+ seeRemainingMore: ({ remaining }) => `Se ${remaining} til \u2192`
235
+ }
236
+ }
237
+ };
238
+
239
+ // src/i18n/locales/nl-NL.ts
240
+ var nl_NL_default = {
241
+ components: {
242
+ recentNotes: {
243
+ title: "Recente notities",
244
+ seeRemainingMore: ({ remaining }) => `Zie ${remaining} meer \u2192`
245
+ }
246
+ }
247
+ };
248
+
249
+ // src/i18n/locales/pl-PL.ts
250
+ var pl_PL_default = {
251
+ components: {
252
+ recentNotes: {
253
+ title: "Najnowsze notatki",
254
+ seeRemainingMore: ({ remaining }) => `Zobacz ${remaining} nastepnych \u2192`
255
+ }
256
+ }
257
+ };
258
+
259
+ // src/i18n/locales/pt-BR.ts
260
+ var pt_BR_default = {
261
+ components: {
262
+ recentNotes: {
263
+ title: "Notas recentes",
264
+ seeRemainingMore: ({ remaining }) => `Veja mais ${remaining} \u2192`
265
+ }
266
+ }
267
+ };
268
+
269
+ // src/i18n/locales/ro-RO.ts
270
+ var ro_RO_default = {
271
+ components: {
272
+ recentNotes: {
273
+ title: "Noti\u021Be recente",
274
+ seeRemainingMore: ({ remaining }) => `Vezi \xEEnc\u0103 ${remaining} \u2192`
275
+ }
276
+ }
277
+ };
278
+
279
+ // src/i18n/locales/ru-RU.ts
280
+ var ru_RU_default = {
281
+ components: {
282
+ recentNotes: {
283
+ title: "\u041D\u0435\u0434\u0430\u0432\u043D\u0438\u0435 \u0437\u0430\u043C\u0435\u0442\u043A\u0438",
284
+ seeRemainingMore: ({ remaining }) => `\u041F\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C \u043E\u0441\u0442\u0430\u0432\u0448${getForm(remaining, "\u0443\u044E\u0441\u044F", "\u0438\u0435\u0441\u044F", "\u0438\u0435\u0441\u044F")} ${remaining} \u2192`
285
+ }
286
+ }
287
+ };
288
+ function getForm(number, form1, form2, form5) {
289
+ const remainder100 = number % 100;
290
+ const remainder10 = remainder100 % 10;
291
+ if (remainder100 >= 10 && remainder100 <= 20) return form5;
292
+ if (remainder10 > 1 && remainder10 < 5) return form2;
293
+ if (remainder10 == 1) return form1;
294
+ return form5;
295
+ }
296
+
297
+ // src/i18n/locales/th-TH.ts
298
+ var th_TH_default = {
299
+ components: {
300
+ recentNotes: {
301
+ title: "\u0E1A\u0E31\u0E19\u0E17\u0E36\u0E01\u0E25\u0E48\u0E32\u0E2A\u0E38\u0E14",
302
+ seeRemainingMore: ({ remaining }) => `\u0E14\u0E39\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E2D\u0E35\u0E01 ${remaining} \u0E23\u0E32\u0E22\u0E01\u0E32\u0E23 \u2192`
303
+ }
304
+ }
305
+ };
306
+
307
+ // src/i18n/locales/tr-TR.ts
308
+ var tr_TR_default = {
309
+ components: {
310
+ recentNotes: {
311
+ title: "Son Notlar",
312
+ seeRemainingMore: ({ remaining }) => `${remaining} tane daha g\xF6r \u2192`
313
+ }
314
+ }
315
+ };
316
+
317
+ // src/i18n/locales/uk-UA.ts
318
+ var uk_UA_default = {
319
+ components: {
320
+ recentNotes: {
321
+ title: "\u041E\u0441\u0442\u0430\u043D\u043D\u0456 \u043D\u043E\u0442\u0430\u0442\u043A\u0438",
322
+ seeRemainingMore: ({ remaining }) => `\u041F\u0435\u0440\u0435\u0433\u043B\u044F\u043D\u0443\u0442\u0438 \u0449\u0435 ${remaining} \u2192`
323
+ }
324
+ }
325
+ };
326
+
327
+ // src/i18n/locales/vi-VN.ts
328
+ var vi_VN_default = {
329
+ components: {
330
+ recentNotes: {
331
+ title: "Ghi ch\xFA g\u1EA7n \u0111\xE2y",
332
+ seeRemainingMore: ({ remaining }) => `Xem th\xEAm ${remaining} ghi ch\xFA \u2192`
333
+ }
334
+ }
335
+ };
336
+
337
+ // src/i18n/locales/zh-CN.ts
338
+ var zh_CN_default = {
339
+ components: {
340
+ recentNotes: {
341
+ title: "\u6700\u8FD1\u7684\u7B14\u8BB0",
342
+ seeRemainingMore: ({ remaining }) => `\u67E5\u770B\u66F4\u591A${remaining}\u7BC7\u7B14\u8BB0 \u2192`
343
+ }
344
+ }
345
+ };
346
+
347
+ // src/i18n/locales/zh-TW.ts
348
+ var zh_TW_default = {
349
+ components: {
350
+ recentNotes: {
351
+ title: "\u6700\u8FD1\u7684\u7B46\u8A18",
352
+ seeRemainingMore: ({ remaining }) => `\u67E5\u770B\u66F4\u591A ${remaining} \u7BC7\u7B46\u8A18 \u2192`
353
+ }
354
+ }
355
+ };
356
+
357
+ // src/i18n/index.ts
358
+ var locales = {
359
+ "en-US": en_US_default,
360
+ "ar-SA": ar_SA_default,
361
+ "ca-ES": ca_ES_default,
362
+ "cs-CZ": cs_CZ_default,
363
+ "de-DE": de_DE_default,
364
+ "en-GB": en_GB_default,
365
+ "es-ES": es_ES_default,
366
+ "fa-IR": fa_IR_default,
367
+ "fi-FI": fi_FI_default,
368
+ "fr-FR": fr_FR_default,
369
+ "he-IL": he_IL_default,
370
+ "hu-HU": hu_HU_default,
371
+ "id-ID": id_ID_default,
372
+ "it-IT": it_IT_default,
373
+ "ja-JP": ja_JP_default,
374
+ "kk-KZ": kk_KZ_default,
375
+ "ko-KR": ko_KR_default,
376
+ "lt-LT": lt_LT_default,
377
+ "nb-NO": nb_NO_default,
378
+ "nl-NL": nl_NL_default,
379
+ "pl-PL": pl_PL_default,
380
+ "pt-BR": pt_BR_default,
381
+ "ro-RO": ro_RO_default,
382
+ "ru-RU": ru_RU_default,
383
+ "th-TH": th_TH_default,
384
+ "tr-TR": tr_TR_default,
385
+ "uk-UA": uk_UA_default,
386
+ "vi-VN": vi_VN_default,
387
+ "zh-CN": zh_CN_default,
388
+ "zh-TW": zh_TW_default
389
+ };
390
+ function i18n(locale) {
391
+ return locales[locale] || en_US_default;
392
+ }
393
+ var l;
394
+ l = { __e: function(n2, l2, u3, t2) {
395
+ for (var i2, r2, o2; l2 = l2.__; ) if ((i2 = l2.__c) && !i2.__) try {
396
+ if ((r2 = i2.constructor) && null != r2.getDerivedStateFromError && (i2.setState(r2.getDerivedStateFromError(n2)), o2 = i2.__d), null != i2.componentDidCatch && (i2.componentDidCatch(n2, t2 || {}), o2 = i2.__d), o2) return i2.__E = i2;
397
+ } catch (l3) {
398
+ n2 = l3;
399
+ }
400
+ throw n2;
401
+ } }, "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Math.random().toString(8);
402
+
403
+ // node_modules/preact/jsx-runtime/dist/jsxRuntime.mjs
404
+ var f2 = 0;
405
+ function u2(e2, t2, n2, o2, i2, u3) {
406
+ t2 || (t2 = {});
407
+ var a2, c2, p2 = t2;
408
+ if ("ref" in p2) for (c2 in p2 = {}, t2) "ref" == c2 ? a2 = t2[c2] : p2[c2] = t2[c2];
409
+ var l2 = { type: e2, props: p2, key: n2, ref: a2, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --f2, __i: -1, __u: 0, __source: i2, __self: u3 };
410
+ if ("function" == typeof e2 && (a2 = e2.defaultProps)) for (c2 in a2) void 0 === p2[c2] && (p2[c2] = a2[c2]);
411
+ return l.vnode && l.vnode(l2), l2;
412
+ }
413
+
414
+ // node_modules/@quartz-community/utils/dist/index.js
415
+ function simplifySlug(fp) {
416
+ const res = stripSlashes(trimSuffix(fp, "index"), true);
417
+ return res.length === 0 ? "/" : res;
418
+ }
419
+ function joinSegments(...args) {
420
+ if (args.length === 0) {
421
+ return "";
422
+ }
423
+ let joined = args.filter((segment) => segment !== "" && segment !== "/").map((segment) => stripSlashes(segment)).join("/");
424
+ const first = args[0];
425
+ const last = args[args.length - 1];
426
+ if (first?.startsWith("/")) {
427
+ joined = "/" + joined;
428
+ }
429
+ if (last?.endsWith("/")) {
430
+ joined = joined + "/";
431
+ }
432
+ return joined;
433
+ }
434
+ function endsWith2(s2, suffix) {
435
+ return s2 === suffix || s2.endsWith("/" + suffix);
436
+ }
437
+ function trimSuffix(s2, suffix) {
438
+ if (endsWith2(s2, suffix)) {
439
+ s2 = s2.slice(0, -suffix.length);
440
+ }
441
+ return s2;
442
+ }
443
+ function stripSlashes(s2, onlyStripPrefix) {
444
+ if (s2.startsWith("/")) {
445
+ s2 = s2.substring(1);
446
+ }
447
+ if (!onlyStripPrefix && s2.endsWith("/")) {
448
+ s2 = s2.slice(0, -1);
449
+ }
450
+ return s2;
451
+ }
452
+
453
+ // src/util/path.ts
454
+ function simplifySlug2(fp) {
455
+ return simplifySlug(fp);
456
+ }
457
+ function resolveRelative(current, target) {
458
+ const simplified = simplifySlug2(target);
459
+ const rootPath = pathToRoot(current);
460
+ return joinSegments(rootPath, simplified);
461
+ }
462
+ function pathToRoot(slug2) {
463
+ let rootPath = slug2.split("/").filter((x2) => x2 !== "").slice(0, -1).map((_2) => "..").join("/");
464
+ if (rootPath.length === 0) {
465
+ rootPath = ".";
466
+ }
467
+ return rootPath;
468
+ }
469
+
470
+ // src/components/styles/recentNotes.scss
471
+ var recentNotes_default = ".recent-notes > h3 {\n margin: 0.5rem 0 0 0;\n font-size: 1rem;\n}\n.recent-notes > ul.recent-ul {\n list-style: none;\n margin-top: 1rem;\n padding-left: 0;\n}\n.recent-notes > ul.recent-ul > li {\n margin: 1rem 0;\n}\n.recent-notes > ul.recent-ul > li .section > .desc > h3 > a {\n background-color: transparent;\n}\n.recent-notes > ul.recent-ul > li .section > .meta {\n margin: 0 0 0.5rem 0;\n opacity: 0.6;\n}";
472
+
473
+ // src/components/RecentNotes.tsx
474
+ function resolveDefaultDateType(data, cfg) {
475
+ return data.defaultDateType ?? cfg.defaultDateType;
476
+ }
477
+ var withResolvedDateType = (data, cfg) => {
478
+ const resolved = resolveDefaultDateType(data, cfg);
479
+ if (!resolved) return data;
480
+ return { ...data, defaultDateType: resolved };
481
+ };
482
+ function filterListedPages(pages) {
483
+ return pages.filter((p2) => p2.unlisted !== true);
484
+ }
485
+ function isTagPageSlug(slug2) {
486
+ if (!slug2) return false;
487
+ return slug2 === "tags" || slug2 === "tags/index" || slug2.startsWith("tags/");
488
+ }
489
+ function isFolderPageSlug(slug2) {
490
+ if (!slug2) return false;
491
+ return isFolderPath(slug2);
492
+ }
493
+ var byDateAndAlphabeticalWithConfig = (cfg) => {
494
+ const sortFn = byDateAndAlphabetical();
495
+ return (f1, f22) => sortFn(
496
+ withResolvedDateType(f1, cfg),
497
+ withResolvedDateType(f22, cfg)
498
+ );
499
+ };
500
+ var defaultOptions = (cfg) => ({
501
+ limit: 3,
502
+ linkToMore: false,
503
+ showTags: true,
504
+ hideTagPages: false,
505
+ hideFolderPages: false,
506
+ filter: () => true,
507
+ sort: byDateAndAlphabeticalWithConfig(cfg)
508
+ });
509
+ var RecentNotes_default = ((userOpts) => {
510
+ const RecentNotes = ({
511
+ allFiles,
512
+ fileData,
513
+ displayClass,
514
+ cfg
515
+ }) => {
516
+ const opts = { ...defaultOptions(cfg), ...userOpts };
517
+ const pages = filterListedPages(allFiles).filter((p2) => !opts.hideTagPages || !isTagPageSlug(p2.slug)).filter((p2) => !opts.hideFolderPages || !isFolderPageSlug(p2.slug)).filter(opts.filter).sort(opts.sort);
518
+ const remaining = Math.max(0, pages.length - opts.limit);
519
+ const slug2 = fileData.slug;
520
+ const locale = cfg.locale ?? "en-US";
521
+ return /* @__PURE__ */ u2("div", { class: classNames(displayClass, "recent-notes"), children: [
522
+ /* @__PURE__ */ u2("h3", { children: opts.title ?? i18n(locale).components.recentNotes.title }),
523
+ /* @__PURE__ */ u2("ul", { class: "recent-ul", children: pages.slice(0, opts.limit).map((page) => {
524
+ const title = page.frontmatter?.title ?? "Untitled";
525
+ const tags = page.frontmatter?.tags ?? [];
526
+ return /* @__PURE__ */ u2("li", { class: "recent-li", children: /* @__PURE__ */ u2("div", { class: "section", children: [
527
+ /* @__PURE__ */ u2("div", { class: "desc", children: /* @__PURE__ */ u2("h3", { children: /* @__PURE__ */ u2("a", { href: resolveRelative(slug2, page.slug), class: "internal", children: title }) }) }),
528
+ page.dates && getDate(withResolvedDateType(page, cfg)) && /* @__PURE__ */ u2("p", { class: "meta", children: /* @__PURE__ */ u2("time", { datetime: getDate(withResolvedDateType(page, cfg)).toISOString(), children: formatDate(getDate(withResolvedDateType(page, cfg)), locale) }) }),
529
+ opts.showTags && /* @__PURE__ */ u2("ul", { class: "tags", children: tags.map((tag) => /* @__PURE__ */ u2("li", { children: /* @__PURE__ */ u2("a", { class: "internal tag-link", href: resolveRelative(slug2, `tags/${tag}`), children: tag }) })) })
530
+ ] }) });
531
+ }) }),
532
+ opts.linkToMore && remaining > 0 && /* @__PURE__ */ u2("p", { children: /* @__PURE__ */ u2("a", { href: resolveRelative(slug2, opts.linkToMore), children: i18n(locale).components.recentNotes.seeRemainingMore({ remaining }) }) })
533
+ ] });
534
+ };
535
+ RecentNotes.css = recentNotes_default;
536
+ return RecentNotes;
537
+ });
538
+
539
+ export { RecentNotes_default as RecentNotes };
540
+ //# sourceMappingURL=index.js.map
541
+ //# sourceMappingURL=index.js.map