Skip to content

Instantly share code, notes, and snippets.

@FilterKaapi
Last active August 29, 2015 14:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FilterKaapi/b2c9753e5b6817a85c50 to your computer and use it in GitHub Desktop.
Save FilterKaapi/b2c9753e5b6817a85c50 to your computer and use it in GitHub Desktop.
Server Side JS with ExecJS in Ruby
source = File.read(Rails.root.join("app/assets/javascripts/markdown.js"))
context = ExecJS.compile source
markdown = context.call "toMarkdown", input_html
puts markdown
gem 'execjs'
<h1> Hello World </h1>
<h2> Hello Ruby </h2>

Hello World

Hello Ruby

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment