Crate nucleusflow

Source
Expand description

§NucleusFlow Library

NucleusFlow provides a suite of tools for processing, rendering, and generating content for static sites or other document-based applications. This library includes support for content transformation, template rendering, and output generation with a configurable pipeline for flexible usage.

For more information, visit the NucleusFlow documentation.

NucleusFlow logo

§NucleusFlow

A fast, flexible and secure static site generator written in Rust.

Made With Love Crates.io lib.rs Docs.rs Codecov Build Status GitHub

WebsiteDocumentationReport BugRequest FeatureContributing Guidelines

§Overview

NucleusFlow is a powerful content processing library and static site generator that prioritises security, performance and flexibility. Built in Rust, it offers a comprehensive toolkit for managing content lifecycles, from processing raw content to generating optimised static websites.

§Features

  • Secure Content Processing

    • Robust input validation and sanitisation
    • Path traversal protection
    • Memory-safe operations
    • Secure defaults for all operations
  • Flexible Content Pipeline

    • Markdown processing with frontmatter support
    • Template rendering with Handlebars
    • HTML generation with minification
    • Asset management and optimisation
  • Performance Optimised

    • Parallel processing capabilities
    • Efficient memory usage
    • Content caching
    • Minimal dependencies
  • Developer Experience

    • Intuitive CLI interface
    • Rich error messages
    • Extensive documentation
    • Type-safe configurations

§Installation

Add nucleusflow to your Cargo.toml:

[dependencies]
nucleusflow = "0.0.1"

§Usage

Here’s a basic example of how to use nucleusflow:

use nucleusflow::{NucleusFlow, NucleusFlowConfig, FileContentProcessor, HtmlOutputGenerator, HtmlTemplateRenderer};
use std::path::PathBuf;

// Create configuration
let config = NucleusFlowConfig::new(
    "content",
    "public",
    "templates"
).expect("Failed to create config");

// Initialize processors with the concrete implementations
let content_processor = FileContentProcessor::new(PathBuf::from("content"));
let template_renderer = HtmlTemplateRenderer::new(PathBuf::from("templates"));
let output_generator = HtmlOutputGenerator::new(PathBuf::from("public"));

// Create NucleusFlow instance
let nucleus = NucleusFlow::new(
    config,
    Box::new(content_processor),
    Box::new(template_renderer),
    Box::new(output_generator)
);

// Process content
nucleus.process().expect("Failed to process content");

§CLI Usage

# Create a new site
nucleusflow new my-site --template blog

# Build the site
nucleusflow build --content content/ --output public/

This example demonstrates setting up NucleusFlow with a Markdown processor, Handlebars templating, and HTML output generation.

§Documentation

For full API documentation, please visit docs.rs/nucleusflow.

§Examples

To explore more examples, clone the repository and run the following command:

cargo run --example example_name

§Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

§License

This project is licensed under either of

at your option.

§Acknowledgements

Special thanks to all contributors who have helped build the nucleusflow library.

Modules§

cli
Provides command-line interface utilities. Command-line interface for NucleusFlow
core
Module containing core utilities, such as configuration and error handling.
generators
Provides output generation utilities.
process
Provides processing pipeline utilities.
processors
Provides processors for content transformation.
template
Provides template rendering utilities.

Structs§

FileContentProcessor
Concrete implementation of ContentProcessor that processes file content.
HtmlOutputGenerator
Concrete implementation of Generator for generating HTML files.
HtmlTemplateRenderer
Concrete implementation of TemplateRenderer for rendering HTML templates.
NucleusFlow
Main content processing pipeline for NucleusFlow.
NucleusFlowConfig
Configuration settings for NucleusFlow.

Traits§

ContentProcessor
Trait for content processing implementations.
TemplateRenderer
Trait for template rendering implementations.