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
# commentsare 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.