269 Commits

Author SHA1 Message Date
d6d230e9f2 feat: Added packages.sukr and packages.default 2026-02-16 19:30:36 +05:30
Timothy DeHerrera
5c3299b774 docs: close API stabilization plan review and fix stale refs
Close plan review: fix Decisions table 404 naming (content/404.md
→ content/_404.md), check off Verification items, log
collect_items() quadruple-call as technical debt, fill in
Retrospective.

Fix post-changeset staleness: AGENTS.md YAML→TOML reference,
add [nav]/[feed]/[sitemap] config tables to AGENTS.md example,
mark charter workstream 1 complete.
2026-02-15 09:52:39 -07:00
Timothy DeHerrera
7b3373295b feat: integrate tag pages into sitemap
Thread tag names from collect_tags() through
generate_sitemap_file to generate_sitemap, appending
/tags/<tag>.html entries to sitemap.xml output.

Refactor: hoist collect_tags into run(), rename
generate_tag_pages to write_tag_pages.

Test suite: 83 → 84, phase 3 complete.
2026-02-15 09:15:31 -07:00
Timothy DeHerrera
e7809e1ce2 feat: add 404 page and tag listing generation
Detect content/_404.md as special page (underscore
prefix convention), store in SiteManifest.page_404,
render to 404.html in output root.

Add collect_tags() grouping all tagged content into
BTreeMap for deterministic output. render_tag_page()
renders through tags/default.html template.

Add 5 tests. Test suite: 78 → 83, all passing.
2026-02-14 16:03:30 -07:00
Timothy DeHerrera
53463b3d8b feat: generate HTML redirects for aliases
Add generate_aliases(), write_aliases(), and
redirect_html() to main.rs. For each content item
with aliases in frontmatter, writes a minimal HTML
redirect stub with meta refresh and canonical link.

Alias paths are normalized: bare paths get
/index.html appended, .html extensions preserved.

Add 2 tests. Test suite: 76 → 78, all passing.
Phase 2 complete — all plan items checked off.
2026-02-14 07:24:57 -07:00
Timothy DeHerrera
7e692aacb4 feat: filter draft content from all output
Add draft filtering at discovery source functions:
collect_items(), discover_nav(), discover_pages().
Posts, feed, and sitemap inherit filtering
automatically via collect_items().

Items with frontmatter draft = true are excluded
from section listings, navigation, feed, and
sitemap. Default is false — no behavior change
for existing content.

Add 3 tests. Test suite: 73 → 76, all passing.
2026-02-14 07:20:47 -07:00
Timothy DeHerrera
0c9ecbfad6 feat: gate feed/sitemap generation on config
Wire config.feed.enabled and config.sitemap.enabled
into main.rs run() function. Both default to true,
so existing behavior is preserved.

Add 5 new tests: feed/sitemap config defaults,
independent disable, and ConfigContext nav structure
with base_url trailing-slash normalization.

Test suite: 69 → 73 tests, all passing.
Phase 1 complete — all plan items checked off.
2026-02-14 07:12:56 -07:00
Timothy DeHerrera
45448cc443 feat: normalize config context and template API
Add FeedConfig and SitemapConfig structs to config.rs
with enabled: bool (default true) for opt-out control.

Refactor ConfigContext: flat nested_nav bool replaced
with nested nav: NavContext { nested, toc } to mirror
site.toml [nav] table structure.

Remove standalone base_url template variable; use
config.base_url as single source of truth with
trailing-slash trimming in ConfigContext::from().

Add section template fallback: try section/<type>.html,
fall back to section/default.html for unknown types.

Delete section/features.html (duplicate of default.html)
and homepage.html (dead code, never referenced).

Update base.html for new variable names.
2026-02-14 07:09:05 -07:00
Timothy DeHerrera
46c00c7729 docs: migrate content files to TOML frontmatter
Migrate all 17 docs/content/ files from --- YAML to +++ TOML
frontmatter delimiters and key = value syntax.

Update 8 embedded frontmatter examples in 7 documentation pages
to match (configuration, content-organization, getting-started,
security, sections, sitemap, feeds, templates).

Update configuration.md frontmatter reference table: add draft
and aliases fields, correct date type from string to date.
2026-02-14 06:57:55 -07:00
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
021ffb6a78 docs(plan): add sukr 1.0 API stabilization plan
Three-phase plan to stabilize sukr's public API surfaces before 1.0:

- Phase 1: Replace hand-rolled YAML frontmatter with TOML (+++ delimiters,
  serde Deserialize), normalize template variable naming, add feed/sitemap
  config toggles, template section fallback, remove dead templates
- Phase 2: Draft filtering and alias redirect stub generation
- Phase 3: 404 page support and tag listing page generation

Key decisions: TOML frontmatter (eliminates fragile parser), config.nav
nesting to mirror site.toml structure, flat tags array, date validation
via chrono::NaiveDate.

Ref: .sketches/2026-02-13-api-stabilization.md
2026-02-14 06:24:56 -07:00
Timothy DeHerrera
d51ee8a4a1 docs(charter): add sukr 1.0 stable release charter
Frame the strategic intent for reaching a 1.0 release.

Four workstreams in priority order:
- API Stabilization (feature evaluation + dependency health audit)
- Error Quality (actionable messages, no panics outside main)
- Test Coverage (protect the stabilized surface)
- Distribution (CI/CD, cargo install, nix build, changelog)

Strategic non-goals: plugin system, incremental builds,
additional output formats, dev server, migration tooling.
2026-02-12 13:57:50 -07:00
Timothy DeHerrera
8d213183f5 docs: complete verification and retrospective
Check off all 7 plan verification items with results.
Write retrospective covering what went well (phased approach,
source verification, CHALLENGE decisions), surprises (sketch
false positives, extra Sukr instances, existing Tera link),
process observations (CORE granularity, cross-phase deps,
tech debt tracking), and intentional deferrals (G2, G5,
security.md mixed quadrants).
2026-02-12 13:37:00 -07:00
Timothy DeHerrera
ef173ec092 docs: add cross-references and fix nav ordering
Link feature names in architecture.md to feature docs pages.
Add See Also section to configuration.md with related pages.
Add getting-started prerequisite link to deployment.md. Adjust
page weights for user journey sidebar order: Getting Started
(0) → Deployment (1) → Content Organization (2) → Config (3).
2026-02-12 13:27:23 -07:00
Timothy DeHerrera
44e51cbdb7 docs: restructure README to explanation quadrant
Remove duplicated comparison table, inline config reference,
and content structure diagram from README — link to docs site
instead. Trim themes/README.md to attribution and theme list,
link to syntax-highlighting docs for usage and customization.
2026-02-12 13:24:05 -07:00
Timothy DeHerrera
f357ecd551 docs: add deployment guide
Create deployment.md how-to page covering local preview,
GitHub Pages, Netlify, Cloudflare Pages, and generic static
hosts. Add cross-links from homepage and getting-started
Next Steps. Reference security.md for CSP headers.
2026-02-12 13:20:41 -07:00
Timothy DeHerrera
f40233cb6e docs: add frontmatter defaults and enrich theming
Update Tera link to canonical URL, add authoring syntax
pointer. Add Default column to frontmatter fields table
with source-verified values. Enrich Theme System section
with core CSS variables table and customization pattern.
2026-02-12 13:10:22 -07:00
Timothy DeHerrera
bdf8976378 docs: rewrite homepage and consolidate sections
Rewrite _index.md as explanation-only — remove inline Quick
Start, add Learn More links. Move section discovery explanation
from features/sections.md into content-organization.md. Slim
sections.md to reference-only with cross-reference.
2026-02-12 13:04:07 -07:00
Timothy DeHerrera
73329aff81 docs: normalize terminology and fix metadata
Normalize "Sukr" to "sukr" in architecture.md (4 instances).
Change site.toml title to lowercase. Fix template override
path from page/special.html to content/special.html. Update
copyright year to 2026.
2026-02-12 12:57:07 -07:00
Timothy DeHerrera
ce830767ff docs: fix tutorial path with inline templates
Replace stale `cargo install sukr` with install-from-source.
Replace Step 4 dead-end with inline base.html, page.html,
and content/default.html templates. Add "View your site"
completion step. Improve Next Steps with reading-order context.
2026-02-12 12:45:09 -07:00
Timothy DeHerrera
978ae679ff docs(plan): add documentation overhaul plan
Exhaustive audit of the docs site identified 6 stale content items,
8 structural axiom violations, and 3 content gaps. This plan proposes
a 4-phase approach in dependency order:

Phase 1: Fix stale content (install commands, template paths, terminology)
Phase 2: Structural rework (quadrant discipline, section consolidation)
Phase 3: Fill content gaps (deployment guide, theming section)
Phase 4: README restructure + cross-references

Key decisions:
- Theming added to syntax-highlighting.md (avoids sync with themes/README)
- Deployment guide kept generic (suckless: no platform configs)
- Tutorial templates inlined (scope economy over starter repo)
- CLI and error reference deferred/cut (scope economy)
- sections.md slimmed to reference-only (quadrant split)

Sketch: .sketches/2026-02-11-documentation-improvements.md
2026-02-12 11:10:11 -07:00
Timothy DeHerrera
c8ddfb444a refactor: remove test redundancy, reduce API surface
- Remove duplicate xml_escape tests from sitemap.rs and feed.rs
  (already tested in escape.rs)
- Make html_escape_into private (only used internally)
2026-02-06 00:33:10 -07:00
Timothy DeHerrera
3faa78aadb docs(cargo): document dependency rationale
Add block comments explaining each dependency group:
- Core pipeline (pulldown-cmark)
- Syntax highlighting (tree-sitter, core differentiator)
- Build-time rendering (katex, mermaid — zero-JS output)
- CSS processing (lightningcss)
- Templating & config (tera, serde, toml)
2026-02-06 00:06:56 -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
f1e3add292 chore: add .rustfmt.toml 2026-02-05 23:48:08 -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
15f886735c chore: update predicate and AGENTS.md instruction 2026-02-05 17:28:44 -07:00
Timothy DeHerrera
8df8aa434f fix(render): fix code block rendering and quote escaping
Two issues fixed:

1. Language-less code blocks (``` without lang) were not accumulating
   text content. The guard `code_block_lang.is_some()` was false for
   them, so content fell through to regular text rendering.

   Fix: Add `in_code_block` flag to track code block state separately
   from language presence.

2. Single quotes in code blocks were being HTML-escaped as &#39;,
   breaking CSP headers like 'self' in documentation.

   Fix: Create code_escape/code_escape_into in escape.rs that only
   escapes <, >, & (required to prevent HTML tag injection) but
   preserves quotes (safe inside <pre><code> content).

Rationale for code_escape:
- < and > MUST be escaped to prevent browser interpreting code as HTML
- & MUST be escaped to prevent HTML entity interpretation
- Quotes are safe inside element content (no attribute context)

Also:
- Add test for unlabeled code block quote preservation

All 71 tests pass.
2026-02-05 17:26:17 -07:00
Timothy DeHerrera
1e5ed28788 docs: add security documentation with trust model and CSP
Add Security section to README documenting:
- Trust model (untrusted content, trusted binary)
- HTML passthrough implications
- URL escaping behavior

Create docs/content/features/security.md with:
- Detailed trust model table
- Content processing security notes
- CSP header recommendations
- Platform-specific examples (Cloudflare, Netlify, Nginx)

Closes audit recommendations 4 and 5.
2026-02-05 17:22:34 -07:00
Timothy DeHerrera
6638696dea fix(render): escape URLs in links and images to prevent XSS
Apply html_escape to:
- Link href and title attributes (start_tag_to_html)
- Image src attribute (Event::End TagEnd::Image handler)

Add test cases for:
- Quote-breaking URL attacks
- Link title escaping
- Image src escaping

Addresses HIGH severity finding from security audit.
All 70 tests pass.
2026-02-05 17:10:48 -07:00
Timothy DeHerrera
e4a6305a50 fix(escape): add single-quote escaping to html_escape
Add '\'' → '&#39;' case to html_escape_into for complete XSS
protection in HTML attribute contexts. Update documentation
and add test case.

Addresses LOW severity finding from security audit.
2026-02-05 17:07:54 -07:00
Timothy DeHerrera
899f904160 docs(architecture): update module count and tree-house code example
- Fix module count: 12 → 13 (add escape.rs)
- Add escape.rs to module responsibilities table
- Update code example from old HighlightConfiguration API
  to current tree-house LanguageConfig pattern

Reflects tree-house migration and API coherence audit findings.
2026-02-05 15:09:12 -07:00
Timothy DeHerrera
c60c7851a8 refactor(api): restrict visibility of internal items
- content: DEFAULT_WEIGHT, DEFAULT_WEIGHT_HIGH → pub(crate)
- sitemap: SitemapEntry → pub(crate)

These items are implementation details not exposed to consumers.
2026-02-05 15:03:52 -07:00
Timothy DeHerrera
16f04eb95b refactor: consolidate escape functions and extract weight constants
- Create escape.rs with shared html_escape, html_escape_into, xml_escape
- Remove duplicate implementations from render.rs, highlight.rs, feed.rs, sitemap.rs
- Add DEFAULT_WEIGHT (50) and DEFAULT_WEIGHT_HIGH (99) constants to content.rs
- Replace all magic number weight defaults with named constants

No functional changes; all 67 tests pass.
2026-02-05 14:35:24 -07:00
Timothy DeHerrera
7a7dc929b1 chore: attribute credit to helix 2026-02-05 14:31:13 -07:00
Timothy DeHerrera
af762d0d1f style: use snazzy syntax hl theme for doc site 2026-02-05 13:06:55 -07:00
Timothy DeHerrera
5ae8ae6e53 feat(themes): add popular themes, remove redundant default
- Delete default.css (redundant with dracula.css)
- Add snazzy, catppuccin_mocha, tokyonight, rose_pine, onedark themes
- Update docs/static/style.css to import dracula.css
- Update themes/README.md and syntax-highlighting.md

Theme collection now contains 10 well-designed options.
2026-02-05 13:04:39 -07:00
Timothy DeHerrera
113b7e4a4c docs(themes): add syntax highlighting documentation and test coverage
- Update syntax-highlighting.md with tree-house integration details
- Add themes/README.md explaining copy-to-project workflow
- Add 13 tests: hierarchical scopes, injections (Nix+bash, MD, HTML)
- All 64 tests passing
2026-02-05 12:38:00 -07:00
Timothy DeHerrera
3f218ed49c chore: address clippy lints 2026-02-05 12:26:22 -07:00
Timothy DeHerrera
caf2d506a7 feat(themes): add decoupled CSS theme system with lightningcss bundling
- Add 6 syntax highlighting themes (dracula, gruvbox, nord, github)
- Rewrite css.rs to use lightningcss bundler for @import resolution
- Theme CSS is inlined at build time, producing single bundled output
2026-02-05 12:19:47 -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
98977136c8 feat(docs): add CSS-only scrollspy for TOC navigation
Use CSS Overflow Level 5 properties (scroll-target-group, :target-current)
to highlight the current section in the sidebar TOC as the user scrolls.

Progressive enhancement: gracefully degrades in unsupported browsers
(Firefox, Safari) — they retain existing hover/click behavior.

Browser support: Chrome 140+, Edge 140+, Opera 124+ (~65% global).
2026-02-04 11:26:49 -07:00
Timothy DeHerrera
7af7fa34e4 docs(architecture): add implementation notes on dependency trade-offs
Document that sukr prioritizes output quality over minimal build-time
weight. Acknowledges KaTeX and mermaid-rs are heavier than alternatives,
leaving door open for future evaluation without committing to redesign.
2026-02-04 11:18:13 -07:00
Timothy DeHerrera
6e0d16d1bb docs: clarify JS-free comparison claims
Rename "Zero JS Output" to "JS-Free Rich Content" with footnote
explaining that all generators can produce JS-free basic HTML—sukr's
distinction is built-in build-time math and diagram rendering.
2026-02-04 11:15:45 -07:00
Timothy DeHerrera
d97aec30f4 docs: add comparison with other SSGs
- Create comparison.md documenting sukr vs Zola/Hugo/Eleventy
- Feature matrix covers highlighting, math, diagrams, JS, binary
- Add condensed comparison table to README
- Link to full comparison page at sukr.io
2026-02-01 14:49:37 -07:00
Timothy DeHerrera
5ab8198ddf docs: add architecture documentation
Explains sukr's internal design:
- Pipeline overview with Mermaid flowchart
- Module responsibilities table
- Event-based interception pattern
- Zero-JS philosophy rationale
- Static configuration and single-pass discovery patterns
2026-02-01 14:35:36 -07:00
Timothy DeHerrera
cfb0881d1f refactor(math): use native MathML instead of KaTeX CDN
Remove external KaTeX stylesheet dependency in favor of browser-native
MathML rendering. Aligns with suckless philosophy—zero external deps,
works offline, smaller page loads.

- Remove KaTeX CDN links from base.html
- Hide katex-html layer, let browsers render MathML natively
- Clean up obsolete CSS (.hide-tail, .katex-display)
- Add minimal .math-display for block math layout
2026-02-01 14:09:27 -07:00
Timothy DeHerrera
56ae6c2e67 style(mermaid): add dark theme styling with transparent backgrounds
Override mermaid's default white backgrounds to blend with dark theme:
- Transparent SVG background
- Node fills use --bg-sidebar
- Labels use --fg color
- Edges use --fg-muted
2026-02-01 12:20:58 -07:00