Skip to content

Commit d515391

Browse files
committed
Merge pull request jupyter#27 from minrk/mathjax
add mathjax to components
2 parents c08d564 + 09fa6d0 commit d515391

File tree

5 files changed

+25
-22
lines changed

5 files changed

+25
-22
lines changed

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ before_install:
2020
- git clone --quiet --depth 1 https://github.com/minrk/travis-wheels travis-wheels
2121
install:
2222
- pip install -f travis-wheels/wheelhouse -r requirements.txt file://$PWD#egg=jupyter_notebook[test] coveralls
23-
before_script:
24-
- 'if [[ $GROUP == js* ]]; then python -m IPython.external.mathjax mathjax.zip; fi'
2523
script:
2624
- 'if [[ $GROUP == js* ]]; then python -m jupyter_notebook.jstest $GROUP; fi'
2725
- 'if [[ $GROUP == python ]]; then nosetests --with-coverage --cover-package=jupyter_notebook jupyter_notebook; fi'

bower.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"jquery": "components/jquery#~2.0",
1313
"jquery-ui": "components/jqueryui#~1.10",
1414
"marked": "~0.3",
15+
"MathJax": "~2.5",
1516
"moment": "~2.8.4",
1617
"requirejs": "~2.1",
1718
"term.js": "chjj/term.js#~0.0.4",

jupyter_notebook/notebookapp.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -617,26 +617,7 @@ def _mathjax_url_default(self):
617617
static_url_prefix = self.tornado_settings.get("static_url_prefix",
618618
url_path_join(self.base_url, "static")
619619
)
620-
621-
# try local mathjax, either in nbextensions/mathjax or static/mathjax
622-
for (url_prefix, search_path) in [
623-
(url_path_join(self.base_url, "nbextensions"), self.nbextensions_path),
624-
(static_url_prefix, self.static_file_path),
625-
]:
626-
self.log.debug("searching for local mathjax in %s", search_path)
627-
try:
628-
mathjax = filefind(os.path.join('mathjax', 'MathJax.js'), search_path)
629-
except IOError:
630-
continue
631-
else:
632-
url = url_path_join(url_prefix, u"mathjax/MathJax.js")
633-
self.log.info("Serving local MathJax from %s at %s", mathjax, url)
634-
return url
635-
636-
# no local mathjax, serve from CDN
637-
url = u"https://cdn.mathjax.org/mathjax/latest/MathJax.js"
638-
self.log.info("Using MathJax from CDN: %s", url)
639-
return url
620+
return url_path_join(static_url_prefix, 'components', 'MathJax', 'MathJax.js')
640621

641622
def _mathjax_url_changed(self, name, old, new):
642623
if new and not self.enable_mathjax:

jupyter_notebook/static/notebook/js/mathjaxutils.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ define([
2323
// we use CSS to left justify single line equations in code cells.
2424
displayAlign: 'center',
2525
"HTML-CSS": {
26+
availableFonts: [],
27+
imageFont: null,
28+
preferredFont: null,
29+
webFont: "STIX-Web",
2630
styles: {'.MathJax_Display': {"margin": 0}},
2731
linebreaks: { automatic: true }
2832
}

setupbase.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,25 @@ def find_package_data():
138138
if f.endswith(('.js', '.css')):
139139
static_data.append(pjoin(parent, f))
140140

141+
# Trim mathjax
142+
mj = lambda *path: pjoin(components, 'MathJax', *path)
143+
static_data.extend([
144+
mj('MathJax.js'),
145+
mj('config', 'TeX-AMS_HTML-full.js'),
146+
mj('jax', 'output', 'HTML-CSS', '*.js'),
147+
])
148+
for tree in [
149+
mj('localization'), # limit to en?
150+
mj('fonts', 'HTML-CSS', 'STIX-Web', 'woff'),
151+
mj('jax', 'input', 'TeX'),
152+
mj('jax', 'output', 'HTML-CSS', 'autoload'),
153+
mj('jax', 'output', 'HTML-CSS', 'fonts', 'STIX-Web'),
154+
]:
155+
for parent, dirs, files in os.walk(tree):
156+
for f in files:
157+
static_data.append(pjoin(parent, f))
158+
159+
141160
os.chdir(os.path.join('tests',))
142161
js_tests = glob('*.js') + glob('*/*.js')
143162

0 commit comments

Comments
 (0)