Skip to content

Commit

Permalink
Command Line: Added span around command and output (#3312)
Browse files Browse the repository at this point in the history
  • Loading branch information
at055612 authored Feb 2, 2022
1 parent 2cc4660 commit 82d0ca1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions plugins/command-line/prism-command-line.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,14 @@
// Reinsert the output lines into the highlighted code. -- cwells
var codeLines = env.highlightedCode.split('\n');
var outputLines = commandLine.outputLines || [];
for (var i = 0, l = outputLines.length; i < l; i++) {
for (var i = 0, l = codeLines.length; i < l; i++) {
// Add spans to allow distinction of input/output text for styling
if (outputLines.hasOwnProperty(i)) {
codeLines[i] = outputLines[i];
codeLines[i] = '<span class="token output">'
+ outputLines[i] + '</span>';
} else {
codeLines[i] = '<span class="token command">'
+ codeLines[i] + '</span>';
}
}
env.highlightedCode = codeLines.join('\n');
Expand Down
2 changes: 1 addition & 1 deletion plugins/command-line/prism-command-line.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 82d0ca1

Please sign in to comment.