Skip to content

Commit

Permalink
Command Line: Correctly rehighlight elements (#2291)
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment committed Apr 7, 2020
1 parent 9a49f78 commit e6b2c6f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions plugins/command-line/prism-command-line.js
Expand Up @@ -23,9 +23,10 @@ Prism.hooks.add('before-highlight', function (env) {
return;
}

if (env.element.querySelector('.command-line-prompt')) { // Abort if prompt already exists.
commandLine.complete = true;
return;
// The element might be highlighted multiple times, so we just remove the previous prompt
var existingPrompt = env.element.querySelector('.command-line-prompt');
if (existingPrompt) {
existingPrompt.remove();
}

var codeLines = env.code.split('\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 e6b2c6f

Please sign in to comment.