---
plugins/command-line/index.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/command-line/index.html b/plugins/command-line/index.html
index 9e90f0043a..df83ec7b86 100644
--- a/plugins/command-line/index.html
+++ b/plugins/command-line/index.html
@@ -50,7 +50,7 @@ How to use
Optional: To automatically present some lines as output, you can prefix those lines with any string and specify the prefix using the data-filter-output
attribute on the <pre>
element. For example, data-filter-output="(out)"
will treat lines beginning with (out)
as output and remove the prefix.
- Optional: For multi-line commands you can specify the data-continuation-str
attribute on the <pre>
element. For example, data-continuation-str="\"
will treat lines ending with \
as being continued on the following line. Continued lines will have a prompt as set by the attribute data-continuation-prompt
or a default of >
.
+ Optional: For multi-line commands you can specify the data-continuation-str
attribute on the <pre>
element. For example, data-continuation-str="\"
will treat lines ending with \
as being continued on the following line. Continued lines will have a prompt as set by the attribute data-continuation-prompt
or a default of >
.
From eb30fbf471e4ca4334f85074e8c8b695036fbd5a Mon Sep 17 00:00:00 2001
From: at055612 <22818309+at055612@users.noreply.github.com>
Date: Thu, 10 Feb 2022 10:02:25 +0000
Subject: [PATCH 05/13] Command Line: Add polyfill for endsWith, [] => Set,
rename variable
---
plugins/command-line/prism-command-line.js | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/plugins/command-line/prism-command-line.js b/plugins/command-line/prism-command-line.js
index c10b30118d..cbd089a772 100644
--- a/plugins/command-line/prism-command-line.js
+++ b/plugins/command-line/prism-command-line.js
@@ -4,6 +4,16 @@
return;
}
+ // Polyfill for pre-ES6 Support, i.e. Internet Explorer
+ if (!String.prototype.endsWith) {
+ String.prototype.endsWith = function (search, this_len) {
+ if (this_len === undefined || this_len > this.length) {
+ this_len = this.length;
+ }
+ return this.substring(this_len - search.length, this_len) === search;
+ };
+ }
+
var CLASS_PATTERN = /(?:^|\s)command-line(?:\s|$)/;
var PROMPT_CLASS = 'command-line-prompt';
@@ -64,15 +74,16 @@
var codeLines = env.code.split('\n');
/** @type {int[]} */
- var continuationLineIdxs = commandLine.continuationLineIdxs = [];
+ var continuationLineIndicies = commandLine.continuationLineIndicies = new Set();
var lineContinuationStr = pre.getAttribute('data-continuation-str');
// Identify code lines that are a continuation line and thus don't need
// a prompt
if (lineContinuationStr && codeLines.length > 1) {
for (var j = 1; j < codeLines.length; j++) {
- if (codeLines.hasOwnProperty(j - 1) && codeLines[j - 1].endsWith(lineContinuationStr)) {
- continuationLineIdxs.push(j);
+ if (codeLines.hasOwnProperty(j - 1)
+ && codeLines[j - 1].endsWith(lineContinuationStr)) {
+ continuationLineIndicies.add(j);
}
}
}
@@ -178,13 +189,13 @@
promptLine = '';
}
- var continuationLineIdxs = commandLine.continuationLineIdxs || [];
+ var continuationLineIndicies = commandLine.continuationLineIndicies || new Set();
var continuationPromptText = getAttribute('data-continuation-prompt', '>');
var continuationPromptLine = '';
// Assemble all the appropriate prompt/continuation lines
for (var j = 0; j < rowCount; j++) {
- if (continuationLineIdxs.includes(j)) {
+ if (continuationLineIndicies.has(j)) {
promptLines += continuationPromptLine;
} else {
promptLines += promptLine;
From 7dcdb9516377636d4bbcc77540f74ed08a665a4a Mon Sep 17 00:00:00 2001
From: at055612 <22818309+at055612@users.noreply.github.com>
Date: Thu, 10 Feb 2022 10:04:54 +0000
Subject: [PATCH 06/13] Command Line: Change to use opacity and prevent
selection on output
Opacity works better with the different themes.
Preventing user-select on shell output allows you to copy just the
commands for pasting into a shell.
---
plugins/command-line/prism-command-line.css | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/plugins/command-line/prism-command-line.css b/plugins/command-line/prism-command-line.css
index 3934918a0f..08a188e6f9 100644
--- a/plugins/command-line/prism-command-line.css
+++ b/plugins/command-line/prism-command-line.css
@@ -15,7 +15,7 @@
}
.command-line-prompt > span:before {
- color: #999;
+ opacity: 0.4;
content: ' ';
display: block;
padding-right: 0.8em;
@@ -36,3 +36,10 @@
.command-line-prompt > span[data-continuation-prompt]:before {
content: attr(data-continuation-prompt);
}
+
+.command-line span.token.output {
+ /* Make shell output a bit lighter to distinguish them from shell commands */
+ opacity: 0.7;
+ /* Ignore shell output lines when selecting to copy/paste */
+ user-select: none;
+}
From d2b5b5575702aba2aa85ce4b0bfe4ae5f142a45b Mon Sep 17 00:00:00 2001
From: at055612 <22818309+at055612@users.noreply.github.com>
Date: Thu, 10 Feb 2022 10:10:53 +0000
Subject: [PATCH 07/13] Command Line: Rebuild minified files
---
plugins/command-line/prism-command-line.min.css | 2 +-
plugins/command-line/prism-command-line.min.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/plugins/command-line/prism-command-line.min.css b/plugins/command-line/prism-command-line.min.css
index 6cecc806ac..e904d02086 100644
--- a/plugins/command-line/prism-command-line.min.css
+++ b/plugins/command-line/prism-command-line.min.css
@@ -1 +1 @@
-.command-line-prompt{border-right:1px solid #999;display:block;float:left;font-size:100%;letter-spacing:-1px;margin-right:1em;pointer-events:none;text-align:right;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.command-line-prompt>span:before{color:#999;content:' ';display:block;padding-right:.8em}.command-line-prompt>span[data-user]:before{content:"[" attr(data-user) "@" attr(data-host) "] $"}.command-line-prompt>span[data-user=root]:before{content:"[" attr(data-user) "@" attr(data-host) "] #"}.command-line-prompt>span[data-prompt]:before{content:attr(data-prompt)}.command-line-prompt>span[data-continuation-prompt]:before{content:attr(data-continuation-prompt)}
\ No newline at end of file
+.command-line-prompt{border-right:1px solid #999;display:block;float:left;font-size:100%;letter-spacing:-1px;margin-right:1em;pointer-events:none;text-align:right;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.command-line-prompt>span:before{opacity:.4;content:' ';display:block;padding-right:.8em}.command-line-prompt>span[data-user]:before{content:"[" attr(data-user) "@" attr(data-host) "] $"}.command-line-prompt>span[data-user=root]:before{content:"[" attr(data-user) "@" attr(data-host) "] #"}.command-line-prompt>span[data-prompt]:before{content:attr(data-prompt)}.command-line-prompt>span[data-continuation-prompt]:before{content:attr(data-continuation-prompt)}.command-line span.token.output{opacity:.7;user-select:none}
\ No newline at end of file
diff --git a/plugins/command-line/prism-command-line.min.js b/plugins/command-line/prism-command-line.min.js
index 9570d5e544..44f47e0361 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 Prism&&"undefined"!=typeof document){var v=/(?:^|\s)command-line(?:\s|$)/,g="command-line-prompt",p="".startsWith?function(e,t){return e.startsWith(t)}:function(e,t){return 0===e.indexOf(t)};Prism.hooks.add("before-highlight",function(e){var t=N(e);if(!t.complete&&e.code){var n=e.element.parentElement;if(n&&/pre/i.test(n.nodeName)&&(v.test(n.className)||v.test(e.element.className))){var a=e.element.querySelector("."+g);a&&a.remove();var s=e.code.split("\n"),r=t.continuationLineIdxs=[],o=n.getAttribute("data-continuation-str");if(o&&1s.length&&(a=s.length),a--;for(var r=--n;r<=a;r++)l[r]=s[r],s[r]=""}});else if(u)for(var c=0;c'+a[r]+"":n[r]=''+n[r]+"";e.highlightedCode=n.join("\n")}}),Prism.hooks.add("complete",function(e){if(function(e){return"command-line"in(e.vars=e.vars||{})}(e)){var t=N(e);if(!t.complete){var n=e.element.parentElement;v.test(e.element.className)&&(e.element.className=e.element.className.replace(v," ")),v.test(n.className)||(n.className+=" command-line");var a,r="",s=t.numberOfLines||0,o=h("data-prompt","");if(""!==o)a='';else a='';for(var i=t.continuationLineIdxs||[],l='")+'">',m=0;mthis.length)&&(t=this.length),this.substring(t-e.length,t)===e});var v=/(?:^|\s)command-line(?:\s|$)/,g="command-line-prompt",u="".startsWith?function(e,t){return e.startsWith(t)}:function(e,t){return 0===e.indexOf(t)};Prism.hooks.add("before-highlight",function(e){var t=N(e);if(!t.complete&&e.code){var n=e.element.parentElement;if(n&&/pre/i.test(n.nodeName)&&(v.test(n.className)||v.test(e.element.className))){var a=e.element.querySelector("."+g);a&&a.remove();var i=e.code.split("\n"),r=t.continuationLineIndicies=new Set,s=n.getAttribute("data-continuation-str");if(s&&1i.length&&(a=i.length),a--;for(var r=--n;r<=a;r++)l[r]=i[r],i[r]=""}});else if(p)for(var c=0;c'+a[r]+"":n[r]=''+n[r]+"";e.highlightedCode=n.join("\n")}}),Prism.hooks.add("complete",function(e){if(function(e){return"command-line"in(e.vars=e.vars||{})}(e)){var t=N(e);if(!t.complete){var n=e.element.parentElement;v.test(e.element.className)&&(e.element.className=e.element.className.replace(v," ")),v.test(n.className)||(n.className+=" command-line");var a,r="",i=t.numberOfLines||0,s=f("data-prompt","");if(""!==s)a='';else a='';for(var o=t.continuationLineIndicies||new Set,l='")+'">',m=0;m
Date: Thu, 10 Feb 2022 11:34:19 +0000
Subject: [PATCH 08/13] Command Line: Change Set to sparse [] to avoid eslint
errors
Also improve help page.
---
plugins/command-line/index.html | 3 +++
plugins/command-line/prism-command-line.js | 12 +++++++-----
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/plugins/command-line/index.html b/plugins/command-line/index.html
index df83ec7b86..33f6db12fc 100644
--- a/plugins/command-line/index.html
+++ b/plugins/command-line/index.html
@@ -50,6 +50,8 @@ How to use
Optional: To automatically present some lines as output, you can prefix those lines with any string and specify the prefix using the data-filter-output
attribute on the <pre>
element. For example, data-filter-output="(out)"
will treat lines beginning with (out)
as output and remove the prefix.
+ Output lines are not user selectable so that you can select the whole content of the code block and only copy the shell commands, ignoreing any output lines. If you want the output to also be selectable then override the user-select
CSS property for .command-line span.token.output
.
+
Optional: For multi-line commands you can specify the data-continuation-str
attribute on the <pre>
element. For example, data-continuation-str="\"
will treat lines ending with \
as being continued on the following line. Continued lines will have a prompt as set by the attribute data-continuation-prompt
or a default of >
.
@@ -99,6 +101,7 @@ Line continuation with Output (bash)
two \
three
(out)one two three
+(out)
echo "goodbye"
(out)goodbye
diff --git a/plugins/command-line/prism-command-line.js b/plugins/command-line/prism-command-line.js
index cbd089a772..8d91d84ac5 100644
--- a/plugins/command-line/prism-command-line.js
+++ b/plugins/command-line/prism-command-line.js
@@ -73,8 +73,9 @@
var codeLines = env.code.split('\n');
- /** @type {int[]} */
- var continuationLineIndicies = commandLine.continuationLineIndicies = new Set();
+ // Sparse array holding true if the line at that position is a continuation
+ /** @type {boolean[]} */
+ var continuationLinePositions = commandLine.continuationLinePositions = [];
var lineContinuationStr = pre.getAttribute('data-continuation-str');
// Identify code lines that are a continuation line and thus don't need
@@ -83,7 +84,8 @@
for (var j = 1; j < codeLines.length; j++) {
if (codeLines.hasOwnProperty(j - 1)
&& codeLines[j - 1].endsWith(lineContinuationStr)) {
- continuationLineIndicies.add(j);
+ // Mark this line as being a continuation line
+ continuationLinePositions[j] = true;
}
}
}
@@ -189,13 +191,13 @@
promptLine = '';
}
- var continuationLineIndicies = commandLine.continuationLineIndicies || new Set();
+ var continuationLinePositions = commandLine.continuationLinePositions || [];
var continuationPromptText = getAttribute('data-continuation-prompt', '>');
var continuationPromptLine = '';
// Assemble all the appropriate prompt/continuation lines
for (var j = 0; j < rowCount; j++) {
- if (continuationLineIndicies.has(j)) {
+ if (continuationLinePositions.hasOwnProperty(j)) {
promptLines += continuationPromptLine;
} else {
promptLines += promptLine;
From b0b87bc3b5f9fa29d5f1825e5ea03966d5f9ff69 Mon Sep 17 00:00:00 2001
From: at055612 <22818309+at055612@users.noreply.github.com>
Date: Thu, 10 Feb 2022 11:51:19 +0000
Subject: [PATCH 09/13] Command Line: Remove user-select:none from output,
reword help
---
plugins/command-line/index.html | 5 ++++-
plugins/command-line/prism-command-line.css | 2 --
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/plugins/command-line/index.html b/plugins/command-line/index.html
index 33f6db12fc..7ec06c7e43 100644
--- a/plugins/command-line/index.html
+++ b/plugins/command-line/index.html
@@ -50,7 +50,10 @@ How to use
Optional: To automatically present some lines as output, you can prefix those lines with any string and specify the prefix using the data-filter-output
attribute on the <pre>
element. For example, data-filter-output="(out)"
will treat lines beginning with (out)
as output and remove the prefix.
- Output lines are not user selectable so that you can select the whole content of the code block and only copy the shell commands, ignoreing any output lines. If you want the output to also be selectable then override the user-select
CSS property for .command-line span.token.output
.
+ Output lines are user selectable by default, so if you select the whole content of the code block, it will select the shell commands and any output lines. This may not be desireable if you want to copy/paste just the commands and not the output. If you want to make the output not user selectable then add the following to your CSS.
+ .command-line span.token.output {
+ user-select: none;
+}
Optional: For multi-line commands you can specify the data-continuation-str
attribute on the <pre>
element. For example, data-continuation-str="\"
will treat lines ending with \
as being continued on the following line. Continued lines will have a prompt as set by the attribute data-continuation-prompt
or a default of >
.
diff --git a/plugins/command-line/prism-command-line.css b/plugins/command-line/prism-command-line.css
index 08a188e6f9..2de8687e87 100644
--- a/plugins/command-line/prism-command-line.css
+++ b/plugins/command-line/prism-command-line.css
@@ -40,6 +40,4 @@
.command-line span.token.output {
/* Make shell output a bit lighter to distinguish them from shell commands */
opacity: 0.7;
- /* Ignore shell output lines when selecting to copy/paste */
- user-select: none;
}
From 814c6f394bb5383973277e6287fd7f2e95bbc8c6 Mon Sep 17 00:00:00 2001
From: at055612 <22818309+at055612@users.noreply.github.com>
Date: Thu, 10 Feb 2022 12:20:43 +0000
Subject: [PATCH 10/13] Command Line: Remove pointless
---
plugins/command-line/index.html | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/plugins/command-line/index.html b/plugins/command-line/index.html
index 7ec06c7e43..c8cd9c44be 100644
--- a/plugins/command-line/index.html
+++ b/plugins/command-line/index.html
@@ -50,10 +50,11 @@
How to use
Optional: To automatically present some lines as output, you can prefix those lines with any string and specify the prefix using the data-filter-output
attribute on the <pre>
element. For example, data-filter-output="(out)"
will treat lines beginning with (out)
as output and remove the prefix.
- Output lines are user selectable by default, so if you select the whole content of the code block, it will select the shell commands and any output lines. This may not be desireable if you want to copy/paste just the commands and not the output. If you want to make the output not user selectable then add the following to your CSS.
- .command-line span.token.output {
+ Output lines are user selectable by default, so if you select the whole content of the code block, it will select the shell commands and any output lines. This may not be desireable if you want to copy/paste just the commands and not the output. If you want to make the output not user selectable then add the following to your CSS:
+
+ .command-line span.token.output {
user-select: none;
-}
+}
Optional: For multi-line commands you can specify the data-continuation-str
attribute on the <pre>
element. For example, data-continuation-str="\"
will treat lines ending with \
as being continued on the following line. Continued lines will have a prompt as set by the attribute data-continuation-prompt
or a default of >
.
From 49a26cd15c4af7e448c706b08e6be9c3bf673984 Mon Sep 17 00:00:00 2001
From: at055612 <22818309+at055612@users.noreply.github.com>
Date: Thu, 10 Feb 2022 12:21:25 +0000
Subject: [PATCH 11/13] Command Line: Swap [] => Set now eslint is fixed to
allow it
---
plugins/command-line/prism-command-line.js | 11 ++++-------
plugins/command-line/prism-command-line.min.css | 2 +-
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/plugins/command-line/prism-command-line.js b/plugins/command-line/prism-command-line.js
index 8d91d84ac5..58df662617 100644
--- a/plugins/command-line/prism-command-line.js
+++ b/plugins/command-line/prism-command-line.js
@@ -73,9 +73,7 @@
var codeLines = env.code.split('\n');
- // Sparse array holding true if the line at that position is a continuation
- /** @type {boolean[]} */
- var continuationLinePositions = commandLine.continuationLinePositions = [];
+ var continuationLineIndicies = commandLine.continuationLineIndicies = new Set();
var lineContinuationStr = pre.getAttribute('data-continuation-str');
// Identify code lines that are a continuation line and thus don't need
@@ -85,7 +83,7 @@
if (codeLines.hasOwnProperty(j - 1)
&& codeLines[j - 1].endsWith(lineContinuationStr)) {
// Mark this line as being a continuation line
- continuationLinePositions[j] = true;
+ continuationLineIndicies.add(j);
}
}
}
@@ -191,13 +189,13 @@
promptLine = '';
}
- var continuationLinePositions = commandLine.continuationLinePositions || [];
+ var continuationLineIndicies = commandLine.continuationLineIndicies || new Set();
var continuationPromptText = getAttribute('data-continuation-prompt', '>');
var continuationPromptLine = '';
// Assemble all the appropriate prompt/continuation lines
for (var j = 0; j < rowCount; j++) {
- if (continuationLinePositions.hasOwnProperty(j)) {
+ if (continuationLineIndicies.has(j)) {
promptLines += continuationPromptLine;
} else {
promptLines += promptLine;
@@ -225,4 +223,3 @@
});
}());
-// vim: set tabstop=2 shiftwidth=2 noexpandtab:
diff --git a/plugins/command-line/prism-command-line.min.css b/plugins/command-line/prism-command-line.min.css
index e904d02086..5e5c875d7e 100644
--- a/plugins/command-line/prism-command-line.min.css
+++ b/plugins/command-line/prism-command-line.min.css
@@ -1 +1 @@
-.command-line-prompt{border-right:1px solid #999;display:block;float:left;font-size:100%;letter-spacing:-1px;margin-right:1em;pointer-events:none;text-align:right;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.command-line-prompt>span:before{opacity:.4;content:' ';display:block;padding-right:.8em}.command-line-prompt>span[data-user]:before{content:"[" attr(data-user) "@" attr(data-host) "] $"}.command-line-prompt>span[data-user=root]:before{content:"[" attr(data-user) "@" attr(data-host) "] #"}.command-line-prompt>span[data-prompt]:before{content:attr(data-prompt)}.command-line-prompt>span[data-continuation-prompt]:before{content:attr(data-continuation-prompt)}.command-line span.token.output{opacity:.7;user-select:none}
\ No newline at end of file
+.command-line-prompt{border-right:1px solid #999;display:block;float:left;font-size:100%;letter-spacing:-1px;margin-right:1em;pointer-events:none;text-align:right;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.command-line-prompt>span:before{opacity:.4;content:' ';display:block;padding-right:.8em}.command-line-prompt>span[data-user]:before{content:"[" attr(data-user) "@" attr(data-host) "] $"}.command-line-prompt>span[data-user=root]:before{content:"[" attr(data-user) "@" attr(data-host) "] #"}.command-line-prompt>span[data-prompt]:before{content:attr(data-prompt)}.command-line-prompt>span[data-continuation-prompt]:before{content:attr(data-continuation-prompt)}.command-line span.token.output{opacity:.7}
\ No newline at end of file
From 702d560949af100c84a62cb64de0a0b198711de8 Mon Sep 17 00:00:00 2001
From: at055612 <22818309+at055612@users.noreply.github.com>
Date: Thu, 10 Feb 2022 15:25:41 +0000
Subject: [PATCH 12/13] Command Line: Replace spaces with tab
---
plugins/command-line/prism-command-line.css | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/command-line/prism-command-line.css b/plugins/command-line/prism-command-line.css
index 2de8687e87..984a718c1f 100644
--- a/plugins/command-line/prism-command-line.css
+++ b/plugins/command-line/prism-command-line.css
@@ -38,6 +38,6 @@
}
.command-line span.token.output {
- /* Make shell output a bit lighter to distinguish them from shell commands */
+ /* Make shell output lines a bit lighter to distinguish them from shell commands */
opacity: 0.7;
}
From 88cd35da3612b5795ff94f35fb8bc7cab129c270 Mon Sep 17 00:00:00 2001
From: at055612 <22818309+at055612@users.noreply.github.com>
Date: Thu, 10 Feb 2022 15:26:53 +0000
Subject: [PATCH 13/13] Command Line: Remove endsWith polyfill
---
plugins/command-line/prism-command-line.js | 23 ++++++++++---------
.../command-line/prism-command-line.min.js | 2 +-
2 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/plugins/command-line/prism-command-line.js b/plugins/command-line/prism-command-line.js
index 58df662617..6437775ce5 100644
--- a/plugins/command-line/prism-command-line.js
+++ b/plugins/command-line/prism-command-line.js
@@ -4,16 +4,6 @@
return;
}
- // Polyfill for pre-ES6 Support, i.e. Internet Explorer
- if (!String.prototype.endsWith) {
- String.prototype.endsWith = function (search, this_len) {
- if (this_len === undefined || this_len > this.length) {
- this_len = this.length;
- }
- return this.substring(this_len - search.length, this_len) === search;
- };
- }
-
var CLASS_PATTERN = /(?:^|\s)command-line(?:\s|$)/;
var PROMPT_CLASS = 'command-line-prompt';
@@ -22,6 +12,17 @@
? function (s, p) { return s.startsWith(p); }
: function (s, p) { return s.indexOf(p) === 0; };
+ // Support for IE11 that has no endsWith()
+ /** @type {(str: string, suffix: string) => boolean} */
+ var endsWith = ''.endsWith
+ ? function (str, suffix) {
+ return str.endsWith(suffix);
+ }
+ : function (str, suffix) {
+ var len = str.length;
+ return str.substring(len - suffix.length, len) === suffix;
+ };
+
/**
* Returns whether the given hook environment has a command line info object.
*
@@ -81,7 +82,7 @@
if (lineContinuationStr && codeLines.length > 1) {
for (var j = 1; j < codeLines.length; j++) {
if (codeLines.hasOwnProperty(j - 1)
- && codeLines[j - 1].endsWith(lineContinuationStr)) {
+ && endsWith(codeLines[j - 1], lineContinuationStr)) {
// Mark this line as being a continuation line
continuationLineIndicies.add(j);
}
diff --git a/plugins/command-line/prism-command-line.min.js b/plugins/command-line/prism-command-line.min.js
index 44f47e0361..ee6e6a47e7 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 Prism&&"undefined"!=typeof document){String.prototype.endsWith||(String.prototype.endsWith=function(e,t){return(void 0===t||t>this.length)&&(t=this.length),this.substring(t-e.length,t)===e});var v=/(?:^|\s)command-line(?:\s|$)/,g="command-line-prompt",u="".startsWith?function(e,t){return e.startsWith(t)}:function(e,t){return 0===e.indexOf(t)};Prism.hooks.add("before-highlight",function(e){var t=N(e);if(!t.complete&&e.code){var n=e.element.parentElement;if(n&&/pre/i.test(n.nodeName)&&(v.test(n.className)||v.test(e.element.className))){var a=e.element.querySelector("."+g);a&&a.remove();var i=e.code.split("\n"),r=t.continuationLineIndicies=new Set,s=n.getAttribute("data-continuation-str");if(s&&1i.length&&(a=i.length),a--;for(var r=--n;r<=a;r++)l[r]=i[r],i[r]=""}});else if(p)for(var c=0;c'+a[r]+"":n[r]=''+n[r]+"";e.highlightedCode=n.join("\n")}}),Prism.hooks.add("complete",function(e){if(function(e){return"command-line"in(e.vars=e.vars||{})}(e)){var t=N(e);if(!t.complete){var n=e.element.parentElement;v.test(e.element.className)&&(e.element.className=e.element.className.replace(v," ")),v.test(n.className)||(n.className+=" command-line");var a,r="",i=t.numberOfLines||0,s=f("data-prompt","");if(""!==s)a='';else a='';for(var o=t.continuationLineIndicies||new Set,l='")+'">',m=0;mi.length&&(a=i.length),a--;for(var r=--n;r<=a;r++)l[r]=i[r],i[r]=""}});else if(u)for(var c=0;c'+a[r]+"":n[r]=''+n[r]+"";e.highlightedCode=n.join("\n")}}),Prism.hooks.add("complete",function(e){if(function(e){return"command-line"in(e.vars=e.vars||{})}(e)){var t=N(e);if(!t.complete){var n=e.element.parentElement;v.test(e.element.className)&&(e.element.className=e.element.className.replace(v," ")),v.test(n.className)||(n.className+=" command-line");var a,r="",i=t.numberOfLines||0,s=h("data-prompt","");if(""!==s)a='';else a='';for(var o=t.continuationLineIndicies||new Set,l='")+'">',m=0;m