RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

lexxy-variables 1.0: variables for Lexxy rich text

lexxy-variables 1.0 is out. It adds variables to Lexxy, the new rich text editor for Rails. Authors type {{ or use a toolbar menu to insert a variable, which is saved as an Action Text attachment, not as template markup. When you render, you pass a hash and with_variables swaps each one for its value:

<%= @record.body.with_variables(first_name: @person.first_name) %>

Values are always escaped, and Liquid is opt-in, so it’s safe out of the box. The catalog can be a simple list or a database model. The result works as HTML, plain text, and Markdown, so it fits views, mailers and jobs. It matches your Lexxy theme out of the box, and every piece can be restyled.

Try it on the demo site.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in