mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-26 22:34:06 -06:00
Supposedly prettier
This commit is contained in:
parent
e68749d6e4
commit
d430bf7532
@ -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 })`
|
- 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 })`
|
- 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.
|
- 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 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.
|
- 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`
|
- Component: `quartz/components/RecentNotes.tsx`
|
||||||
|
|||||||
@ -32,7 +32,7 @@ export default ((opts?: Partial<FolderContentOptions>) => {
|
|||||||
const { tree, fileData, allFiles, cfg } = props
|
const { tree, fileData, allFiles, cfg } = props
|
||||||
|
|
||||||
const trie = (props.ctx.trie ??= trieFromAllFiles(allFiles))
|
const trie = (props.ctx.trie ??= trieFromAllFiles(allFiles))
|
||||||
let folder : FileTrieNode<BuildTimeTrieData> | undefined
|
let folder: FileTrieNode<BuildTimeTrieData> | undefined
|
||||||
if (!fileData.isGlobalFolder) {
|
if (!fileData.isGlobalFolder) {
|
||||||
folder = trie.findNode(fileData.slug!.split("/"))
|
folder = trie.findNode(fileData.slug!.split("/"))
|
||||||
if (!folder) {
|
if (!folder) {
|
||||||
@ -42,7 +42,7 @@ export default ((opts?: Partial<FolderContentOptions>) => {
|
|||||||
|
|
||||||
const allPagesInFolder: QuartzPluginData[] = fileData.isGlobalFolder
|
const allPagesInFolder: QuartzPluginData[] = fileData.isGlobalFolder
|
||||||
? allFiles
|
? allFiles
|
||||||
: folder!.children
|
: (folder!.children
|
||||||
.map((node) => {
|
.map((node) => {
|
||||||
// regular file, proceed
|
// regular file, proceed
|
||||||
if (node.data) {
|
if (node.data) {
|
||||||
@ -92,7 +92,7 @@ export default ((opts?: Partial<FolderContentOptions>) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.filter((page) => page !== undefined) ?? []
|
.filter((page) => page !== undefined) ?? [])
|
||||||
const cssClasses: string[] = fileData.frontmatter?.cssclasses ?? []
|
const cssClasses: string[] = fileData.frontmatter?.cssclasses ?? []
|
||||||
const classes = cssClasses.join(" ")
|
const classes = cssClasses.join(" ")
|
||||||
const listProps = {
|
const listProps = {
|
||||||
|
|||||||
@ -74,13 +74,11 @@ function computeFolderInfo(
|
|||||||
userOpts?: Partial<FolderPageOptions>,
|
userOpts?: Partial<FolderPageOptions>,
|
||||||
): Record<SimpleSlug, ProcessedContent> {
|
): Record<SimpleSlug, ProcessedContent> {
|
||||||
// Fail fast if global folder slug conflicts with existing folders
|
// Fail fast if global folder slug conflicts with existing folders
|
||||||
const globalFolderSlug = userOpts?.globalFolderTitle?.toLowerCase()
|
const globalFolderSlug =
|
||||||
.replaceAll(" ", "-") as SimpleSlug ?? null
|
(userOpts?.globalFolderTitle?.toLowerCase().replaceAll(" ", "-") as SimpleSlug) ?? null
|
||||||
if (globalFolderSlug) {
|
if (globalFolderSlug) {
|
||||||
if (folders.has(globalFolderSlug)) {
|
if (folders.has(globalFolderSlug)) {
|
||||||
throw new Error(
|
throw new Error(`Global folder path "${globalFolderSlug}" conflicts with existing folder's.`)
|
||||||
`Global folder path "${globalFolderSlug}" conflicts with existing folder's.`,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user