269 Commits

Author SHA1 Message Date
Timothy DeHerrera
04bf87c02a docs(math): render all LaTeX examples
Replace code-only examples with syntax/rendered table showing:
- Greek letters, fractions, subscripts, sums, integrals, roots, matrices

Add display math examples: Gaussian integral, Euler's identity,
Schrödinger equation.
2026-02-01 12:08:52 -07:00
Timothy DeHerrera
96275b0751 doc(README): update content structure 2026-02-01 11:21:49 -07:00
Timothy DeHerrera
73459e5d17 doc(README): update to reflect current state 2026-02-01 11:19:45 -07:00
Timothy DeHerrera
f38303b7e0 docs: document navigation, TOC, and template context
Add comprehensive documentation for recently implemented features:
- [nav] config section (nested, toc toggles)
- Complete frontmatter fields reference (10 fields)
- Hierarchical navigation behavior with ASCII diagram
- Template context: nested_nav, anchors array, page.toc
- Nav item structure including children for nested menus
2026-02-01 11:00:20 -07:00
Timothy DeHerrera
3d5682c59f fix(docs): prevent mermaid diagram overflow on mobile
Add scrollable container rules for .mermaid-diagram in mobile
media query. SVG diagrams now scroll horizontally within their
container instead of extending the page width and obscuring
the hamburger menu.
2026-02-01 10:25:23 -07:00
Timothy DeHerrera
b61e8e8866 chore(fmt): format css 2026-02-01 10:10:40 -07:00
Timothy DeHerrera
e607454af6 feat(css): add :target highlighting for anchor navigation
- Highlight heading with accent border-left when targeted via URL hash
- Show pilcrow anchor visibly on targeted headings
- Add scroll-margin-top for better scroll positioning
2026-02-01 10:10:21 -07:00
Timothy DeHerrera
4392487629 fix(mobile): make nav independently scrollable
- Use viewport-relative max-height instead of fixed 500px
- Add overflow-y:auto for internal scrolling on long anchor lists
2026-02-01 10:04:02 -07:00
Timothy DeHerrera
ce8a9e8f00 feat(ux): add hover-reveal ¶ anchors, strip parens from nav
- Add pilcrow (¶) anchor link after heading text for deep-linking
- CSS: hidden by default, visible on heading hover, user-overridable
- Add strip_parens Tera filter for cleaner nav anchor labels
- Update test expectations for new heading format
2026-02-01 09:57:47 -07:00
Timothy DeHerrera
fc9e75d687 test(nav): add unit tests for anchor extraction and TOC fallback
- test_anchor_extraction: verify h2-h6 extracted, h1 skipped, IDs slugified
- test_slugify_edge_cases: verify special char handling, spaces, case
- test_toc_config_fallback: verify frontmatter override and config default
2026-02-01 09:48:13 -07:00
Timothy DeHerrera
c8c2506e16 feat(config): add global nav.toc setting with frontmatter override
- Add toc: bool to [nav] config section (default: false)
- Frontmatter toc: true/false overrides global config
- If frontmatter toc is not specified, falls back to config.nav.toc
- Enable nav.toc = true in docs/site.toml for global TOC
2026-02-01 09:42:00 -07:00
Timothy DeHerrera
dcc98dccef feat(nav): add anchor TOC in sidebar for toc-enabled pages
- Pass extracted anchors through template context
- Render anchor links under active page when page.toc is true
- Hierarchical indentation by heading level (h2-h6)
- CSS styling: smaller font, muted color, border-left indicator
- Add toc: true to templates.md as example
2026-02-01 09:37:01 -07:00
Timothy DeHerrera
a59b8ff2ab feat(render): add anchor extraction during markdown rendering
- Add Anchor struct with id, label, level fields
- markdown_to_html() now returns (String, Vec<Anchor>) tuple
- Headings h2-h6 are extracted with slugified IDs
- Add toc: bool frontmatter field for per-page TOC opt-in
- All heading tags now include id attributes for anchor links
2026-02-01 09:31:54 -07:00
Timothy DeHerrera
d50a8c3fbe feat(nav): add context-aware expansion for nested navigation
Children are only visible when user is viewing a page within that
section. Uses Tera's starting_with test to detect ancestor relationship.
2026-02-01 09:16:47 -07:00
Timothy DeHerrera
7f765b32e1 feat(nav): complete Tier 1 hierarchical navigation
Add config option [nav] nested (defaults false), update base.html
template with nested nav rendering, and add .nav-children CSS styling
for indented section children.

- Add NavConfig struct with nested: bool
- Template renders item.children in .nav-children div
- CSS: left border + indent for nested items
2026-02-01 09:09:41 -07:00
Timothy DeHerrera
b3a540651a feat(content): add nested children to NavItem for hierarchical nav
Extend NavItem struct with children field to support nested navigation.
discover_nav() now populates children for section items by collecting
section pages via Section::collect_items() and mapping them to child
NavItem entries. Children are sorted by weight then alphabetically.
2026-02-01 09:00:04 -07:00
Timothy DeHerrera
4cd0c86688 fix(docs): prevent table overflow on mobile
Add responsive table rules: horizontal scroll within container,
word-break for inline code, and constrained max-width. Fixes
hamburger menu being pushed off-screen on pages with wide tables.
2026-02-01 08:43:07 -07:00
Timothy DeHerrera
99fc4c0fc7 feat(docs): add responsive hamburger menu with animations
Implement pure CSS mobile navigation with the following features:

- Collapsible sidebar nav hidden behind hamburger toggle on mobile
- Animated hamburger → X icon morph using CSS transforms
- Smooth slide-down transition for nav reveal (max-height/opacity)
- Hamburger positioned on right side of header via absolute positioning
- Uses :has() selector to detect checkbox state without JavaScript
- Overflow fixes to prevent horizontal scroll on mobile devices

The implementation follows suckless principles with zero JavaScript.
2026-02-01 08:32:24 -07:00
Timothy DeHerrera
516df62796 docs(templates): fix Lighthouse SEO and accessibility issues
- Defer KaTeX CDN CSS with media="print" onload pattern
- Add noscript fallback for non-JS browsers
2026-02-01 07:07:40 -07:00
Timothy DeHerrera
3752cc5234 fix(render): properly capture image alt text from markdown
pulldown-cmark emits alt text as Text events between Image start/end
tags. Previously, images were rendered immediately on the Start event
with empty alt text, losing the user-provided description.

Refactored to accumulate alt text using the same pattern as code block
handling: state variables track image attributes and alt content, then
the full <img> tag is rendered on the End event.

Also omits the title attribute entirely when no title is provided,
producing cleaner HTML output.

Fixes Lighthouse "Image elements have [alt] attributes" audit issue.
2026-01-31 22:50:05 -07:00
Timothy DeHerrera
0bb59dd1d5 docs(features): add sitemap documentation
Add docs/content/features/sitemap.md documenting the automatic
XML sitemap generation feature:

- Output location and contents
- Auto-generation behavior
- lastmod date handling
- Linking and validation tips

Follows established pattern from feeds.md.
2026-01-31 22:24:39 -07:00
Timothy DeHerrera
922aeba834 refactor(main): use manifest.homepage in generate_homepage
Eliminate redundant Content::from_path call by using the pre-discovered
manifest.homepage content. Also uses manifest.nav directly.

- Removes dead_code warning on SiteManifest.homepage field
- Reduces I/O by reusing discovered content
- Simplifies function signature (4 args vs 5)
2026-01-31 22:18:49 -07:00
Timothy DeHerrera
759838e7f5 refactor(main): integrate SiteManifest for unified content discovery
Replace separate discover_nav + discover_sections calls with single
SiteManifest::discover() in run() pipeline:

- Update generate_feed() to accept &SiteManifest
- Update generate_sitemap_file() to accept &SiteManifest
- Simplify process_pages() to return Result<()>
- Remove redundant all_posts collection (now in manifest.posts)
- Remove unused discover_nav and discover_sections imports

All 49 tests pass, site builds identically.
2026-01-31 22:13:09 -07:00
Timothy DeHerrera
96aa60d9e4 refactor(content): add SiteManifest for unified content discovery
Introduce SiteManifest struct that aggregates all site content from a
single discovery pass:

- homepage: content/_index.md
- sections: directories with _index.md
- pages: top-level standalone .md files
- posts: blog section items (sorted by date for feed)
- nav: navigation menu items

Add discover_pages() helper and 5 unit tests covering homepage,
sections, pages, posts, and nav discovery.

Not yet integrated into main.rs pipeline.
2026-01-31 22:08:49 -07:00
Timothy DeHerrera
d24e4a0246 feat(sitemap): integrate sitemap generation into build pipeline
Wire generate_sitemap() into main.rs pipeline:

- Refactor process_pages() to return discovered pages
- Add generate_sitemap_file() helper function
- Generate sitemap.xml after homepage (Step 5 in pipeline)
- All 44 tests pass, sitemap contains 12 URLs

The sitemap includes homepage, section indices, section items,
and standalone pages following XML Sitemap 1.0 protocol.
2026-01-31 22:03:48 -07:00
Timothy DeHerrera
4d869a85f7 feat(sitemap): add XML sitemap generation module
Implement src/sitemap.rs with generate_sitemap() for SEO-compliant
XML sitemap generation. Follows the feed.rs pattern:

- SitemapEntry struct for URL metadata
- build_sitemap_xml() for XML construction
- xml_escape() for special character handling
- 5 unit tests covering single/multiple entries, lastmod, escaping

Module declared in main.rs but not yet integrated into pipeline.
2026-01-31 22:00:20 -07:00
Timothy DeHerrera
eaf09c1c7d fix: nrd.sh -> sukr 2026-01-31 21:50:14 -07:00
Timothy DeHerrera
b271a3a0c8 fix: correct netlify dir 2026-01-31 19:23:10 -07:00
Timothy DeHerrera
6ab3e5a3bd chore: update netlify config 2026-01-31 19:19:49 -07:00
Timothy DeHerrera
893c2fee45 chore: remove personal site for sukr 2026-01-31 19:18:07 -07:00
Timothy DeHerrera
50116d8e8e docs: avoid redundant headers 2026-01-31 19:16:31 -07:00
Timothy DeHerrera
9869da554b chore: make logo transparent 2026-01-31 19:13:19 -07:00
Timothy DeHerrera
6dac743dfa feat(docs): add footer, favicon, and logo branding
- Add sidebar footer with GitHub repo link and MIT copyright
- Generate geometric logo for project branding
- Add logo as favicon in browser tab
- Add logo to sidebar header (32x32) next to "sukr" text
- Add centered logo (128px) at top of README
2026-01-31 18:38:31 -07:00
Timothy DeHerrera
e0fe45330d feat(docs): add footer, favicon, and GitHub link
- Add sidebar footer with GitHub repo link and MIT copyright
- Position footer at bottom of sidebar using flexbox
- Generate geometric logo and add as favicon
- Update base.html template with footer and favicon link
2026-01-31 18:35:29 -07:00
Timothy DeHerrera
1dd91a407b fix(math): add KaTeX CDN and fallback for radical SVG overflow
KaTeX renders square roots using a 400em-wide SVG that relies on CSS
`overflow: hidden` to clip to the correct length. Without the KaTeX
stylesheet, this SVG extends across the entire page.

Changes:
- Add KaTeX CDN stylesheet link to base.html for fonts and layout
- Add .katex-display local margin/overflow overrides
- Add .hide-tail svg max-width fallback for file:// CORS blocking

The CDN provides full KaTeX styling when accessible. The SVG constraint
serves as a fallback when CDN is blocked (e.g., local file:// access).
2026-01-31 18:06:27 -07:00
Timothy DeHerrera
013786faa6 style(highlight): complete Dracula color coverage for all syntax tokens
Expand syntax highlighting CSS from 15 to 31 highlight classes, ensuring
all tree-sitter captures have assigned colors. Organized into logical
sections with comments.

Coverage added:
- type-builtin, function-builtin, constant-builtin (variants)
- variable-builtin, variable-parameter (orange, italic)
- constructor, embedded, escape
- string-special, string-special-path, string-special-uri
- punctuation-special

Color palette (Dracula-inspired):
- Pink (#ff79c6): keywords, operators, tags, punctuation-special
- Yellow (#f1fa8c): strings
- Green (#50fa7b): functions, constructors
- Cyan (#8be9fd): types, properties, attributes
- Purple (#bd93f9): numbers, constants
- Orange (#ffb86c): builtins, parameters, escapes
- Muted (#6272a4): comments
2026-01-31 17:38:54 -07:00
Timothy DeHerrera
10fd93452b doc(highlight): add examples 2026-01-31 17:30:35 -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
905897b3c4 fix(highlight): complete markdown syntax highlighting with injections
Fix markdown code block highlighting to properly support both markdown
structure (headings, frontmatter) and language injection (rust, bash).

The key fix uses `#set! injection.include-children` in the injection
query to override tree-sitter-md's internal tokenization, enabling
proper highlighting of embedded languages within code fences.

Changes:
- Use crate's HIGHLIGHT_QUERY_BLOCK for base markdown highlighting
- Add custom injection query with include-children directive
- Add YAML/TOML frontmatter and HTML block injection rules
- Add text.* highlight names (title, literal, uri, reference)
- Add string.escape highlight name
- Add CSS styles for new highlight classes
- Remove unused custom md-highlights.scm
2026-01-31 17:24:27 -07:00
Timothy DeHerrera
352b3c1941 docs: add content organization and feature documentation
- Add content-organization.md explaining filesystem-to-URL mapping
- Add feeds.md for Atom feed generation
- Add css.md for CSS minification
- Fix em dash in css.md

Documents core implicit behavior: directory structure → site layout.
2026-01-31 17:14:56 -07:00
Timothy DeHerrera
4aa07d6079 docs(features): add feeds and css minification documentation
- Add Atom feed generation docs (feeds.md)
- Add CSS minification docs (css.md)
- Fix em dash usage in css.md for natural prose

Completes AI audit (4 layers passed) and documentation gap analysis.
All 39 tests pass, docs site builds successfully.
2026-01-31 17:12:10 -07:00
Timothy DeHerrera
99987bd057 doc(AGENTS): activate integral fragment 2026-01-31 16:52:30 -07:00
Timothy DeHerrera
26e3b1c2ba chore: remove old site structure 2026-01-31 16:49:03 -07:00
Timothy DeHerrera
8ba4d76a64 chore: update predicate submodule 2026-01-31 16:48:07 -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
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
0516bfc600 refactor: move personal site to sites/nrd.sh/
Reorganize for monorepo structure:
- Move content/, templates/, static/, site.toml → sites/nrd.sh/
- Frees root for sukr docs site
- Build with: sukr -c sites/nrd.sh/site.toml
2026-01-31 15:47:47 -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