From d430bf75324744e68e99a3c68cd822d111af5638 Mon Sep 17 00:00:00 2001 From: Stephen Tse Date: Mon, 21 Apr 2025 01:28:11 -0700 Subject: [PATCH] Supposedly prettier --- docs/features/recent notes.md | 2 +- quartz/components/pages/FolderContent.tsx | 6 +++--- quartz/plugins/emitters/folderPage.tsx | 10 ++++------ 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/docs/features/recent notes.md b/docs/features/recent notes.md index 88aa38c45..86d0573f2 100644 --- a/docs/features/recent notes.md +++ b/docs/features/recent notes.md @@ -11,7 +11,7 @@ Quartz can generate a list of recent notes based on some filtering and sorting c - 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. - - See [[folder-and-tag-listings | Folder and Tag Listings]] for more information on the virtual global folder page you may link to. + - See [[folder-and-tag-listings | Folder and Tag Listings]] for more information on the virtual global folder page you may link to. - 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. - Component: `quartz/components/RecentNotes.tsx` diff --git a/quartz/components/pages/FolderContent.tsx b/quartz/components/pages/FolderContent.tsx index b5c6aef9a..4391cfd79 100644 --- a/quartz/components/pages/FolderContent.tsx +++ b/quartz/components/pages/FolderContent.tsx @@ -32,7 +32,7 @@ export default ((opts?: Partial) => { const { tree, fileData, allFiles, cfg } = props const trie = (props.ctx.trie ??= trieFromAllFiles(allFiles)) - let folder : FileTrieNode | undefined + let folder: FileTrieNode | undefined if (!fileData.isGlobalFolder) { folder = trie.findNode(fileData.slug!.split("/")) if (!folder) { @@ -42,7 +42,7 @@ export default ((opts?: Partial) => { const allPagesInFolder: QuartzPluginData[] = fileData.isGlobalFolder ? allFiles - : folder!.children + : (folder!.children .map((node) => { // regular file, proceed if (node.data) { @@ -92,7 +92,7 @@ export default ((opts?: Partial) => { } } }) - .filter((page) => page !== undefined) ?? [] + .filter((page) => page !== undefined) ?? []) const cssClasses: string[] = fileData.frontmatter?.cssclasses ?? [] const classes = cssClasses.join(" ") const listProps = { diff --git a/quartz/plugins/emitters/folderPage.tsx b/quartz/plugins/emitters/folderPage.tsx index 8400ae8ae..554170ac7 100644 --- a/quartz/plugins/emitters/folderPage.tsx +++ b/quartz/plugins/emitters/folderPage.tsx @@ -26,7 +26,7 @@ interface FolderPageOptions extends FullPageLayout { /** * If set, generates a virtual global folder page with the given title * at the root of the site containing all non-generated posts. - * + * * Make sure the folder name does not conflict with existing absolute paths. */ globalFolderTitle?: string @@ -74,13 +74,11 @@ function computeFolderInfo( userOpts?: Partial, ): Record { // Fail fast if global folder slug conflicts with existing folders - const globalFolderSlug = userOpts?.globalFolderTitle?.toLowerCase() - .replaceAll(" ", "-") as SimpleSlug ?? null + const globalFolderSlug = + (userOpts?.globalFolderTitle?.toLowerCase().replaceAll(" ", "-") as SimpleSlug) ?? null if (globalFolderSlug) { if (folders.has(globalFolderSlug)) { - throw new Error( - `Global folder path "${globalFolderSlug}" conflicts with existing folder's.`, - ) + throw new Error(`Global folder path "${globalFolderSlug}" conflicts with existing folder's.`) } }