Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to use manager's latexTypesetter if window.MathJax is not defined #3847

Merged
merged 10 commits into from
Dec 19, 2023
Merged
4 changes: 3 additions & 1 deletion .binder/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
bqplot
ipyleaflet
jupyterlab-myst
jupyterlab==4.0.2
jupyterlab==4.0.7
matplotlib
nbclassic
networkx
notebook==7.0.5
numpy
pandas
scikit-image
Expand Down
19 changes: 19 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,22 @@ packageExtensions:
source-map-loader@^4:
dependencies:
webpack: ^5

enableTelemetry: false

httpTimeout: 60000

# these messages provide no actionable information, and make non-TTY output
# almost unreadable, masking real dependency-related information
# see: https://yarnpkg.com/advanced/error-codes
logFilters:
- code: YN0006 # SOFT_LINK_BUILD
level: discard
- code: YN0007 # MUST_BUILD
level: discard
- code: YN0008 # MUST_REBUILD
level: discard
- code: YN0013 # FETCH_NOT_CACHED
level: discard
- code: YN0019 # UNUSED_CACHE_ENTRY
level: discard
6 changes: 5 additions & 1 deletion dev-install.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env bash

# For a clean conda environment please read docs/source/dev_install.md

set -x

echo -n "Checking pip... "
pip --version
if [ $? -ne 0 ]; then
Expand Down Expand Up @@ -32,10 +33,13 @@ echo -n "widgetsnbextension"
pip install -v -e ./python/widgetsnbextension
if [[ "$OSTYPE" == "msys" ]]; then
jupyter nbextension install --overwrite --py $nbExtFlags widgetsnbextension || true
jupyter nbclassic-extension install --overwrite --py $nbExtFlags widgetsnbextension || true
else
jupyter nbextension install --overwrite --py --symlink $nbExtFlags widgetsnbextension || true
jupyter nbclassic-extension install --overwrite --py --symlink $nbExtFlags widgetsnbextension || true
fi
jupyter nbextension enable --py $nbExtFlags widgetsnbextension || true
jupyter nbclassic-extension enable --py $nbExtFlags widgetsnbextension || true

echo -n "ipywidgets"
pip install -v -e "./python/ipywidgets[test]"
Expand Down
14 changes: 13 additions & 1 deletion packages/controls/src/widget_description.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,19 @@ export class DescriptionView extends DOMWidgetView {
}

typeset(element: HTMLElement, text?: string): void {
this.displayed.then(() => typeset(element, text));
this.displayed.then(() => {
if ((window as any).MathJax?.Hub?.Queue) {
return typeset(element, text);
}
const widget_manager: any = this.model.widget_manager;
const latexTypesetter = widget_manager._rendermime?.latexTypesetter;
if (latexTypesetter) {
if (text !== void 0) {
element.textContent = text;
}
latexTypesetter.typeset(element);
}
});
}

updateDescription(): void {
Expand Down