Skip to content

Commit

Permalink
Merge pull request jupyter-widgets#3847 from bollwyvl/jupyter-widgets…
Browse files Browse the repository at this point in the history
…gh-3829-lab4-mathjax

Try to use manager's latexTypesetter if window.MathJax is not defined
  • Loading branch information
ibdafna authored Dec 19, 2023
2 parents 52663ac + fb1d745 commit b253179
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 3 deletions.
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

0 comments on commit b253179

Please sign in to comment.