Guide

File Tree

Use docspress/file-tree to show the relevant part of a repository or directory hierarchy. Two-space indentation defines depth, and a trailing / identifies a folder.

When to use it

Choose File Tree when location and nesting are part of the lesson. Use Fields / Schema for structured properties and Diagram for relationships among systems. Omit files that do not help the current task.

Write tree source

Use two spaces for each depth:

docs/
  index.md
  guides/
    publishing.md
package.json

Tabs normalize to two spaces. Nesting is capped at 12 levels. A label ending in / is a folder; other labels are files.

Attributes

Reference

File Tree attributes

Root, hierarchy, and disclosure behavior accepted by docspress/file-tree.
5 fields
root string

Plain-text label above the tree.

tree string required

Indentation-aware hierarchy with two spaces per depth and trailing slashes for folders.

caption string

Optional formatted explanation.

collapsible boolean

Uses native folder disclosures when a folder has children.

open boolean

Initial state of collapsible folders.

Creative examples

Focused documentation tree

repository/ File tree
  • docs/
    • index.md
    • guides/
      • continuous-sync.md
  • package.json
A relevant source tree.

Collapsed monorepo map

workspace/ File tree
  • apps/
    • docs-site/
      • package.json
    • admin/
      • package.json
  • packages/
    • blocks/
      • src/
    • sync-client/
      • src/
  • pnpm-workspace.yaml
Start collapsed when the hierarchy matters more than individual files.

Generated plugin package

docspress-blocks/ File tree
  • blocks/
    • api-request/
      • block.php
      • editor.js
      • style.css
      • view.js
  • assets/
    • code.css
  • includes/
    • code-surface.php
  • docspress-blocks.php
  • readme.txt
A non-collapsible release package keeps every relevant artifact visible.

Published behavior and accessibility

The tree uses nested semantic lists. Collapsible folders with children use native disclosure controls and honor the authored initial state. The figure receives an accessible file-tree label.

Keep the sample shallow and task-specific. If readers need to copy file contents, follow the tree with Colorful Code examples rather than placing content in the hierarchy.