Expand description
With Shtola, you can build your own static site generators easily. All that Shtola itself does is read files and frontmatter, run them through a bunch of user-provided plugins, and write the result back to disk.
As a demonstration of Shtola’s basic piping feature, see this example:
use shtola::Shtola;
let mut m = Shtola::new();
m.source("../fixtures/simple");
m.destination("../fixtures/dest/doctest_example");
m.clean(true);
m.build().unwrap();A “plugin” is just a boxed function that takes a RefMut to an IR (intermediate
representation) struct. The plugin may modify the IR freely:
use shtola::{Plugin, ShFile, RefIR};
fn plugin() -> Plugin {
Box::new(|mut ir: RefIR| {
ir.files.insert("myFile".into(), ShFile::empty());
})
}Re-exports§
pub use log;pub use serde_json as json;
Modules§
Structs§
- Config
- Configuration struct.
- HashMap
- A hash map implemented with quadratic probing and SIMD lookup.
- IR
- The intermediate representation that’s passed to plugins. Includes global metadata, the files with frontmatter and the global config.
- ShFile
- Shtola’s file representation, with frontmatter included.
- Shtola
- The main library struct.
- Ware
- A middleware chain.