for-ais-only/BUILD_SYSTEM_ARCHITECTURE.md
The Redis documentation build system is a multi-stage pipeline that transforms Markdown source files into a static Hugo site with enhanced features like code examples, metadata, and interactive render hooks.
Source Markdown Files
↓
[1] Metadata Extraction & Validation
↓
[2] Code Example Processing
↓
[3] Hugo Build
↓
[4] Render Hook Processing
↓
Static HTML Site
Purpose: Extract and validate page-level metadata from Markdown frontmatter
Key Files:
build/local_examples.py - Extracts metadata from page frontmatterfor-ais-only/metadata_docs/PAGE_METADATA_FORMAT.md - Metadata format specificationWhat it does:
.md filesOutput: Validated metadata available to Hugo templates
Purpose: Extract, validate, and prepare code examples for rendering
Key Files:
build/components/example.py - Core example processing logicbuild/local_examples.py - Local example file handlingfor-ais-only/tcedocs/SPECIFICATION.md - Complete technical specificationfor-ais-only/tcedocs/README.md - User-facing guideWhat it does:
exid markers)Output: Processed examples with metadata ready for Hugo
Purpose: Generate static HTML from Markdown using Hugo templates
Key Files:
Makefile - Build orchestrationbuild/make.py - Python build utilitieslayouts/ - Hugo templates and render hookscontent/ - Markdown source filesWhat it does:
Output: Static HTML files with render hooks applied
Purpose: Transform specific Markdown elements into interactive components
Key Files:
layouts/_default/_markup/render-codeblock-*.html - Render hook templatesstatic/js/*.js - JavaScript for interactivityfor-ais-only/render_hook_docs/ - Render hook documentationImplemented Hooks:
What it does:
.html.md URLs)Output: Enhanced HTML with interactive components
All content is accessible without JavaScript. JavaScript enhances the experience but isn't required. Raw Markdown is always preserved in <pre> elements.
Hugo's .Page.Store is used to conditionally load JavaScript resources only when needed on a page, avoiding duplicate script loading.
<pre> elements<script type="application/json"> for static access.html.md URLs provide Markdown view of rendered pagesmake build # Full build
make dev # Development build with watch
make clean # Clean build artifacts
make test # Run tests
See Makefile for complete list of commands.
build/
├── components/ # Python code for example processing
│ ├── example.py # Core example logic
│ ├── component.py # Component base class
│ └── ...
├── jupyterize/ # Notebook conversion tool
├── make.py # Build utilities
├── local_examples.py # Local example handling
└── *.py # Other build scripts
layouts/
├── _default/
│ ├── baseof.html # Base template with conditional script loading
│ └── _markup/
│ ├── render-codeblock-checklist.html
│ ├── render-codeblock-hierarchy.html
│ └── render-codeblock-decision-tree.html
└── ...
static/js/
├── checklist.js
├── hierarchy.js
└── decision-tree.js
content/ # Markdown source files
Makefile - Build commandsbuild/make.py - Build utilities