Commit Graph

14 Commits

Author SHA1 Message Date
Timothy DeHerrera
e1ee18ca8a feat: rename project from nrd-sh to sukr
sukr = suckless + Rust. Minimal static site compiler.

- Update Cargo.toml name and description
- Update main.rs USAGE and doc comments
- Update AGENTS.md with new name, Tera architecture
- Create README.md with quick start guide
2026-01-31 15:46:26 -07:00
Timothy DeHerrera
e200e94583 feat(templates): complete Tera migration, remove maud
Fully migrate from compile-time maud templates to runtime Tera:
- Rewrote main.rs to use TemplateEngine and discover_sections()
- Replaced hardcoded blog/projects with generic section loop
- Added Clone derive to Frontmatter and Content
- Fixed section_type dispatch via Section struct
- Deleted src/templates.rs, removed maud dependency

Users can now add sections without code changes.
2026-01-31 15:10:39 -07:00
Timothy DeHerrera
3df7fda26a feat(templates): add Tera runtime template engine
Lay groundwork for user-editable templates by adding Tera as a
runtime template engine alongside the existing maud templates.

Changes:
- Add tera dependency
- Create TemplateEngine struct with render methods
- Add TemplateLoad/TemplateRender error variants
- Add section_type/template fields to Frontmatter
- Create templates/ directory with base, page, section, and content templates

Dead code warnings are expected; TemplateEngine will be wired
in to replace maud in subsequent commits.
2026-01-31 14:59:49 -07:00
Timothy DeHerrera
b978edf4f2 feat(content): add filesystem-driven nav discovery
Add NavItem struct and discover_nav() function to scan content
directory and automatically build navigation from:
- Top-level .md files (pages)
- Directories with _index.md (sections)

Navigation is sorted by frontmatter weight, then alphabetically.
Custom nav_label field allows overriding title in nav menu.

Includes 5 unit tests covering page/section discovery, weight
ordering, and nav_label support.
2026-01-31 13:52:21 -07:00
Timothy DeHerrera
88b53b7a7b fix(mermaid): switch to crates.io and patch dagre_rust panic
Switch mermaid-rs-renderer from git dependency to crates.io 0.1.

Vendor and patch dagre_rust 0.0.5 to fix upstream panic in
remove_edge_label_proxies() where unwrap() is called on None
when processing edge label proxies without edge references.

This enables sequence diagrams and state diagrams that previously
crashed the build.
2026-01-28 20:52:05 -07:00
Timothy DeHerrera
abe465723c feat(mermaid): add mermaid-rs-renderer diagram module
Add src/mermaid.rs with render_diagram() wrapper around
mermaid-rs-renderer for build-time Mermaid-to-SVG conversion.

- Use mermaid-rs-renderer git dependency (SVG-only, no PNG)
- Configure with RenderOptions::modern() theme
- Include unit tests for flowchart and sequence diagrams
2026-01-28 20:31:40 -07:00
Timothy DeHerrera
ebe1fd3b6e feat(math): add katex-rs math rendering module
Add src/math.rs with render_math() wrapper around katex-rs for
build-time LaTeX to HTML conversion. Wire module into main.rs.

- Use KatexContext::default() for standard LaTeX function registry
- Settings: display_mode toggle, throw_on_error=false for graceful
  degradation
- Include unit tests for inline/display math rendering
2026-01-28 20:16:25 -07:00
Timothy DeHerrera
a7338f5418 feat: add Nix injection queries for embedded language highlighting
Adapted Helix nix/injections.scm for tree-sitter-highlight:
- Removed Helix-specific predicates
- Recognizes bash in buildPhase/installPhase, python in testScript,
  json in fromJSON, etc.
2026-01-26 23:54:59 -07:00
Timothy DeHerrera
acb0ff3e15 feat: add syntax highlighting for 9 additional languages
- Cargo.toml: Add tree-sitter grammars for Nix, Python, JavaScript,
  TypeScript, Go, C, CSS, HTML, YAML. Upgrade tree-sitter-highlight
  to 0.26 for language version 15 compatibility.

- src/highlight.rs: Add Language enum variants and get_config()
  match arms for all new languages. Update render() callback for
  0.26 API (writes attributes to buffer). Add tests for Nix and
  Python highlighting.

TOML excluded due to incompatible API (tree-sitter 0.20 vs 0.26).
2026-01-25 17:20:00 -07:00
Timothy DeHerrera
d166e86435 feat: add TOML site config for metadata
- Cargo.toml: Add toml and serde dependencies
- site.toml: New config with title, author, base_url
- src/config.rs: SiteConfig struct with load() function
- src/error.rs: Add Error::Config for parse errors
- src/main.rs: Load site.toml, thread config and page paths
  through generators
- src/templates.rs: Use config.title in nav/titles,
  config.author in footer, config.base_url for canonical URLs.

All three config fields verified in generated HTML output.
2026-01-24 21:47:47 -07:00
Timothy DeHerrera
7fa60d9b07 feat: add CSS minification via lightningcss
- Cargo.toml: Add lightningcss 1.0.0-alpha.70 dep
- src/css.rs: New module with minify_css() function.
  Uses StyleSheet::parse() + minify() + to_css() pipeline.
  3 unit tests: whitespace removal, comment removal, selector merge.
- src/main.rs: Integrate minification into copy_static_assets().
  CSS files minified before writing; size delta logged.

Result: style.css 5670→4165 bytes (~27% smaller)
2026-01-24 21:07:56 -07:00
Timothy DeHerrera
ba5e97dfb7 feat: add tree-sitter syntax highlighting module
- Cargo.toml: Add tree-sitter-highlight + grammar crates
  (rust, bash, json). TOML dropped due to API incompatibility.
- src/highlight.rs: Language enum, highlight_code() function,
  4 unit tests covering parsing and HTML generation.
- Uses static HTML_ATTRS array for zero-allocation rendering.
2026-01-24 20:38:02 -07:00
Timothy DeHerrera
e07a9e87e6 feat: implement core markdown rendering pipeline
Add minimal e2e pipeline to transform content → HTML:

- src/error.rs: Custom error types with thiserror
- src/content.rs: YAML frontmatter parsing via gray_matter
- src/render.rs: Markdown → HTML via pulldown-cmark
- src/templates.rs: Maud templates for base layout and posts
- src/main.rs: Pipeline orchestrator

All 15 blog posts successfully rendered to public/blog/*/index.html.
Added thiserror and walkdir dependencies.
Added public/ and DepMap fragment to .gitignore and AGENTS.md.
2026-01-24 19:01:30 -07:00
Timothy DeHerrera
0be71ca374 feat: initialize rust project scaffold
Add minimal Rust project structure for bespoke site compiler:

- rust-toolchain.toml: stable channel with rustfmt, clippy, rust-src
- Cargo.toml: nrd-sh v0.1.0 with pulldown-cmark, gray_matter, maud
- src/main.rs: stub entrypoint

Verified with cargo check.
2026-01-24 18:41:59 -07:00