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

Add enable_mathjax and set it and inline to False #5729

Merged
merged 2 commits into from
Jun 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion holoviews/ipython/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ class notebook_extension(extension):
Whether to monkey patch IPython to use the correct tab-completion
behavior. """)

enable_mathjax = param.Boolean(default=False, doc="""
Whether to load bokeh-mathjax bundle in the notebook.""")

_loaded = False

def __call__(self, *args, **params):
Expand Down Expand Up @@ -183,7 +186,7 @@ def __call__(self, *args, **params):
same_cell_execution = getattr(self, '_repeat_execution_in_cell', False)
for r in [r for r in resources if r != 'holoviews']:
Store.renderers[r].load_nb(inline=p.inline)
Renderer.load_nb(inline=p.inline, reloading=same_cell_execution)
Renderer.load_nb(inline=p.inline, reloading=same_cell_execution, enable_mathjax=self.enable_mathjax)

if hasattr(ip, 'kernel') and not loaded:
Renderer.comm_manager.get_client_comm(notebook_extension._process_comm_msg,
Expand Down
6 changes: 4 additions & 2 deletions holoviews/plotting/renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,12 +642,14 @@ def validate(cls, options):
return options

@classmethod
def load_nb(cls, inline=True, reloading=False):
def load_nb(cls, inline=False, reloading=False, enable_mathjax=False):
"""
Loads any resources required for display of plots
in the Jupyter notebook
"""
if panel_version > Version('1.0.0rc1'):
if panel_version >= Version('1.0.2'):
load_notebook(inline, reloading=reloading, enable_mathjax=enable_mathjax)
elif panel_version >= Version('1.0.0'):
load_notebook(inline, reloading=reloading)
elif reloading:
return
Expand Down