1
0
Fork 0
mirror of https://github.com/rails/execjs synced 2023-03-27 23:21:20 -04:00

Code fence highlighting

This commit is contained in:
Joshua Peek 2014-05-19 09:56:17 -04:00
parent 9c02129a78
commit 59b772a0c2

View file

@ -17,12 +17,15 @@ ExecJS supports these runtimes:
A short example: A short example:
``` ruby
require "execjs" require "execjs"
ExecJS.eval "'red yellow blue'.split(' ')" ExecJS.eval "'red yellow blue'.split(' ')"
# => ["red", "yellow", "blue"] # => ["red", "yellow", "blue"]
```
A longer example, demonstrating how to invoke the CoffeeScript compiler: A longer example, demonstrating how to invoke the CoffeeScript compiler:
``` ruby
require "execjs" require "execjs"
require "open-uri" require "open-uri"
source = open("http://jashkenas.github.com/coffee-script/extras/coffee-script.js").read source = open("http://jashkenas.github.com/coffee-script/extras/coffee-script.js").read
@ -30,10 +33,13 @@ A longer example, demonstrating how to invoke the CoffeeScript compiler:
context = ExecJS.compile(source) context = ExecJS.compile(source)
context.call("CoffeeScript.compile", "square = (x) -> x * x", :bare => true) context.call("CoffeeScript.compile", "square = (x) -> x * x", :bare => true)
# => "var square;\nsquare = function(x) {\n return x * x;\n};" # => "var square;\nsquare = function(x) {\n return x * x;\n};"
```
# Installation # Installation
```
$ gem install execjs $ gem install execjs
```
# FAQ # FAQ