Published 2020-10-03.
Last modified 2023-05-18.
Time to read: 1 minutes.
jekyll_plugins
collection.
jekyll_eval_filter
contains a Liquid filter called evaluate
that returns the result of evaluating a Ruby expression.
CAUTION
This filter can evaluation any Ruby expression. No limitations are imposed.
If you use this filter, only allow trusted and verified people to edit the source of your Jekyll website.
With great power comes great responsibility.
Usage:
{{ "1 + 2" | evaluate }} returns 3
The following potentially destroys your system:
{{ 'sudo rm -rf /' | evaluate }}
On a clear disk you can seek forever.
Installation
Add the following highlighted line to your Jekyll project's Gemfile
,
within the jekyll_plugins
group:
group :jekyll_plugins do gem 'jekyll_eval_filter' end
And then execute:
$ bundle