This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Rustyll is a blazing fast, Jekyll-compatible static site generator written in Rust. It aims to provide Jekyll compatibility while offering 10-100x faster build times through Rust's performance advantages.
# Build the project (debug mode)
cargo build
# Build for release with optimizations
cargo build --release
# Run the development version
cargo run -- [COMMAND]
# Build a site (default command)
cargo run -- build
# Or with explicit paths
cargo run -- build -s ./source -d ./destination
# Serve site with development server
cargo run -- serve
# With live reload
cargo run -- serve --livereload
# Clean build artifacts
cargo run -- clean
# Generate site report
cargo run -- report --verbose# Run all tests
cargo test
# Run a specific test
cargo test test_name
# Run tests with output
cargo test -- --nocapture
# Check code without building
cargo check
# Format code
cargo fmt
# Run linter with suggestions
cargo clippy
# Run clippy with all targets
cargo clippy --all-targets --all-featuresThe codebase is organized into distinct modules, each handling specific responsibilities:
-
builder/: Core site building logicsite/builder.rs: Main build orchestration, processes all content and generates the static sitesite/processor.rs: Content processing pipeline (markdown, liquid, front matter)page/: Individual page building and renderingwatcher/: File system watching for incremental builds
-
liquid/: Liquid templating engine integrationtags/: Custom Liquid tags (include, highlight, link, raw)filters/: Custom Liquid filters (markdownify, relative_url, absolute_url, date_to_string)preprocess.rs: Template preprocessing and optimization
-
markdown/: Markdown processingrenderer/: Markdown to HTML rendering with syntax highlighting supporttoc/: Table of contents generation and parsingengine/comrak.rs: Comrak markdown parser integration
-
collections/: Content collections managementdocument/: Document model and loader with front matter parsingdata/: Data file loading (YAML, JSON, CSV)
-
front_matter/: Front matter extraction and parsingparser/: YAML/TOML/JSON front matter parsersextractor.rs: Front matter extraction from content filesdefaults.rs: Default front matter values and merging
-
config/: Configuration managementloader.rs: Config file loading and validationtypes.rs: Configuration data structuresdefaults/: Default configuration values
-
server/: Development servercore/server.rs: Axum-based HTTP servermiddleware/: Security, caching, compression middleware
-
plugins/: Plugin system for extensibilityhooks.rs: Hook system for plugin integration pointsloader.rs: Dynamic plugin loadingregistry.rs: Plugin registration and management
-
Jekyll Compatibility: The architecture maintains Jekyll's directory structure (_posts, _layouts, _includes) and Liquid templating to ensure easy migration.
-
Parallel Processing: Uses Rayon for parallel content processing, significantly improving build times for large sites.
-
Incremental Builds: Tracks file modifications to rebuild only changed content.
-
Plugin Architecture: Extensible through a hook-based plugin system that allows customizing the build process at various stages.
- Load configuration from
_config.yml - Scan source directory for content files
- Extract and parse front matter
- Process Liquid templates (with includes resolution)
- Render Markdown to HTML
- Apply layouts hierarchically
- Write to destination directory
- Templates are resolved from
_includes/and_layouts/directories - Custom tags and filters are registered during initialization
- Context includes site data, page variables, and collection data
- Parallel file processing using Rayon
- Lazy loading of large data files
- Efficient front matter extraction without full file parsing
- Cached template compilation
The project follows Jekyll's directory structure:
_config.yml: Site configuration_posts/: Blog posts with date-prefixed filenames_layouts/: Page layout templates_includes/: Reusable template fragments_data/: Data files (YAML, JSON, CSV)_site/: Generated output (default destination)assets/: Static assets (CSS, JS, images)
Tests are embedded within modules using #[test] attributes. Key test areas:
- Front matter parsing (
src/front_matter/) - Markdown rendering (
src/markdown/) - Plugin system (
src/plugins/) - Middleware (
src/server/middleware/)
Run tests for specific modules:
cargo test front_matter
cargo test markdown
cargo test plugins