Merge pull request #2186 from tonycpsu/master

Support underline and inverse in ANSI escape codes
pull/2188/head
Thomas Kluyver 9 years ago committed by GitHub
commit a33d136cb0

@ -282,6 +282,8 @@ define([
var fg = [];
var bg = [];
var bold = false;
var underline = false;
var inverse = false;
var match;
var out = [];
var numbers = [];
@ -330,6 +332,14 @@ define([
classes.push("ansi-bold");
}
if (underline) {
classes.push("ansi-underline");
}
if (inverse) {
classes.push("ansi-inverse");
}
if (classes.length || styles.length) {
out.push("<span");
if (classes.length) {
@ -353,11 +363,19 @@ define([
case 0:
fg = bg = [];
bold = false;
underline = false;
inverse = false;
break;
case 1:
case 5:
bold = true;
break;
case 4:
underline = true;
break;
case 7:
inverse = true;
break;
case 21:
case 22:
bold = false;

@ -21,6 +21,8 @@
.ansicolors(white, #C5C1B4, #A1A6B2);
.ansi-bold { font-weight: bold; }
.ansi-underline { text-decoration: underline; }
.ansi-inverse { outline: 0.5px dotted; }
/* The following styles are deprecated an will be removed in a future version */

@ -30,6 +30,42 @@
"RESET = ESC + \"00m\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Bold, underline and inverse text"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"This is normal text\n",
"\n",
"\u001b[01mThis is bold text\u001b[00m\n",
"\n",
"\u001b[04mThis is underlined text\u001b[00m\n",
"\n",
"\u001b[07mThis is inverse text\u001b[00m\n"
]
}
],
"source": [
"print (\"This is normal text\")\n",
"print()\n",
"print (\"{ESC}01mThis is bold text{RESET}\".format(**locals()))\n",
"print()\n",
"print (\"{ESC}04mThis is underlined text{RESET}\".format(**locals()))\n",
"print()\n",
"print (\"{ESC}07mThis is inverse text{RESET}\".format(**locals()))"
]
},
{
"cell_type": "markdown",
"metadata": {},

Loading…
Cancel
Save