#Rust

Sukr: A Minimal Static Site Compiler That Actually Compiles Everything

Tech Essays Reporter
2 min read

Sukr is a Rust-based static site generator that compiles Markdown to HTML at build time, eliminating client-side JavaScript for syntax highlighting, math rendering, and diagrams.

The static site generator landscape is crowded with tools that promise speed and simplicity, yet most still punt the heavy lifting to the browser. They generate Markdown, then ship it to clients alongside megabytes of JavaScript for syntax highlighting, LaTeX rendering, and diagram generation. Sukr takes a different approach: it compiles everything at build time, producing truly static HTML with zero client-side JavaScript.

Built in Rust with a "suckless" philosophy, sukr transforms Markdown into high-performance static HTML through a pipeline that executes entirely during the build process. The tool leverages tree-sitter for syntax highlighting, ensuring proper parsing rather than brittle regular expressions. This means language injection works correctly—you can highlight Nix code blocks that contain Bash, or HTML that contains embedded JavaScript and CSS, without the parsing errors that plague regex-based highlighters.

The mathematics support exemplifies sukr's build-time philosophy. Rather than shipping KaTeX or MathJax to browsers, sukr renders LaTeX expressions to static HTML during compilation. A typical 300KB JavaScript bundle for math rendering simply doesn't exist in sukr sites. Similarly, Mermaid diagrams compile to inline SVG at build time, ensuring they load instantly without requiring any client-side processing.

Template flexibility comes through runtime Tera templates, which can be modified without recompiling the tool itself. This strikes a balance between the performance benefits of compiled templates and the convenience of dynamic template systems. The monorepo support through a -c configuration flag enables managing multiple sites from a single repository, useful for organizations or developers maintaining several related projects.

The quick start process reflects sukr's minimalist ethos. Installation requires only cargo install sukr, followed by creating a basic site structure with a site.toml configuration file. The entire setup process takes minutes, and the resulting sites are genuinely static—no JavaScript dependencies, no runtime processing, just HTML, CSS, and SVG.

This approach has significant implications for performance and accessibility. Sites built with sukr load instantly, work perfectly with JavaScript disabled, and avoid the cumulative layout shift that often plagues sites with client-side rendering. For documentation sites, blogs, and other content-focused projects, sukr offers a compelling alternative to heavier generators that trade build-time complexity for runtime dependencies.

The tool occupies an interesting niche between minimal Markdown processors and full-featured static site generators. It provides enough structure and features for real-world use—templates, configuration, multiple content types—while maintaining the performance and simplicity benefits of true static generation. As web performance concerns grow and the limitations of JavaScript-heavy sites become more apparent, tools like sukr that embrace the static web's original promise deserve attention.

For developers frustrated with the bloat in modern static site generators, sukr represents a return to first principles: content should be served as HTML, not as instructions for generating HTML in the browser. The Rust implementation ensures compilation is fast, the tree-sitter integration provides robust parsing, and the build-time processing guarantees that what you deploy is truly static.

Documentation | GitHub Repository

Comments

Loading comments...