(function($){$.fn.codemirror = function(options) {
var result = this;
var settings = $.extend( {
'mode' : 'javascript',
'lineNumbers' : false,
'runmode' : false
}, options);
if (settings.runmode) this.each(function() {
var obj = $(this);
var accum = [], gutter = [], size = 0;
var callback = function(string, style) {
if (string == "\n") {
accum.push("
");
gutter.push('
'+(++size)+''); } else if (style) { accum.push("" + CodeMirror.htmlEscape(string) + ""); } else { accum.push(CodeMirror.htmlEscape(string)); } } CodeMirror.runMode(obj.val(), settings.mode, callback); $('
'+accum.join('')+'