Website & Docs Generation
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
Website and documentation generation in Graphite encompasses the project's public web presence and the automated derivation of technical documentation from source code. The system is split between a static site generator (Zola) for the main website and custom Rust tooling (node-docs) that extracts metadata from the Graphene node engine to generate a comprehensive "Node Catalog."
The primary goal of this system is to maintain an up-to-date user manual and contributor guide while ensuring that technical details—such as node inputs, outputs, and types—remain synchronized with the actual implementation in the Rust codebase. Sources: tools/node-docs/src/main.rs, website/templates/base.html
Automated Node Documentation (node-docs)
The node-docs tool is a specialized utility designed to generate Markdown files for the Graphite user manual's node catalog. It queries the NODE_METADATA registry within the graphene_std crate to programmatically build a structured documentation hierarchy. Sources: tools/node-docs/src/main.rs:18-20, tools/node-docs/src/page_catalog.rs
Documentation Hierarchy
The generator produces a three-tier documentation structure:
- Node Catalog Index: A high-level overview of all available node categories.
- Category Pages: Detailed lists of nodes within a specific functional group (e.g., "General", "Image").
- Node Pages: Granular documentation for individual nodes, including their interface, parameters, and valid data types.
Sources: tools/node-docs/src/main.rs:32-48
This diagram shows the flow of metadata from the Rust registry into specific Markdown generation modules.
Data Extraction and Processing
The tool iterates through registered nodes and groups them by their metadata category. It uses the convert_case crate to transform display names into kebab-case for URL-safe file paths. Sources: tools/node-docs/src/main.rs:22-45
| Component | Responsibility | Relevant File |
|---|---|---|
write_catalog_index_page | Creates the root _index.md for the catalog. | page_catalog.rs |
write_category_index_page | Creates directory structure and index for categories. | page_category.rs |
write_node_page | Generates technical interface details for a single node. | page_node.rs |
Node Interface Generation
The most complex part of the documentation system is the page_node.rs module, which translates Rust types and metadata into human-readable Markdown tables. Sources: tools/node-docs/src/page_node.rs
Interface Tables
For every node, the generator builds tables for "Inputs" and "Outputs." It extracts:
- Parameter Names: The name of the input field.
- Details: Descriptions, default values, and whether the input is primary or exposed by default.
- Possible Types: A list of valid concrete types accepted by that specific implementation.
Sources: tools/node-docs/src/page_node.rs:91-135
Implementation Logic
Sequence of events when generating a single node's documentation page.
Sources: tools/node-docs/src/page_node.rs:13-43
Static Website Architecture
The Graphite website uses the Zola static site generator, utilizing Tera templates (HTML with specific macros) and Markdown content files. Sources: website/templates/base.html, website/content/volunteer/_index.md
Template System
The base.html file serves as the master layout. It includes logic for:
- Asset Management: Dynamically loading CSS and JS based on page-specific frontmatter.
- Replacement Macros: Using custom filters to inject dynamic content like blog posts or the crate hierarchy diagram.
- Navigation: Providing a consistent header and footer across the site, including links to "Learn," "Features," and "Volunteer."
Sources: website/templates/base.html:1-120
Content Organization
The website content is organized into logical sections:
- /learn: The user manual and tutorials. Sources: website/content/learn/_index.md
- /volunteer: Information for contributors, including coding and art tasks. Sources: website/content/volunteer/_index.md
- /blog: Progress reports and project announcements. Sources: website/content/blog/2024-07-31-graphite-progress-report-q2-2024.md
Resource Loading Configuration
The template system allows pages to specify their own styling and scripts via TOML frontmatter:
+++
title = "Volunteer"
[extra]
css = ["/page/volunteer.css", "/component/feature-box.css"]
+++
Sources: website/content/volunteer/_index.md:1-6
Summary
The Website & Docs Generation system in Graphite ensures that high-quality documentation is not an afterthought but a side-effect of development. By leveraging Rust's type system and metadata via the node-docs tool, the project maintains a technically accurate Node Catalog. Simultaneously, the Zola-based website infrastructure provides a performant, template-driven platform for user-facing content and community engagement. Sources: tools/node-docs/src/main.rs, website/templates/base.html