Skip to content

Latest commit

 

History

History
19 lines (13 loc) · 460 Bytes

README.md

File metadata and controls

19 lines (13 loc) · 460 Bytes

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) # => "&lt;script&gt;alert('wrap me!');&lt;/script&gt;"