feat(docs): create sukr documentation site

Self-documenting docs site built with sukr itself (dogfooding):
- docs/site.toml with sukr.io base URL
- docs-specific templates with sidebar navigation
- Dark theme CSS, responsive layout
- Documentation: getting-started, configuration, features

Also: improved error chaining for better template debugging
This commit is contained in:
Timothy DeHerrera
2026-01-31 15:58:37 -07:00
parent 0516bfc600
commit 8c806d1654
18 changed files with 801 additions and 8 deletions

View File

@@ -42,12 +42,16 @@ pub enum Error {
Config { path: PathBuf, message: String },
/// Failed to load templates.
#[error("failed to load templates: {message}")]
TemplateLoad { message: String },
#[error("failed to load templates: {0}")]
TemplateLoad(#[source] tera::Error),
/// Failed to render template.
#[error("failed to render template '{template}': {message}")]
TemplateRender { template: String, message: String },
#[error("failed to render template '{template}'")]
TemplateRender {
template: String,
#[source]
source: tera::Error,
},
}
/// Result type alias for compiler operations.

View File

@@ -35,6 +35,12 @@ fn main() {
Ok(Some(config_path)) => {
if let Err(e) = run(&config_path) {
eprintln!("error: {e}");
// Print full error chain
let mut source = std::error::Error::source(&e);
while let Some(cause) = source {
eprintln!(" caused by: {cause}");
source = std::error::Error::source(cause);
}
std::process::exit(1);
}
}

View File

@@ -18,9 +18,7 @@ impl TemplateEngine {
/// Load templates from a directory (glob pattern: `templates/**/*`).
pub fn new(template_dir: &Path) -> Result<Self> {
let pattern = template_dir.join("**/*").display().to_string();
let tera = Tera::new(&pattern).map_err(|e| Error::TemplateLoad {
message: e.to_string(),
})?;
let tera = Tera::new(&pattern).map_err(Error::TemplateLoad)?;
Ok(Self { tera })
}
@@ -30,7 +28,7 @@ impl TemplateEngine {
.render(template_name, context)
.map_err(|e| Error::TemplateRender {
template: template_name.to_string(),
message: e.to_string(),
source: e,
})
}