From ef72f1bf707dca363cdab84da91e2acfaef8f276 Mon Sep 17 00:00:00 2001
From: Ammar Alakkad <am.alakkad@gmail.com>
Date: Mon, 30 Dec 2024 16:03:57 +0000
Subject: [PATCH] Fix ObsidianFlavoredMarkdown source link (#1694)
---
docs/features/explorer.md | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/docs/features/explorer.md b/docs/features/explorer.md
index f4d54fa..95878f7 100644
--- a/docs/features/explorer.md
+++ b/docs/features/explorer.md
@@ -26,7 +26,7 @@
title: "Explorer", // title of the explorer component
folderClickBehavior: "collapse", // what happens when you click a folder ("link" to navigate to folder page on click or "collapse" to collapse folder on click)
folderDefaultState: "collapsed", // default state of folders ("collapsed" or "open")
- useSavedState: true, // wether to use local storage to save "state" (which folders are opened) of explorer
+ useSavedState: true, // whether to use local storage to save "state" (which folders are opened) of explorer
// Sort order: folders first, then files. Sort folders and files alphabetically
sortFn: (a, b) => {
... // default implementation shown later
@@ -42,7 +42,7 @@
Want to customize it even more?
-- Removing table of contents: remove `Component.Explorer()` from `quartz.layout.ts`
+- Removing explorer: remove `Component.Explorer()` from `quartz.layout.ts`
- (optional): After removing the explorer component, you can move the [[table of contents | Table of Contents]] component back to the `left` part of the layout
- Changing `sort`, `filter` and `map` behavior: explained in [[#Advanced customization]]
- Component:
@@ -61,7 +61,7 @@
children: FileNode[] // children of current node
name: string // last part of slug
displayName: string // what actually should be displayed in the explorer
- file: QuartzPluginData | null // set if node is a file, see `QuartzPluginData` for more detail
+ file: QuartzPluginData | null // if node is a file, this is the file's metadata. See `QuartzPluginData` for more detail
depth: number // depth of current node
... // rest of implementation
@@ -167,6 +167,19 @@
You can customize this by changing the entries of the `omit` set. Simply add all folder or file names you want to remove.
+### Remove files by tag
+
+You can access the frontmatter of a file by `node.file?.frontmatter?`. This allows you to filter out files based on their frontmatter, for example by their tags.
+
+```ts title="quartz.layout.ts"
+Component.Explorer({
+ filterFn: (node) => {
+ // exclude files with the tag "explorerexclude"
+ return node.file?.frontmatter?.tags?.includes("explorerexclude") !== true
+ },
+})
+```
+
### Show every element in explorer
To override the default filter function that removes the `tags` folder from the explorer, you can set the filter function to `undefined`.
--
Gitblit v1.10.0