diff --git a/plugins/command-line/prism-command-line.js b/plugins/command-line/prism-command-line.js
index 3c77991461..69bc2a8daa 100644
--- a/plugins/command-line/prism-command-line.js
+++ b/plugins/command-line/prism-command-line.js
@@ -79,7 +79,7 @@ Prism.hooks.add('before-insert', function (env) {
// Reinsert the output lines into the highlighted code. -- cwells
var codeLines = env.highlightedCode.split('\n');
- for (var i = 0; i < commandLine.outputLines.length; i++) {
+ for (var i = 0, l = (commandLine.outputLines || []).length; i < l; i++) {
if (commandLine.outputLines.hasOwnProperty(i)) {
codeLines[i] = commandLine.outputLines[i];
}
@@ -107,7 +107,7 @@ Prism.hooks.add('complete', function (env) {
};
// Create the "rows" that will become the command-line prompts. -- cwells
- var promptLines = new Array(commandLine.numberOfLines + 1);
+ var promptLines = new Array((commandLine.numberOfLines || 0) + 1);
var promptText = getAttribute('data-prompt', '');
if (promptText !== '') {
promptLines = promptLines.join('');
@@ -123,7 +123,7 @@ Prism.hooks.add('complete', function (env) {
prompt.innerHTML = promptLines;
// Remove the prompt from the output lines. -- cwells
- for (var i = 0; i < commandLine.outputLines.length; i++) {
+ for (var i = 0, l = (commandLine.outputLines || []).length; i < l; i++) {
if (commandLine.outputLines.hasOwnProperty(i)) {
var node = prompt.children[i];
node.removeAttribute('data-user');
diff --git a/plugins/command-line/prism-command-line.min.js b/plugins/command-line/prism-command-line.min.js
index cd031b0ebd..2aa2544f59 100644
--- a/plugins/command-line/prism-command-line.min.js
+++ b/plugins/command-line/prism-command-line.min.js
@@ -1 +1 @@
-!function(){if("undefined"!=typeof self&&self.Prism&&self.document){var u=/(?:^|\s)command-line(?:\s|$)/;Prism.hooks.add("before-highlight",function(e){var t=e.vars=e.vars||{},a=t["command-line"]=t["command-line"]||{};if(!a.complete&&e.code){var n=e.element.parentNode;if(n&&/pre/i.test(n.nodeName)&&(u.test(n.className)||u.test(e.element.className)))if(e.element.querySelector(".command-line-prompt"))a.complete=!0;else{var r=e.code.split("\n");a.numberOfLines=r.length;var s=a.outputLines=[],o=n.getAttribute("data-output"),i=n.getAttribute("data-filter-output");if(o||""===o){o=o.split(",");for(var l=0;lr.length&&(d=r.length),d--;for(var c=--p;c<=d;c++)s[c]=r[c],r[c]=""}}}else if(i)for(l=0;l');else{var i=r("data-user","user"),l=r("data-host","localhost");s=s.join('')}var m=document.createElement("span");m.className="command-line-prompt",m.innerHTML=s;for(var p=0;pr.length&&(d=r.length),d--;for(var c=--p;c<=d;c++)s[c]=r[c],r[c]=""}}}else if(i)for(l=0;l');else{var i=r("data-user","user"),l=r("data-host","localhost");s=s.join('')}var m=document.createElement("span");m.className="command-line-prompt",m.innerHTML=s;for(var p=0,d=(a.outputLines||[]).length;p