This document describes the YAML-based format for representing hierarchies (class inheritance, filesystem trees, etc.) in Redis documentation.
Hierarchies are written in YAML format within a code block with the language identifier hierarchy. The render hook preserves the YAML source for AI agents while JavaScript generates a visual diagram for users.
Parent:
Child1:
Child2:
Grandchild1:
Grandchild2:This represents:
Parent
├── Child1
├── Child2
│ ├── Grandchild1
│ └── Grandchild2
Use quotes for names containing special characters (spaces, punctuation, etc.):
"Top-level folder":
"file1.js":
"file2.png":
"Inner folder":
"file3.jpg":This is especially important for:
- Filenames with extensions (
.js,.png, etc.) - Names with spaces
- Names with hyphens or other punctuation
Add metadata to any item using the special _meta key:
"Exception":
_meta:
description: "Base exception class"
"RuntimeException":
"IOException":Currently supported metadata fields:
description: A brief description of the item (displayed as italic text after the item name)link: URL or relative path to make the item clickable (works in both SVG diagrams and AI agent processing)ellipsis: Boolean indicating this is a placeholder for omitted items
Add a link field to make items clickable:
"Documentation":
_meta:
link: "https://example.com/docs"
"Getting Started":
_meta:
link: "./getting-started.md"
"API Reference":
_meta:
link: "./api-reference.md"The link field:
- Works with both absolute URLs and relative paths
- Makes the item clickable in SVG diagrams (for users)
- Provides navigation information for AI agents
- Can be combined with
descriptionfor additional context
Use an ellipsis item to indicate that some items are not shown:
"RedisError":
"ConnectionError":
"ResponseError":
"InvalidResponse":
"...":
_meta:
ellipsis: true
description: "Other exception types"The _meta with ellipsis: true tells the renderer to display this as "..." and not expand it further. The ellipsis item is rendered with a dotted vertical line below it to indicate continuation. You can optionally add a description to provide context about the omitted items.
"RedisError":
_meta:
description: "Base class for all redis-py exceptions"
"ConnectionError":
_meta:
description: "Connection-related errors"
"TimeoutError":
"BusyLoadingError":
"ResponseError":
"InvalidResponse":
"DataError":
"PubSubError":
"...":
_meta:
ellipsis: true
description: "Other exception types"This represents an exception hierarchy with:
- A base exception class with description
- Nested exception types
- An ellipsis indicating additional exception types not shown
"(root)":
"config.yaml":
_meta:
description: "Main configuration file"
"jobs":
_meta:
description: "Folder containing job definitions"
"default-job.yaml":
_meta:
description: "Default job configuration"
"job1.yaml":
"...":
_meta:
ellipsis: true
description: "Other job files"This represents a filesystem structure with:
- A root folder containing configuration files
- Nested directories and files
- Descriptions for each item
- An ellipsis indicating additional files not shown
When type="filesystem" is used, the renderer displays file and folder icons next to each item.
```hierarchy {type="filesystem"}
Parent:
Child1:
Child2:
```
-
type(optional): Indicates the kind of hierarchy. Common values:type="exception"- Exception/error hierarchytype="filesystem"- Filesystem or directory structuretype="generic"- Generic hierarchy (default if omitted)
The type helps the renderer apply appropriate styling and helps AI agents understand the context.
-
noicons(optional): Disables icon rendering for filesystem hierarchies. Usenoicons="true"to hide file/folder icons.- Only applies to
type="filesystem" - Default: icons are shown
- Only applies to
Place the hierarchy code block where you want the diagram to appear in the rendered HTML. The render hook will:
- Preserve the YAML source in a
<pre>element (for AI agents) - Generate a visual diagram below it (for users with JavaScript)
- Use clear, descriptive names
- Use quotes for any names with special characters
- Keep names concise but meaningful
- Order items logically (alphabetically, by importance, etc.)
- Use ellipsis to indicate omitted items rather than showing everything
- Group related items together
- Add metadata only when it provides useful information
- Use consistent metadata field names across similar hierarchies
- Keep descriptions brief (one sentence)
| Field | Type | Purpose | Example |
|---|---|---|---|
description |
string | Brief description of the item (displayed as italic text) | "Base exception class" |
link |
string | URL or relative path to make the item clickable | "./api-reference.md" or "https://example.com" |
ellipsis |
boolean | Marks as placeholder for omitted items | true |
- The
descriptionfield is displayed as italic text after the item name in the rendered diagram - The
linkfield makes items clickable in SVG diagrams and provides navigation for AI agents - The
ellipsisfield should be set totruefor items representing omitted content (typically named"...") - Multiple metadata fields can be combined (e.g.,
description+link) - Other metadata fields may be added in the future
The render hook generates a visual SVG diagram with:
- ASCII art-style tree structure with indented text
- Connected tree lines showing parent-child relationships
- File and folder icons for filesystem hierarchies (when
type="filesystem") - Descriptions displayed as italic text after item names
- Dotted vertical lines for ellipsis items indicating continuation
- Space Mono font matching Redis documentation style
AI agents accessing the .html.md version see the raw YAML:
- Clean, structured format
- Easy to parse and understand
- Metadata preserved for context
- Descriptions available for understanding item purposes
The YAML must be valid according to the YAML 1.2 specification:
- Proper indentation (spaces, not tabs)
- Quoted strings for special characters
- Valid YAML syntax
Invalid YAML will cause rendering errors. Use a YAML validator to check your syntax.
See the following files for real-world examples:
content/develop/clients/redis-py/error-handling.md- Exception hierarchy with descriptionscontent/integrate/redis-data-integration/data-pipelines/_index.md- Filesystem hierarchy with file/folder icons