From d47bae43ddc8d4e6b96cc19ec503fc2f6ab6ec09 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke <marijnh@gmail.com>
Date: Fri, 26 Apr 2013 17:23:01 +0200
Subject: [PATCH] [runmode.node addon] Include null mode

---
 addon/runmode/runmode.node.js | 6 ++++++
 bin/source-highlight          | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/addon/runmode/runmode.node.js b/addon/runmode/runmode.node.js
index 9767a75f..a6ea919d 100644
--- a/addon/runmode/runmode.node.js
+++ b/addon/runmode/runmode.node.js
@@ -68,6 +68,12 @@ exports.defineMode = function(name, mode) {
   modes[name] = mode;
 };
 exports.defineMIME = function(mime, spec) { mimeModes[mime] = spec; };
+
+exports.defineMode("null", function() {
+  return {token: function(stream) {stream.skipToEnd();}};
+});
+exports.defineMIME("text/plain", "null");
+
 exports.getMode = function(options, spec) {
   if (typeof spec == "string" && mimeModes.hasOwnProperty(spec))
     spec = mimeModes[spec];
diff --git a/bin/source-highlight b/bin/source-highlight
index 73093575..7596ed77 100755
--- a/bin/source-highlight
+++ b/bin/source-highlight
@@ -27,7 +27,7 @@ CodeMirror.modeInfo.forEach(function(info) {
 });
 
 function ensureMode(name) {
-  if (CodeMirror.modes[name]) return;
+  if (CodeMirror.modes[name] || name == "null") return;
   try {
     require("../mode/" + name + "/" + name + ".js");
   } catch(e) {
-- 
GitLab