Commit Graph

20 Commits

Author SHA1 Message Date
Timothy DeHerrera
69cd81621f feat(docs): create sukr documentation site with fixes
Self-documenting docs site built with sukr itself (dogfooding):

Core changes:
- Rename package from nrd-sh to sukr
- Move personal site to sites/nrd.sh/
- Update AGENTS.md and README.md

Documentation site (docs/):
- Add site.toml with sukr.io base URL
- Create docs-specific templates with sidebar navigation
- Add dark theme CSS with syntax highlighting colors
- Document all features: templates, sections, syntax highlighting,
  mermaid diagrams, and LaTeX math rendering

Bug fixes:
- Render individual pages for all sections (not just blog type)
- Add #[source] error chaining for Tera template errors
- Print full error chain in main() for better debugging
2026-01-31 16:14:04 -07:00
Timothy DeHerrera
8c806d1654 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
2026-01-31 15:58:37 -07:00
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
4c2c3d5495 feat(cli): add configurable paths and --config flag
Enable monorepo support with CLI configuration:

- Add PathsConfig struct with serde defaults for content, output,
  static, and templates directories
- Add optional [paths] table to site.toml (backward compatible)
- Add -c/--config <FILE> flag to specify config file path
- Add -h/--help flag with usage information
- Resolve all paths relative to config file location

Users can now run multiple sites from a single repo:

  nrd-sh                             # uses ./site.toml
  nrd-sh -c sites/blog/site.toml     # looks in sites/blog/

Includes 2 new unit tests for path configuration parsing.
2026-01-31 15:26:22 -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
1bf265f14b fix(feed): derive URLs from content paths
Replace hardcoded "/blog/{slug}.html" URL pattern with dynamic
path derivation using Content.output_path(). This ensures feed
URLs work correctly for any content location, not just blog posts.
2026-01-31 13:59:05 -07:00
Timothy DeHerrera
a5c56c2b2f feat(templates,main): wire dynamic nav through pipeline
Update all template functions to accept nav parameter and iterate
over discovered NavItem slice instead of hardcoded links.

Refactor main.rs:
- Call discover_nav() early in run()
- Thread nav to all template renders
- Replace hardcoded page list with dynamic discovery

Navigation is now fully driven by filesystem structure.
2026-01-31 13:56:16 -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
51b947256d feat: add Atom feed generation
- src/feed.rs: New module with generate_atom_feed() that produces
  Atom 1.0 XML from blog posts. Uses config.base_url for absolute
  entry URLs. Includes xml_escape() helper.

- src/main.rs: Wire mod feed and call generate_feed() after blog
  index generation. Outputs to public/feed.xml.

- src/templates.rs: Add <link rel="alternate" type="application/atom+xml">
  autodiscovery link to page head using config.base_url.

Feed includes title, author, updated timestamp, and entries with
title, link, id, updated, and summary for each blog post.
2026-01-24 22:01:59 -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
71d5ac1e37 refactor: switch to flat .html output (suckless style)
- src/content.rs: output_path() now returns slug.html instead of
  slug/index.html for regular content.

- src/templates.rs: All hrefs use explicit .html extension.
  Nav links point to index.html, blog.index.html, about.html.
  Blog post links use ./slug.html format.

- src/main.rs: Adjust depth values (root=0, blog posts=1).

No more directory-per-page overhead. file:// navigation works
without directory listings. True suckless structure.
2026-01-24 21:36:58 -07:00
Timothy DeHerrera
b9be21156d feat: implement relative paths for IPFS/decentralization
- src/templates.rs: Add depth parameter to all template functions.
  Add relative_prefix() helper that generates "./", "../", "../..", etc.
  All hrefs now use relative paths instead of absolute.
  Unit test for relative_prefix() added.

- src/main.rs: Pass depth to templates based on output location.
  Root=0, blog index/pages=1, blog posts=2.

Navigation works correctly when viewed via file:// protocol.
Site is now IPFS-compatible.
2026-01-24 21:22:03 -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
5317da94c4 feat: add minimal base CSS with dark mode support
- static/style.css: CSS variable-based theming with:
  - Typography (system fonts, monospace for code)
  - Layout (centered content, nav/main/footer structure)
  - Dark mode via prefers-color-scheme
  - Component styles (posts, cards, tags, hero)

- src/main.rs: Add copy_static_assets() to copy static/
  directory to public/ during build

Phase 1 complete. Ready for syntax highlighting.
2026-01-24 20:27:22 -07:00
Timothy DeHerrera
06b7e0df64 feat: implement cohesive site structure
Add content type handling and multi-page generation:

- content.rs: Add ContentKind enum (Post, Page, Section, Project)
  and extend Frontmatter with weight/link_to fields
- templates.rs: Add render_page, render_homepage,
  render_blog_index, render_projects_index templates
- main.rs: Process all content types with dedicated handlers

Output structure:
- /index.html (homepage from _index.md)
- /blog/index.html (post listing, sorted by date)
- /blog/<slug>/index.html (individual posts)
- /about/index.html, /collab/index.html (standalone pages)
- /projects/index.html (project cards with external links)
2026-01-24 19:19:53 -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