lyzidiamond / paren

see through code
19 stars 0 forks source link

paren

The magic of rpl, as a JavaScript library that you can embed in existing pages.

This adds a textarea into your page, but more importantly a live-coding environment. It'll surface errors, whether syntax or runtime, and using magic //= comments, lets you display results of your programs in the same place as their code, dramatically tightening the feedback loop of writing software and enabling ideas like inline, live code examples.

Under the hood, most of the execution magic is in Terrarium, a library that instruments code with esprima and escodegen and runs it in iframe sandboxes. The user-facing interface is powered by CodeMirror and displays detected GeoJSON data with Mapbox.js.

Usage

Recommended usage is with browserify: this is a browser-only library.

npm install --save rpl-www

See the example rpl-www.css file for the necessary CSS, which includes CSS for CodeMirror and rpl-www's custom line widgets.

Example

var Rpl = require('rpl-www');
new Rpl(element, {
  sandbox: { /* optional things to give in scope */ },
  tips: ["searchtext", "tipcontent"]
});

Rpl

The main export is a constructor function that takes arguments of