Auto-Glossary Gem Documentation
Auto-Glossary is a Rails engine that automatically highlights and defines technical terms from Wikipedia glossaries in your Rails applications.
Installation
1. Add to your Gemfile
gem 'auto_glossary', '>= 0.1.1'
2. Install the gem
bundle install
rails generate auto_glossary:install
3. Use in your views
<%= mark_glossary_terms("Your content with technical terms") %>
Features
🔍 Automatic Detection
Automatically identifies and highlights technical terms in your content
📚 Wikipedia Integration
Fetches definitions from Wikipedia's comprehensive glossaries
⚡ Performance
Built-in caching (24 hours) for fast page loads
♿ Accessible
Fully keyboard accessible with proper ARIA labels
Configuration
Customize Auto-Glossary in config/initializers/auto_glossary.rb:
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 Examples
Mycology Content
Input:
<%= mark_glossary_terms("The basidiospores are produced on the hymenium.") %>
Output:
The basidiospores are produced on the hymenium.Custom Glossary
# Use a different Wikipedia glossary
AutoGlossary.configure do |config|
config.glossary_url = "https://en.wikipedia.org/wiki/Glossary_of_biology"
end