mdwatch
Advanced tools
Comparing version 0.0.4 to 0.0.5
var express = require('express'); | ||
var path = require('path'); | ||
var sio = require('socket.io'); | ||
@@ -7,42 +8,45 @@ var fs = require('fs'); | ||
// configure express server. | ||
var app = express.createServer(); | ||
/** | ||
* @param {String} filename - file to monitor | ||
* @param {Boolean} colorize - Whether to colorize the codeblocks | ||
* @param {number} port - port to listen | ||
*/ | ||
exports.watch = function(filename, colorize, port) { | ||
app.configure(function() { | ||
app.set('views', __dirname + '/../views'); | ||
app.set('view engine', 'jade'); | ||
app.use(express.bodyParser()); | ||
app.use(express.methodOverride()); | ||
app.use(app.router); | ||
app.use(express.static(__dirname + '/../public')); | ||
}); | ||
port = port || 3000; | ||
app.configure('development', function() { | ||
app.use(express.errorHandler({ dumpExceptions: true, showStack: true })); | ||
}); | ||
// configure express server. | ||
var app = express.createServer(); | ||
app.configure('production', function() { | ||
app.use(express.errorHandler()); | ||
}); | ||
app.configure(function() { | ||
app.set('views', __dirname + '/../views'); | ||
app.set('view engine', 'jade'); | ||
app.use(express.bodyParser()); | ||
app.use(express.methodOverride()); | ||
app.use(app.router); | ||
app.use(express.static(__dirname + '/../public')); | ||
}); | ||
app.get('/', function(req, res, next) { | ||
res.render('index', { layout: false }); | ||
}); | ||
app.configure('development', function() { | ||
app.use(express.errorHandler({ dumpExceptions: true, showStack: true })); | ||
}); | ||
app.post('/colorize', function(req, res, next) { | ||
var code = req.body.code | ||
var lang = req.body.lang; | ||
pygments.colorize(code, lang, 'html', function(data) { | ||
res.send(data, 200); | ||
app.configure('production', function() { | ||
app.use(express.errorHandler()); | ||
}); | ||
}); | ||
app.get('/', function(req, res, next) { | ||
res.render('index', { | ||
title: path.basename(filename), | ||
layout: false | ||
}); | ||
}); | ||
/** | ||
* @param {String} filename - file to monitor | ||
* @param {Boolean} colorize - Whether to colorize the codeblocks | ||
* @param {number} port - port to listen | ||
*/ | ||
exports.watch = function(filename, colorize, port) { | ||
port = port || 3000; | ||
app.post('/colorize', function(req, res, next) { | ||
var code = req.body.code | ||
var lang = req.body.lang; | ||
pygments.colorize(code, lang, 'html', function(data) { | ||
res.send(data, 200); | ||
}); | ||
}); | ||
@@ -49,0 +53,0 @@ // start express server |
@@ -7,3 +7,3 @@ { | ||
, "main" : "./index.js" | ||
, "version" : "0.0.4" | ||
, "version" : "0.0.5" | ||
, "dependencies" : { | ||
@@ -13,4 +13,4 @@ "express" : "2.5.5" | ||
, "socket.io" : ">= 0.8.7" | ||
, "marked" : ">= 0.1.7" | ||
, "pygments" : ">= 0.1.0" | ||
, "marked" : ">= 0.1.8" | ||
, "pygments" : ">= 0.1.2" | ||
} | ||
@@ -17,0 +17,0 @@ , "bin" : { "mdwatch" : "./bin/mdwatch.js" } |
mdwatch | ||
======= | ||
`mdwatch` is a tool to help you preview markdown documents. It watches the file for changes and will automatically serve the updated content in your browser. | ||
`mdwatch` is a tool to help you preview markdown documents. It will watch the file for changes and automatically serve the updated content in your browser. | ||
@@ -6,0 +6,0 @@ Install |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
558462
460
Updatedmarked@>= 0.1.8
Updatedpygments@>= 0.1.2