mirror of
https://github.com/quartz-community/explorer.git
synced 2026-11-16 23:53:51 +00:00
Quartz's default explorer plugin.
- TypeScript 84.5%
- SCSS 15.5%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| .changeset | ||
| .github/workflows | ||
| src | ||
| test | ||
| types | ||
| .eslintrc.json | ||
| .gitignore | ||
| .prettierignore | ||
| .prettierrc | ||
| CHANGELOG.md | ||
| LICENSE | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| tsconfig.build.json | ||
| tsconfig.json | ||
| tsup.config.ts | ||
| vitest.config.ts | ||
@quartz-community/explorer
The Explorer component for Quartz - navigate your digital garden with an interactive file tree.
Features
- 📁 Interactive folder tree with collapse/expand functionality
- 📱 Mobile-friendly slide-out navigation
- 💾 Persistent state (remembers open/closed folders)
- 🔗 Configurable folder click behavior (link or collapse)
- ⚡ Built-in search and overflow handling
Installation
npx quartz plugin add @quartz-community/explorer
Usage
This plugin is already enabled in the default quartz.config.yaml:
plugins:
- source: "@quartz-community/explorer"
enabled: true
options:
folderClickBehavior: link
folderDefaultState: collapsed
useSavedState: true
layout:
position: left
priority: 50
Callback options (sortFn, filterFn, mapFn) can't be expressed in YAML. Set them in a TypeScript override:
import * as ExternalPlugin from "./.quartz/plugins";
// Must be placed before loadQuartzConfig()
ExternalPlugin.Explorer({
mapFn: (node) => {
node.displayName = node.displayName.toUpperCase();
return node;
},
});
Configuration Options
interface ExplorerOptions {
/** Title displayed above the explorer (default: the localized "Explorer") */
title?: string;
/** Default state for folders: "collapsed" or "open" (default: "collapsed") */
folderDefaultState: "collapsed" | "open";
/** Behavior when clicking folders: "collapse" to toggle, "link" to navigate (default: "link") */
folderClickBehavior: "collapse" | "link";
/** Whether to persist folder state in localStorage (default: true) */
useSavedState: boolean;
/** Custom sort function for entries */
sortFn?: (a: FileTrieNode, b: FileTrieNode) => number;
/** Custom filter function for entries */
filterFn?: (node: FileTrieNode) => boolean;
/** Custom map function for transforming entries; returns the (modified) node */
mapFn?: (node: FileTrieNode) => FileTrieNode;
/** Order in which to apply filter, map, and sort (default: ["filter", "map", "sort"]) */
order?: Array<"filter" | "map" | "sort">;
}
Default Behavior
By default, the Explorer:
- Shows folders in a collapsed state
- Opens folders when clicked (navigates to index page)
- Saves folder states between sessions
- Excludes the "tags" folder from the tree
- Sorts folders first, then files alphabetically (with numeric ordering)
Development
This is a first-party Quartz community plugin. It serves as both:
- A production-ready Explorer component
- A reference implementation for building Quartz community plugins
Documentation
See the plugin page and the Explorer feature page in the Quartz documentation.
License
MIT