Skip to content

mrdbidwill/auto-glossary

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

27 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Auto-Glossary

Making technical content accessible by automatically highlighting specialized terms with instant Wikipedia definitions.

๐Ÿš€ Status

Standalone gem: โœ… Ready to use as a Rails engine Demo app/docs: โœ… Included in this repository

Auto-Glossary is now a standalone Ruby gem you can add to any Rails app. This repository includes a small Rails application used to demo the gem, host documentation pages, and test changes.

Contributions welcome! This is open source software - use it, improve it, adapt it for your needs.

๐Ÿ“‹ What It Does

Auto-Glossary automatically identifies and highlights technical terms in your content, providing 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 definitions and click-through details.

โœจ Features

  • โšก Instant Setup - Add one helper to your templates: <%= mark_glossary_terms(@content) %>
  • ๐ŸŽฏ Smart Matching - Handles plurals, variations, and edge cases automatically
  • ๐Ÿ“ฑ Responsive - Beautiful tooltips and modals on all devices
  • โ™ฟ Accessible - Full keyboard navigation and screen reader support
  • โš–๏ธ Open Source - MIT licensed, use freely
  • ๐Ÿš€ Fast - Aggressive caching (24 hours), zero slowdown for readers
  • ๐Ÿ”Œ No Database Required - Uses Rails.cache and Wikipedia API

๐ŸŽฏ Perfect For

  • Educational websites (mycology, botany, medicine)
  • Scientific documentation and research portals
  • Technical blogs and knowledge bases
  • Online textbooks and learning platforms
  • Museum and natural history websites
  • Field guide applications

๐Ÿ› ๏ธ Tech Stack

  • Ruby gem (Rails engine)
  • Rails 8 demo app
  • Stimulus JS (Hotwired)
  • Tailwind CSS
  • Wikipedia API
  • Rails caching (no database needed for glossary)

๐Ÿš€ Quick Start

Install in Your Rails App

Add the gem:

# Gemfile
gem "auto_glossary", ">= 0.1.1"

Install and run the installer:

bundle install
rails generate auto_glossary:install

Mount the engine (required for /glossary and the definition endpoint):

# config/routes.rb
mount AutoGlossary::Engine => "/glossary"

Ensure the Stimulus controller is active (often on <body>):

<body data-controller="glossary">

Use it in views:

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

Local Development (Demo App)

git clone https://github.com/mrdbidwill/auto-glossary.git
cd auto-glossary

bundle install

rails server -p 3001

open http://localhost:3001/demo

โš™๏ธ Configuration

The installer creates config/initializers/auto_glossary.rb. Customize it as needed:

AutoGlossary.configure do |config|
  # Wikipedia glossary URL (default: Glossary of mycology)
  config.glossary_url = "https://en.wikipedia.org/wiki/Glossary_of_mycology"

  # Cache expiration time in seconds (default: 24 hours)
  config.cache_expiration = 86_400

  # Enable/disable caching (default: true)
  config.enable_caching = true
end

๐Ÿ“– Usage

Basic Usage

<%= mark_glossary_terms("The mycelium forms hyphae in the substrate.") %>

With Options

<!-- Mark only first occurrence of each term -->
<%= mark_glossary_terms(@content, first_only: true) %>

<!-- Mark all occurrences -->
<%= mark_glossary_terms(@content, first_only: false) %>

Browse All Terms

Visit /glossary to see all available glossary terms and definitions.

๐Ÿงช Testing

Run the test suite:

rails test

๐Ÿ—‚๏ธ Project Structure

This repository includes a Rails demo app used to showcase the gem.

app/
โ”œโ”€โ”€ controllers/
โ”‚   โ””โ”€โ”€ pages_controller.rb        # Home, demo, docs pages
โ”œโ”€โ”€ javascript/controllers/
โ”‚   โ””โ”€โ”€ glossary_controller.js     # Tooltips & modals (Stimulus)
โ””โ”€โ”€ views/
    โ”œโ”€โ”€ pages/
    โ”‚   โ”œโ”€โ”€ home.html.erb           # Landing page
    โ”‚   โ”œโ”€โ”€ demo.html.erb           # Live demo page
    โ”‚   โ””โ”€โ”€ gem_docs.html.erb       # Gem documentation page
    โ””โ”€โ”€ glossary/
        โ””โ”€โ”€ index.html.erb          # Glossary browsing page used in the demo

config/
โ””โ”€โ”€ routes.rb                       # Mounts the engine at /glossary

public/
โ””โ”€โ”€ index.html                      # Landing page (static)

๐ŸŒ Live Sites

๐Ÿค Contributing

Contributions are welcome! Feel free to:

  • Report bugs or request features via GitHub Issues
  • Submit pull requests
  • Adapt this code for your own glossary sources (botany, medicine, etc.)
  • Help improve the gem (features, docs, tests)

๐Ÿ“ง Contact

Questions? Email will@mrdbid.com

๐Ÿ”— Related Projects

MRDBID.com - A personal mushroom storage notebook and much more...

๐Ÿ“„ License

MIT License - Use freely in your projects, commercial or personal.

๐Ÿ™ Acknowledgments

  • Powered by Wikipedia's Glossary of Mycology (CC BY-SA 4.0)
  • Built with Rails 8 and Hotwire Stimulus
  • Inspired by the need for accessible scientific content

๐Ÿค– AI-Generated Code & Content

Full Transparency: This project, including code, documentation, tests, and content, was created with significant AI assistance using Claude Code (Anthropic's AI-powered development tool) within JetBrains RubyMine IDE via the JetBrains AI Assistant integration.

Development Environment: The primary development tools used were:

  • JetBrains RubyMine IDE with JetBrains AI Assistant
  • Claude Code by Anthropic (accessed through JetBrains AI Assistant)
  • Standard Rails tooling and testing frameworks

This combination proved effective for this project, though developers can use whatever tools work best for their workflow.

Data Source Reliability: While Wikipedia's reliability varies by topic and is sometimes criticized as not being "scholarly," scientific glossariesโ€”particularly in specialized fields like mycologyโ€”tend to be well-maintained. These pages are typically monitored by knowledgeable volunteers with domain expertise. Unlike politically charged topics, technical scientific glossaries generally avoid the controversies that affect other Wikipedia content.

The mycology glossary used by this project benefits from:

  • Active community of mycology enthusiasts and experts
  • Subject matter that is factual and less prone to editorial disputes
  • Regular review and updates by specialists
  • Clear attribution to scientific sources

Users should still verify critical information, but for educational and reference purposes, this glossary provides a solid foundation.

๐Ÿ”ฎ Future Plans

  • Support for multiple glossary sources
  • Configurable Wikipedia pages (botany, medicine, etc.)
  • Admin interface for custom term management
  • Multi-language support

Built with โค๏ธ by mrdbidwill

About

Auto-Glossary automatically highlights specialized Mycology terms in your content and provides instant definitions from Wikipedia.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors