Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add span with command-line-(input|output) class to command-line plugin lines #3312

Merged
merged 3 commits into from Feb 2, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions plugins/command-line/prism-command-line.js
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="command-line-output">'
+ outputLines[i] + '</span>';
} else {
codeLines[i] = '<span class="command-line-input">'
+ codeLines[i] + '</span>';
at055612 marked this conversation as resolved.
Show resolved Hide resolved
}
}
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.