mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-18 11:55:46 +08:00
Merge pull request #3136 from jfeser/8b94eddb4d15ce6f0c98675116d4609bdaaf99d9
Strip useless ANSI escape codes in notebook ANSI color escape codes get handled specially by the notebook, but other kinds of codes just get printed out. Strip these codes out of the notebook output. closes #2385
This commit is contained in:
commit
a4b1bea069
@ -174,6 +174,12 @@ IPython.utils = (function (IPython) {
|
||||
var cmds = [];
|
||||
var opener = "";
|
||||
var closer = "";
|
||||
|
||||
// Strip all ANSI codes that are not color related. Matches
|
||||
// all ANSI codes that do not end with "m".
|
||||
var ignored_re = /(?=(\033\[[\d;=]*[a-ln-zA-Z]{1}))\1(?!m)/g;
|
||||
txt = txt.replace(ignored_re, "");
|
||||
|
||||
while (re.test(txt)) {
|
||||
var cmds = txt.match(re)[1].split(";");
|
||||
closer = opened?"</span>":"";
|
||||
|
Loading…
Reference in New Issue
Block a user