Skip to content

Commit 82d0ca1

Browse files
authored
Command Line: Added span around command and output (#3312)
1 parent 2cc4660 commit 82d0ca1

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

plugins/command-line/prism-command-line.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,14 @@
130130
// Reinsert the output lines into the highlighted code. -- cwells
131131
var codeLines = env.highlightedCode.split('\n');
132132
var outputLines = commandLine.outputLines || [];
133-
for (var i = 0, l = outputLines.length; i < l; i++) {
133+
for (var i = 0, l = codeLines.length; i < l; i++) {
134+
// Add spans to allow distinction of input/output text for styling
134135
if (outputLines.hasOwnProperty(i)) {
135-
codeLines[i] = outputLines[i];
136+
codeLines[i] = '<span class="token output">'
137+
+ outputLines[i] + '</span>';
138+
} else {
139+
codeLines[i] = '<span class="token command">'
140+
+ codeLines[i] + '</span>';
136141
}
137142
}
138143
env.highlightedCode = codeLines.join('\n');

plugins/command-line/prism-command-line.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)