0.0
No release in over 3 years
Auto-Glossary provides hover tooltips and click-through definitions for technical terms by fetching content from Wikipedia glossaries. Perfect for educational, scientific, and technical documentation sites.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 13.0

Runtime

>= 7.0
 Project Readme

Auto-Glossary

Automatically highlight and define technical terms from Wikipedia glossaries in your Rails applications.

What It Does

Auto-Glossary identifies technical terms in your content and provides instant definitions from Wikipedia. Perfect for educational websites, scientific documentation, and technical blogs.

Example:

The basidiospores are produced by the basidium on the hymenium surface of the pileus.

With Auto-Glossary, each technical term becomes interactive with:

  • Hover tooltips - Quick definition preview
  • Click modals - Full definition with Wikipedia attribution
  • Smart matching - Handles plurals and variations automatically

Demo

Visit auto-glossary.com to see it in action!

Installation

Add this line to your Rails application's Gemfile:

gem 'auto_glossary'

Then execute:

bundle install

Or install it yourself:

gem install auto_glossary

Quick Start

1. Run the installer

rails generate auto_glossary:install

This will:

  • Mount the engine routes
  • Copy the Stimulus JavaScript controller
  • Show you the next steps

2. Add stylesheet to your layout

In app/views/layouts/application.html.erb, add:

<%= stylesheet_link_tag 'glossary', 'data-turbo-track': 'reload' %>

3. Add Stimulus controller to body tag

<body data-controller="glossary">

4. Use in your views

<%= mark_glossary_terms(@article.body) %>

5. Restart your Rails server

rails server

Done! Technical terms will now be automatically highlighted with hover tooltips and click-through definitions.

Usage Examples

Basic Usage

<%= mark_glossary_terms(@text) %>

Mark Only First Occurrence

<%= mark_glossary_terms(@text, first_only: true) %>

Mark All Occurrences

<%= mark_glossary_terms(@text, first_only: false) %>

Browse All Terms

Visit /glossary in your app to see all available glossary terms and definitions.

Features

  • Fast - Aggressive caching (24 hours), minimal performance impact
  • 🎯 Smart - Handles plurals, variations, and edge cases automatically
  • 📱 Responsive - Beautiful tooltips and modals on all devices
  • Accessible - Full keyboard navigation and screen reader support
  • 🔌 No Database Required - Uses Rails.cache and Wikipedia API
  • ⚖️ Open Source - MIT licensed

How It Works

  1. Fetches glossary terms from Wikipedia's "Glossary of Mycology"
  2. Caches terms for 24 hours
  3. Marks terms in your text with special HTML
  4. JavaScript handles tooltips and modals
  5. Definitions loaded on-demand from Wikipedia

Configuration

The gem uses the Glossary of Mycology by default. To use a different Wikipedia glossary, override the GLOSSARY_PAGE constant in WikipediaGlossaryService.

Requirements

  • Rails 7.0 or higher
  • Ruby 3.2 or higher
  • Stimulus JS (included in Rails 7+)

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/mrdbidwill/auto-glossary

License

The gem is available as open source under the terms of the MIT License.

Credits