Skip to content

Adds basic tooltip integration. - #436

Draft
johnnymatthews wants to merge 1 commit into
mainfrom
feat/tooltip-integration
Draft

Adds basic tooltip integration.#436
johnnymatthews wants to merge 1 commit into
mainfrom
feat/tooltip-integration

Conversation

@johnnymatthews

Copy link
Copy Markdown
Contributor

Closes #350

Here's how it works, currently anyway:

The glossary stays in one place, data/glossary.json, and everything reads from there. When Zola builds the site, a small template partial loads that file and drops it into every page as a plain JS object on window. So the terms and definitions ship with the HTML itself, no fetch calls, no extra build step, nothing to keep in sync. Add a term to the JSON and it just shows up everywhere on the next build.

On the page, one vanilla JS file does the rest. It walks the text inside the article, matches any glossary term with a single whole-word regex (longest first, so "Merkle Tree" beats "Merkle"), and wraps each hit in a span. It skips code blocks, links, headings, and mermaid diagrams so it never breaks anything. The tooltip itself is one shared div: hover, tap, or keyboard focus shows it, Escape or tapping away closes it, and it flips or clamps to stay on screen. All styling is CSS using the existing theme variables, so dark and light mode both work.

@johnnymatthews johnnymatthews changed the title First pass for tooltips integration. Adds basic tooltip integration. Aug 31, 2026
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.

Interactive Glossary Tooltips

1 participant