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

Command Line: Escape markup in command line output #3341

Merged
merged 1 commit into from Feb 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 3 additions & 1 deletion plugins/command-line/prism-command-line.js
Expand Up @@ -143,8 +143,10 @@
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)) {
// outputLines were removed from codeLines so missed out on escaping
// of markup so do it here.
codeLines[i] = '<span class="token output">'
+ outputLines[i] + '</span>';
+ Prism.util.encode(outputLines[i]) + '</span>';
} else {
codeLines[i] = '<span class="token command">'
+ codeLines[i] + '</span>';
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.