diff --git a/AGENTS.md b/AGENTS.md index f609c49..cbeb05e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -34,13 +34,13 @@ The agent MUST read and adhere to the global engineering ruleset and any active ## Project Overview -**nrd.sh** is a bespoke static site compiler written in Rust. It transforms Markdown content into a minimal, high-performance static site with zero client-side dependencies. +**sukr** is a minimal static site compiler written in Rust. Suckless, zero JS, transforms Markdown into high-performance static HTML. ### Philosophy - **Suckless:** No bloated runtimes, no unnecessary JavaScript - **Hermetic:** Single binary with all dependencies compiled in -- **Elegant:** Syntax highlighting via Tree-sitter +- **Elegant:** Syntax highlighting via Tree-sitter, templates via Tera ### Architecture @@ -50,7 +50,7 @@ The compiler implements an **Interceptor Pipeline**: 2. **Stream:** Feed Markdown to `pulldown-cmark` event parser 3. **Intercept:** Route code blocks to Tree-sitter, Mermaid, KaTeX 4. **Render:** Push modified events to HTML writer -5. **Layout:** Wrap in `maud` templates +5. **Layout:** Wrap in Tera templates (runtime, user-customizable) 6. **Write:** Output to `public/` --- @@ -65,7 +65,12 @@ cargo run # Run compiler (builds site to public/) # Production nix build # Build hermetic release binary -./result/bin/nrd-sh # Run release compiler +./result/bin/sukr # Run release compiler + +# CLI Usage +sukr # Build with ./site.toml +sukr -c sites/blog/site.toml # Build with custom config +sukr --help # Show usage ``` --- @@ -85,15 +90,17 @@ nix build # Build hermetic release binary . ├── Cargo.toml # Rust manifest ├── flake.nix # Nix build environment -├── site.toml # Site configuration +├── site.toml # Site configuration (or in sites/*) ├── src/ │ ├── main.rs # Pipeline orchestrator │ ├── config.rs # TOML config loader +│ ├── content.rs # Content discovery, sections +│ ├── template_engine.rs # Tera template engine │ ├── feed.rs # Atom feed generation │ ├── highlight.rs # Tree-sitter highlighting -│ ├── render.rs # Pulldown-cmark interception -│ └── templates.rs # Maud HTML templates -├── content/ # Blog content (Markdown + YAML frontmatter) +│ └── render.rs # Pulldown-cmark interception +├── templates/ # Tera templates (base, page, section/*) +├── content/ # Markdown + YAML frontmatter ├── static/ # CSS, images, _headers └── public/ # Generated output ``` @@ -121,7 +128,13 @@ nix build # Build hermetic release binary Site configuration lives in `site.toml`: ```toml -title = "nrd.sh" -author = "nrdxp" -base_url = "https://nrd.sh/" +title = "My Site" +author = "Author Name" +base_url = "https://example.com" + +[paths] # All optional, defaults shown +content = "content" +output = "public" +static = "static" +templates = "templates" ``` diff --git a/Cargo.lock b/Cargo.lock index 74b37eb..a2188a0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -839,37 +839,6 @@ dependencies = [ "thiserror 1.0.69", ] -[[package]] -name = "nrd-sh" -version = "0.1.0" -dependencies = [ - "gray_matter", - "katex-rs", - "lightningcss", - "mermaid-rs-renderer", - "pulldown-cmark", - "serde", - "tempfile", - "tera", - "thiserror 2.0.18", - "toml 0.8.23", - "tree-sitter", - "tree-sitter-bash", - "tree-sitter-c", - "tree-sitter-css", - "tree-sitter-go", - "tree-sitter-highlight", - "tree-sitter-html", - "tree-sitter-javascript", - "tree-sitter-json", - "tree-sitter-nix", - "tree-sitter-python", - "tree-sitter-rust", - "tree-sitter-typescript", - "tree-sitter-yaml", - "walkdir", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -1539,6 +1508,37 @@ dependencies = [ "syn 2.0.114", ] +[[package]] +name = "sukr" +version = "0.1.0" +dependencies = [ + "gray_matter", + "katex-rs", + "lightningcss", + "mermaid-rs-renderer", + "pulldown-cmark", + "serde", + "tempfile", + "tera", + "thiserror 2.0.18", + "toml 0.8.23", + "tree-sitter", + "tree-sitter-bash", + "tree-sitter-c", + "tree-sitter-css", + "tree-sitter-go", + "tree-sitter-highlight", + "tree-sitter-html", + "tree-sitter-javascript", + "tree-sitter-json", + "tree-sitter-nix", + "tree-sitter-python", + "tree-sitter-rust", + "tree-sitter-typescript", + "tree-sitter-yaml", + "walkdir", +] + [[package]] name = "syn" version = "1.0.109" diff --git a/Cargo.toml b/Cargo.toml index bc1c998..b20e4f2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [package] -description = "Bespoke static site compiler for nrd.sh" +description = "Minimal static site compiler — suckless, Rust, zero JS" edition = "2024" license = "MIT" -name = "nrd-sh" +name = "sukr" version = "0.1.0" [dependencies] diff --git a/README.md b/README.md new file mode 100644 index 0000000..2f22cc7 --- /dev/null +++ b/README.md @@ -0,0 +1,59 @@ +# sukr + +**Minimal static site compiler — suckless, Rust, zero JS.** + +sukr transforms Markdown content into high-performance static HTML. No bloated runtimes, no unnecessary JavaScript, just clean output. + +## Features + +- **Build-time rendering** — Syntax highlighting via Tree-sitter, no client JS +- **Tera templates** — Runtime customizable, no recompilation needed +- **Convention over configuration** — Add sections by creating directories +- **Monorepo support** — Multiple sites via `-c` flag + +## Quick Start + +```bash +# Build +cargo build --release + +# Run (uses ./site.toml) +sukr + +# Custom config (monorepo) +sukr -c sites/blog/site.toml + +# Help +sukr --help +``` + +## Configuration + +Create `site.toml`: + +```toml +title = "My Site" +author = "Your Name" +base_url = "https://example.com" + +[paths] # All optional +content = "content" # default +output = "public" # default +static = "static" # default +templates = "templates" # default +``` + +## Content Structure + +``` +content/ +├── _index.md # Homepage +├── about.md # Standalone page → /about.html +└── blog/ + ├── _index.md # Section index → /blog/index.html + └── my-post.md # Post → /blog/my-post.html +``` + +## License + +MIT diff --git a/src/main.rs b/src/main.rs index 230be41..243de52 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ -//! nrd.sh - Bespoke static site compiler. +//! sukr - Minimal static site compiler. //! -//! Transforms markdown content into a minimal static site. +//! Suckless, Rust, zero JS. Transforms markdown into static HTML. mod config; mod content; @@ -20,10 +20,10 @@ use std::fs; use std::path::{Path, PathBuf}; const USAGE: &str = "\ -nrd-sh - Bespoke static site compiler +sukr - Minimal static site compiler USAGE: - nrd-sh [OPTIONS] + sukr [OPTIONS] OPTIONS: -c, --config Path to site.toml config file (default: ./site.toml)