Skip to content
Trees
Github.com

Trees (Project Structure)

What it is

Display a directory tree / project structure in a clean "file explorer" card. Void gives tree code blocks a glassy, monospace treatment with subtly dimmed comments.

When to use it

Use trees to show a project layout, a module graph, or a config hierarchy β€” anything that reads better as indented boxes-and-lines than as prose. Keep trees shallow and trimmed to the relevant paths; deep dumps are better left to generated tool output.

In Markdown

Wrap the tree in a tree fenced code block:

```tree
mkdocs-void/
β”œβ”€β”€ void/                          # Python package
β”‚   β”œβ”€β”€ __init__.py                  # Version (0.3.0)
β”‚   β”œβ”€β”€ templates/
β”‚   β”‚   β”œβ”€β”€ base.html
β”‚   β”‚   β”œβ”€β”€ main.html
β”‚   β”‚   └── partials/
β”‚   β”‚       β”œβ”€β”€ header.html
β”‚   β”‚       └── toc.html
β”‚   └── plugins/
β”‚       └── void_plugin.py         # MkDocs plugin
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ index.md
β”‚   └── components/
β”œβ”€β”€ mkdocs.yml
└── requirements.txt
```

Configuration

No configuration is needed β€” a fenced tree block is styled out of the box. To change the card's look, target the generated block in your custom stylesheet:

/* extra.css */
.highlight.language-tree {
  background: rgba(255, 255, 0, 0.04);
  border-color: var(--void-accent);
}

Live preview / screenshot

mkdocs-void/
β”œβ”€β”€ void/                          # Python package
β”‚   β”œβ”€β”€ __init__.py                  # Version (0.3.0)
β”‚   β”œβ”€β”€ templates/
β”‚   β”‚   β”œβ”€β”€ base.html
β”‚   β”‚   β”œβ”€β”€ main.html
β”‚   β”‚   └── partials/
β”‚   β”‚       β”œβ”€β”€ header.html
β”‚   β”‚       └── toc.html
β”‚   └── plugins/
β”‚       └── void_plugin.py         # MkDocs plugin
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ index.md
β”‚   └── components/
β”œβ”€β”€ mkdocs.yml
└── requirements.txt

Trees pair well with the Code Highlighting and Admonitions components. See CSS Classes in Markdown to attach your own classes.

Aligning comments

Pipe characters and spaces keep columns aligned. Use a monospace source editor; Void renders 1:1 with white-space: pre.

src/
β”œβ”€β”€ core/
β”‚   β”œβ”€β”€ engine.py        # entry point
β”‚   └── parser.py        # tokenizer
└── ui/
    β”œβ”€β”€ app.js           # main view
    └── styles.js        # tokens

Under the hood

  • Box-drawing support β€” β”œβ”€β”€, └──, β”‚ glyphs render crisply in a monospace font.
  • Dimmed comments β€” trailing # comments are shown in muted italic so they don't fight the tree lines.
  • File-explorer card β€” each tree is wrapped in a subtle glass panel with rounded corners.
  • Scrollable β€” long trees scroll horizontally instead of wrapping.

Accessibility notes

  • Content is real <pre> text, so the tree structure is selectable, copyable, and announced as code β€” no image or canvas fallback needed.
  • Comment dimming is paired with no information loss: the comment text remains in the source and is readable, just visually de-emphasized.