erudite

0.7.1 • Public • Published

Erudite

A tool that parses and executes JavaScript from Markdown, akin to Literate CoffeeScript. Check out the annotated source or the docs below.

Getting Started

npm install -g erudite

CLI Usage

Usage: erudite [options] /path/to/filename

  -h, --help     show this help text
  -o, --outfile  write to the given file path
  -e, --stage    ECMAScript proposal stage (0-4)
      --stdout   write to stdout (ignores -o)

API Usage

erudite exports a single function which parses and executes a given buffer of Markdown text:

var fs = require('fs');
var erudite = require('erudite');
 
var filename = './literate-javascript.md';
var text = fs.readFileSync(filename, 'utf8');
 
erudite(text, {
  filename: filename
});

You can also parse and execute separately:

var source = erudite.parse(buf);
erudite.exec(source, opts);

erudite.parse(text, opts)

  • text A string of Markdown text to process
  • opts A configuration object
    • eol (Optional) The string to use to concatenate code blocks (defaults to os.EOL)

erudite.exec(src, opts)

  • src A string of JavaScript source code
  • opts A configuration object
    • filename (Optional) The name of the source file (defaults to erudite)

License

MIT

Package Sidebar

Install

npm i erudite

Weekly Downloads

13

Version

0.7.1

License

MIT

Last publish

Collaborators

  • artisonian