From ca7c58b375817d75e3ac856607ba0fda5b342dc2 2014-07-22 20:49:52 From: Jason Grout Date: 2014-07-22 20:49:52 Subject: [PATCH] Add a requirejs shim for highlight.js Before this, highlighting code in markdown cells was broken since hljs wasn't available. A better solution might be to build the highlight.js amd module (i.e., build the highlight.js module with `--target=amd`) so that we don't need the shim. --- diff --git a/IPython/html/static/notebook/js/main.js b/IPython/html/static/notebook/js/main.js index b36dcfc..db747be 100644 --- a/IPython/html/static/notebook/js/main.js +++ b/IPython/html/static/notebook/js/main.js @@ -1,6 +1,12 @@ // Copyright (c) IPython Development Team. // Distributed under the terms of the Modified BSD License. +requirejs.config({ + shim: { + 'components/highlight.js/build/highlight.pack': {exports: 'hljs'} + } +}); + require([ 'base/js/namespace', 'jquery', diff --git a/IPython/html/static/notebook/js/notebook.js b/IPython/html/static/notebook/js/notebook.js index 8586eb6..d65da64 100644 --- a/IPython/html/static/notebook/js/notebook.js +++ b/IPython/html/static/notebook/js/notebook.js @@ -11,6 +11,7 @@ define([ 'services/sessions/js/session', 'notebook/js/celltoolbar', 'components/marked/lib/marked', + 'components/highlight.js/build/highlight.pack', 'notebook/js/mathjaxutils', 'base/js/keyboard', 'notebook/js/tooltip', @@ -27,6 +28,7 @@ define([ session, celltoolbar, marked, + hljs, mathjaxutils, keyboard, tooltip,