Skip to content

Commit

Permalink
remove old syntax when new is added #573
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Jul 4, 2020
1 parent afdf351 commit a0bc2f0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
## 2.17.6
### Bugfix
* fix adding duplicated prism formatters [#573](https://github.com/jcubic/jquery.terminal/issues/573)

## 2.17.5
### Bugfix
* fix eating last bracket from split_equal [#597](https://github.com/jcubic/jquery.terminal/issues/597)
Expand Down
10 changes: 9 additions & 1 deletion js/prism.js
Expand Up @@ -182,10 +182,18 @@
// we create function with name so we will see it in developer tools
// we bind jQuery as argument so it will work when jQuery with noConflict
// is added after this script
var fn = new Function('$', 'return function syntax_' + language +
var name = 'syntax_' + language;
var fn = new Function('$', 'return function ' + name +
'(string) { return $.terminal.prism("' + language +
'", string); }')($);
fn.__no_warn__ = true;
var formatters = $.terminal.defaults.formatters;
$.terminal.defaults.formatters = formatters.filter(function(formatter) {
if (typeof formatter !== 'function') {
return true;
}
return formatter.name !== name;
});
// disable warning because it may create nested formatting
$.terminal.new_formatter(fn);
};
Expand Down

0 comments on commit a0bc2f0

Please sign in to comment.