docs: update ts-config override examples
This commit is contained in:
@@ -16,11 +16,20 @@ See [[plugins/Explorer]] for detailed usage information.
|
||||
|
||||
This plugin accepts the following configuration options:
|
||||
|
||||
**YAML options** (in `quartz.config.yaml`):
|
||||
|
||||
- `title`: The title of the explorer. Defaults to `Explorer`.
|
||||
- `folderClickBehavior`: The behavior when a folder is clicked. Can be `"link"` to navigate or `"collapse"` to toggle. Defaults to `collapse`.
|
||||
- `folderDefaultState`: The default state of folders. Can be `"collapsed"` or `"open"`. Defaults to `collapsed`.
|
||||
- `useSavedState`: Whether to use local storage to save the state of the explorer. Defaults to `true`.
|
||||
|
||||
**TS override options** (in `quartz.ts`, for callback functions that can't be expressed in YAML):
|
||||
|
||||
- `sortFn`: Custom sort function for ordering files and folders.
|
||||
- `filterFn`: Custom filter function to exclude specific nodes.
|
||||
- `mapFn`: Custom map function to transform node properties (e.g. display names).
|
||||
- `order`: Array controlling the order of operations. Defaults to `["filter", "map", "sort"]`.
|
||||
|
||||
### Default options
|
||||
|
||||
```yaml title="quartz.config.yaml"
|
||||
@@ -33,6 +42,21 @@ This plugin accepts the following configuration options:
|
||||
useSavedState: true
|
||||
```
|
||||
|
||||
### TS override example
|
||||
|
||||
```ts title="quartz.ts"
|
||||
import * as ExternalPlugin from "./.quartz/plugins"
|
||||
|
||||
ExternalPlugin.Explorer({
|
||||
mapFn: (node) => {
|
||||
node.displayName = node.displayName.toUpperCase()
|
||||
return node
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
See [[features/explorer#Advanced customization]] for more examples.
|
||||
|
||||
## API
|
||||
|
||||
- Category: Component
|
||||
|
||||
Reference in New Issue
Block a user