Skip to content

Commit b253179

Browse files
authored
Merge pull request #3847 from bollwyvl/gh-3829-lab4-mathjax
Try to use manager's latexTypesetter if window.MathJax is not defined
2 parents 52663ac + fb1d745 commit b253179

File tree

4 files changed

+40
-3
lines changed

4 files changed

+40
-3
lines changed

.binder/requirements.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
bqplot
22
ipyleaflet
33
jupyterlab-myst
4-
jupyterlab==4.0.2
4+
jupyterlab==4.0.7
55
matplotlib
6+
nbclassic
67
networkx
8+
notebook==7.0.5
79
numpy
810
pandas
911
scikit-image

.yarnrc.yml

+19
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,22 @@ packageExtensions:
1111
source-map-loader@^4:
1212
dependencies:
1313
webpack: ^5
14+
15+
enableTelemetry: false
16+
17+
httpTimeout: 60000
18+
19+
# these messages provide no actionable information, and make non-TTY output
20+
# almost unreadable, masking real dependency-related information
21+
# see: https://yarnpkg.com/advanced/error-codes
22+
logFilters:
23+
- code: YN0006 # SOFT_LINK_BUILD
24+
level: discard
25+
- code: YN0007 # MUST_BUILD
26+
level: discard
27+
- code: YN0008 # MUST_REBUILD
28+
level: discard
29+
- code: YN0013 # FETCH_NOT_CACHED
30+
level: discard
31+
- code: YN0019 # UNUSED_CACHE_ENTRY
32+
level: discard

dev-install.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/usr/bin/env bash
2-
32
# For a clean conda environment please read docs/source/dev_install.md
43

4+
set -x
5+
56
echo -n "Checking pip... "
67
pip --version
78
if [ $? -ne 0 ]; then
@@ -32,10 +33,13 @@ echo -n "widgetsnbextension"
3233
pip install -v -e ./python/widgetsnbextension
3334
if [[ "$OSTYPE" == "msys" ]]; then
3435
jupyter nbextension install --overwrite --py $nbExtFlags widgetsnbextension || true
36+
jupyter nbclassic-extension install --overwrite --py $nbExtFlags widgetsnbextension || true
3537
else
3638
jupyter nbextension install --overwrite --py --symlink $nbExtFlags widgetsnbextension || true
39+
jupyter nbclassic-extension install --overwrite --py --symlink $nbExtFlags widgetsnbextension || true
3740
fi
3841
jupyter nbextension enable --py $nbExtFlags widgetsnbextension || true
42+
jupyter nbclassic-extension enable --py $nbExtFlags widgetsnbextension || true
3943

4044
echo -n "ipywidgets"
4145
pip install -v -e "./python/ipywidgets[test]"

packages/controls/src/widget_description.ts

+13-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,19 @@ export class DescriptionView extends DOMWidgetView {
6666
}
6767

6868
typeset(element: HTMLElement, text?: string): void {
69-
this.displayed.then(() => typeset(element, text));
69+
this.displayed.then(() => {
70+
if ((window as any).MathJax?.Hub?.Queue) {
71+
return typeset(element, text);
72+
}
73+
const widget_manager: any = this.model.widget_manager;
74+
const latexTypesetter = widget_manager._rendermime?.latexTypesetter;
75+
if (latexTypesetter) {
76+
if (text !== void 0) {
77+
element.textContent = text;
78+
}
79+
latexTypesetter.typeset(element);
80+
}
81+
});
7082
}
7183

7284
updateDescription(): void {

0 commit comments

Comments
 (0)