Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e6b2c6f

Browse files
Command Line: Correctly rehighlight elements (PrismJS#2291)
1 parent 9a49f78 commit e6b2c6f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ Prism.hooks.add('before-highlight', function (env) {
2323
return;
2424
}
2525

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

3132
var codeLines = env.code.split('\n');

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

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /