diff --git a/IPython/html/static/base/js/utils.js b/IPython/html/static/base/js/utils.js
index f974d87..4e60a96 100644
--- a/IPython/html/static/base/js/utils.js
+++ b/IPython/html/static/base/js/utils.js
@@ -616,11 +616,15 @@ define([
var modename = (typeof mode == "string") ? mode :
mode.mode || mode.name;
+ // simplest, cheapest check by mode name: mode may also have config
if (CodeMirror.modes.hasOwnProperty(modename)) {
- callback(mode);
+ // return the full mode object, if it has a name
+ callback(mode.name ? mode : modename);
return;
}
+ // *somehow* get back a CM.modeInfo-like object that has .mode and
+ // .mime
var info = (mode && mode.mode && mode.mime && mode) ||
CodeMirror.findModeByName(modename) ||
CodeMirror.findModeByExtension(modename.split(".").slice(-1)) ||
@@ -630,7 +634,11 @@ define([
require([
// might want to use CodeMirror.modeURL here
['codemirror/mode', info.mode, info.mode].join('/'),
- ], function() { callback(info.mime); }, errback
+ ], function() {
+ // return the original mode, as from a kernelspec on first load
+ // or the mimetype, as for most highlighting
+ callback(mode.name ? mode : info.mime);
+ }, errback
);
};
diff --git a/IPython/html/static/style/ipython.min.css b/IPython/html/static/style/ipython.min.css
index 913feb0..84654de 100644
--- a/IPython/html/static/style/ipython.min.css
+++ b/IPython/html/static/style/ipython.min.css
@@ -563,145 +563,103 @@ Original style from softwaremaniacs.org (c) Ivan Sagalaev