Last active
August 29, 2015 14:07
-
-
Save FilterKaapi/b2c9753e5b6817a85c50 to your computer and use it in GitHub Desktop.
Server Side JS with ExecJS in Ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source = File.read(Rails.root.join("app/assets/javascripts/markdown.js")) | |
context = ExecJS.compile source | |
markdown = context.call "toMarkdown", input_html | |
puts markdown |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'execjs' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1> Hello World </h1> | |
<h2> Hello Ruby </h2> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment