Skip to content

Commit

Permalink
Command Line: Don't modify empty code blocks (#2896)
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment authored May 24, 2021
1 parent 91f3aae commit c81c331
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions plugins/command-line/prism-command-line.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@
return s;
}

/**
* Returns whether the given hook environment has a command line info object.
*
* @param {any} env
* @returns {boolean}
*/
function hasCommandLineInfo(env) {
var vars = env.vars = env.vars || {};
return 'command-line' in vars;
}
/**
* Returns the command line info object from the given hook environment.
*
Expand Down Expand Up @@ -129,6 +139,11 @@
});

Prism.hooks.add('complete', function (env) {
if (!hasCommandLineInfo(env)) {
// the previous hooks never ran
return;
}

var commandLine = getCommandLineInfo(env);

if (commandLine.complete) {
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 c81c331

Please sign in to comment.