22 Commits

Author SHA1 Message Date
Timothy DeHerrera
16fed12273 feat!: replace YAML frontmatter with TOML
Replace hand-rolled YAML parser (70 lines) with serde-backed
toml::from_str<Frontmatter> (6 lines). Frontmatter delimiter
changes from --- to +++ (Hugo TOML convention).

New Frontmatter fields:
- draft: bool (#[serde(default)]) for draft filtering
- aliases: Vec<String> (#[serde(default)]) for URL redirects

Date field upgraded from Option<String> to Option<NaiveDate>
with custom deserializer for TOML native dates. Parse, don't
validate: invalid dates now fail at deserialization time.

Add chrono dependency with serde feature. Update cascade in
sitemap.rs (NaiveDate→String at boundary), template_engine.rs
(FrontmatterContext gains draft/aliases), and all 14 tests.

BREAKING CHANGE: Content files must use +++ TOML frontmatter
instead of --- YAML frontmatter.
2026-02-14 06:50:35 -07:00
Timothy DeHerrera
8e1f8cbb95 refactor(content): remove gray_matter, manual frontmatter
Implement extract_frontmatter (--- delimiters) and parse_frontmatter
(simple YAML key:value pairs). Handles taxonomies.tags for blog posts.
~70 lines replaces external dependency.
2026-02-05 23:59:53 -07:00
Timothy DeHerrera
8034e24f75 refactor(main): remove walkdir, use recursive std::fs
Add walk_dir/walk_dir_inner helpers (~20 lines) to replace walkdir
crate. Single call site in copy_static_assets didn't justify the
dependency.
2026-02-05 23:55:33 -07:00
Timothy DeHerrera
13e728de80 refactor(error): remove thiserror, implement Error manually
Manual Display and Error trait implementations replace derive macro.
Preserves source() chaining for all io::Error and tera::Error variants.
One less dependency, same behavior.
2026-02-05 23:46:14 -07:00
Timothy DeHerrera
f9a978bdd6 feat(highlight): implement tree-house syntax highlighting engine
Replace tree-sitter-highlight with Helix's tree-house crate for
advanced syntax highlighting:

- Add tree-house and tree-house-bindings dependencies
- Implement SukrLoader with LanguageLoader trait
- Add hierarchical scope resolution with fallback
  (e.g., keyword.control.conditional → keyword.control → keyword)
- Create custom HTML renderer processing HighlightEvents
- Support all 14 languages with Helix queries
- Handle JS/TS inheritance chain (ecma → _javascript/_typescript)

Benefits:
- Richer semantic highlighting with ~75 scope classes
- Proper language injection support
- Hierarchical theme scopes matching Helix themes
- Foundation for converting Helix TOML themes to CSS
2026-02-05 12:04:53 -07:00
Timothy DeHerrera
136be19533 feat(highlight): migrate to tree-house with Helix queries
Replace tree-sitter-highlight dep with tree-house crate from Helix
editor. Add ropey dependency required by tree-house.

Reorganize query files from Helix's runtime/queries/ for all 14
supported languages:
- bash, c, css, go, html, javascript, json, markdown, nix, python,
  rust, toml, typescript, yaml
- Include ecma, _javascript, _typescript base dirs for JS/TS inheritance
- Copy highlights.scm, injections.scm, locals.scm where available

This commit establishes the foundation; highlight.rs implementation
will follow in subsequent commits.
2026-02-04 16:49:04 -07:00
Timothy DeHerrera
ea9830f04b feat(highlight): add TOML syntax highlighting
Use tree-sitter-toml-ng v0.7.0 from tree-sitter-grammars, which is
compatible with tree-sitter 0.26 (unlike the older tree-sitter-toml).

- Add tree-sitter-toml-ng dependency
- Add Toml variant to Language enum
- Add TOML_CONFIG with crate's HIGHLIGHTS_QUERY
2026-01-31 17:27:53 -07:00
Timothy DeHerrera
8c54882118 feat(highlight): add markdown syntax highlighting with injection
Add tree-sitter-md for markdown parsing with injection support for
fenced code blocks. Code inside markdown code fences (```rust, ```bash,
etc.) is now fully syntax highlighted.

Key fix: Use `#set! injection.include-children` directive in the
injection query to override tree-sitter-md's internal tokenization
of code_fence_content, allowing proper language injection.

- Add tree-sitter-md v0.5.2 dependency
- Add Markdown variant to Language enum (md, markdown aliases)
- Create queries/md-highlights.scm (minimal markdown highlights)
- Create queries/md-injections.scm (with include-children directive)
- Add test: test_markdown_injection_rust
2026-01-31 16:41:11 -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
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