js-code-wrapper
Gem provides helper method wrap_js_code
that wraps javascript into <code></code>
tags.
Installation
Add
gem 'js-code-wrapper'
to your Gemfile
.
Usage
wrap_js_code("<script>alert('wrap me!');</script>") # => "<code><script>alert('wrap me!');</script></code>"
wrap_js_code("<script>alert('wrap me!');</script>", :escape_js => true) # => "<script>alert('wrap me!');</script>"