πŸš€ Introducing TrixGenius Alpha 0.1.2 – Now with AI-Powered Math Evaluation!

TrixGenius Alpha 0.1.2
TrixGenius Alpha 0.1.2

April 15, 2025

πŸ“’ I just released a new version of my Rails engine and gem: TrixGenius! This gem extends the beloved Trix Editor with some fresh, AI-powered superpowers β€” all using Hotwire (Turbo + Stimulus).

Whether you’re building internal tools, CMS interfaces, or AI-enhanced content platforms, TrixGenius gives your rich text editor a serious productivity boost.

Article content

✨ What’s New in Alpha 0.1.2?

This update introduces a brand-new feature that I’m super excited about:

βž• Calculate Math Expressions with a Single Click!

Users can now type math expressions inside the Trix editor (like (5 + 3 * 2)), hit the new β€œCalculate” button, and automatically get the result injected back into the content.

🧠 Under the hood:

  • Detects top-level math expressions in parentheses.
  • Uses a secure Ruby evaluator to compute results (e.g., (3+4*2) becomes 3+4*2=11).
  • Optionally calls an AI (e.g., DeepSeek) to reformat the text while preserving the original context.

πŸŽ₯ Here’s what it looks like:

Input: Let’s compute (8/2+3*2).

Result after clicking β€œCalculate”: Let’s compute 8/2+3*2=10.


πŸ’Ό Need Help Building AI-Powered Tools in Rails?

If you’re looking to enhance your Rails app with AI, improve your editor experience, or just want someone to help you ship smarter features faster β€” I’d love to chat.

I specialize in:

  • πŸš€ Ruby on Rails development
  • 🧠 AI integrations (OpenAI, DeepSeek, custom APIs)
  • ⚑ Hotwire (Turbo + Stimulus)
  • πŸ› οΈ Building and maintaining custom gems and engines

πŸ‘‰ Let’s connect: rubystacknews.com/get-in-touch

Happy to explore how we can build something great together. πŸ‘‹


πŸ”§ How it Works – Under the Hood

The magic happens through:

βœ… A Stimulus Controller

  • Adds a “Calculate” button to the Trix toolbar.
  • Collects the editor content.
  • Sends it via AJAX to your Rails backend for evaluation.

βœ… A Rails Endpoint (/trix_genius/calculate_expression)

  • Securely parses and evaluates expressions.
  • Integrates optional AI enhancement.
  • Returns transformed HTML content.

βœ… Generator Updates

The gem now automatically injects this route:

# TrixGenius: Auto-added route
post "/trix_genius/correct_spelling", to: "trix_genius#correct_spelling"

It’s all scaffolded into your app with a single command:

bin/rails g trix_genius:install

πŸ§ͺ Still in Alpha β€” But Growing Fast

Article content

This gem started with a simple idea: make Trix smarter. The first feature was a “Correct Spelling” button. Now, we’ve added math evaluation, and we’re already working on:

  • Integrating ChatGPT & Qwen.ai
  • Feature toggles (enable/disable toolbar buttons)
  • Specs for all features

πŸ”— Try It Out

You can install the gem from RubyGems:

gem 'trix-genius', '~> 0.1.2'

Then run the install generator:

bundle install
bin/rails g trix_genius:install

Demo it with Action Text + a simple scaffold:

bin/rails g scaffold Post title:string content:rich_text
Article content
Calculate Expression
Article content
Trix Genius

πŸ™Œ Feedback Welcome

This is an early release, and I’d love to hear what you think β€” feature requests, issues, and ideas are more than welcome.

Feel free to reach out or follow the repo to stay updated: πŸ‘‰ https://github.com/ggerman/trix_genius

Let’s build smarter content tools for Rails devs! πŸ”§πŸ’‘

#RubyOnRails #Hotwire #TrixEditor #StimulusJS #AI #OpenSource #DevTools #RubyGems

Article content

One thought on “πŸš€ Introducing TrixGenius Alpha 0.1.2 – Now with AI-Powered Math Evaluation!

Leave a comment