Skip to content

Add search to specification#881

Open
seth-schultz wants to merge 1 commit intorue-language:trunkfrom
seth-schultz:spec-search
Open

Add search to specification#881
seth-schultz wants to merge 1 commit intorue-language:trunkfrom
seth-schultz:spec-search

Conversation

@seth-schultz
Copy link

@seth-schultz seth-schultz commented Jan 17, 2026

Summary

Implements client-side search for the language specification (fixes #774).

Changes

  • config.toml: Enable Zola's built-in build_search_index and configure search settings
  • search.js: Add elasticlunr-based client-side search with debounced input handling
  • spec/base.html: Add search input to the specification sidebar with keyboard shortcut hint
  • base.html: Load elasticlunr CDN and search.js scripts
  • input.css: Add search UI styles with light/dark mode support

Features

  • Full-text search across all spec pages
  • Search results show page titles and body snippets
  • Keyboard shortcut: ⌘K (Mac) / Ctrl+K (Windows/Linux) to focus search
  • Shortcut hint displayed in the search input
  • Dark mode support

How It Works

  1. Zola generates a search_index.en.json at build time containing all page content
  2. elasticlunr loads this index and provides fast client-side full-text search
  3. Results show in a dropdown with page titles and body snippets
  4. Clicking a result navigates to that spec page

Testing

Built locally and verified:

  • Search works for queries like "integer", "overflow", "struct", etc.
  • Keyboard shortcut ⌘K focuses the search input
  • Shortcut hint displays correctly and hides when focused

- Enable Zola's built-in search index in config.toml
- Add elasticlunr-based search.js for client-side search
- Add search input to spec sidebar with keyboard shortcut (Cmd/Ctrl+K)
- Add CSS styles for search UI with light/dark mode support

The search indexes all spec pages and shows results in a
dropdown with titles and body snippets.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Add search capability to specification

1 participant

Comments