A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
fix: add mathjax ignore so code does not get malformed (#4610)
Myles Scolnicke11525e81a1e
diff --git a/frontend/src/components/editor/app-container.tsx b/frontend/src/components/editor/app-container.tsxindex fd51682c19..5f36c3488f 100644--- a/frontend/src/components/editor/app-container.tsx+++ b/frontend/src/components/editor/app-container.tsx@@ -34,6 +34,7 @@ export const AppContainer: React.FC<PropsWithChildren<Props>> = ({data-config-width={width}data-connection-state={connectionState}className={cn(+ "mathjax_ignore",connectionState === WebSocketState.CLOSED && "disconnected","bg-background w-full h-full text-textColor","flex flex-col overflow-y-auto",diff --git a/frontend/src/components/editor/cell/code/cell-editor.tsx b/frontend/src/components/editor/cell/code/cell-editor.tsxindex 2a95e039c3..a596311a5d 100644--- a/frontend/src/components/editor/cell/code/cell-editor.tsx+++ b/frontend/src/components/editor/cell/code/cell-editor.tsx@@ -476,7 +476,7 @@ const CellCodeMirrorEditor = React.forwardRef(return (<div- className={cn("cm", className)}+ className={cn("cm mathjax_ignore", className)}ref={(r) => {if (ref) {mergeRefs(ref, internalRef)(r);diff --git a/frontend/src/plugins/impl/plotly/PlotlyPlugin.tsx b/frontend/src/plugins/impl/plotly/PlotlyPlugin.tsxindex 574a81a8e4..7496acca21 100644--- a/frontend/src/plugins/impl/plotly/PlotlyPlugin.tsx+++ b/frontend/src/plugins/impl/plotly/PlotlyPlugin.tsx@@ -112,7 +112,7 @@ export const PlotlyComponent = memo(// Used for rendering LaTeX. TODO: Serve this library from Marimoconst scriptStatus = useScript(- "https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js?config=TeX-MML-AM_CHTML",+ "https://cdn.jsdelivr.net/npm/[email protected]/es5/tex-mml-svg.min.js",);const isScriptLoaded = scriptStatus === "ready";diff --git a/marimo/_plugins/ui/_impl/altair_chart.py b/marimo/_plugins/ui/_impl/altair_chart.pyindex 0b23a17d57..608e488295 100644--- a/marimo/_plugins/ui/_impl/altair_chart.py+++ b/marimo/_plugins/ui/_impl/altair_chart.py@@ -391,7 +391,7 @@ class altair_chart(UIElement[ChartSelection, ChartDataType]):chart_selection = Falselegend_selection = Falsesys.stderr.write(- "Selection is not yet supported in vegafusion.\n"+ "Selection is not yet supported while using vegafusion with mo.ui.altair_chart.\n""You can follow the progress here: ""https://github.com/marimo-team/marimo/issues/4601")diff --git a/marimo/_smoke_tests/issues/4579_mathjax_plotly.py b/marimo/_smoke_tests/issues/4579_mathjax_plotly.pynew file mode 100644index 0000000000..f15394ad74--- /dev/null+++ b/marimo/_smoke_tests/issues/4579_mathjax_plotly.py@@ -0,0 +1,36 @@+++import marimo++__generated_with = "0.13.0"+app = marimo.App()+++def _():+ import plotly.graph_objects as go++ # mo.md(f"```\n{foo=!r}\n{bar=!r}\n```"),+ go.Figure()+ return+++def _():+ import marimo as mo+ import plotly.express as px+++ px.line(+ x=[1, 2, 3, 4],+ y=[1, 4, 9, 16],+ title=r"$\alpha_{1c} = 352 \pm 11 \text{ km s}^{-1}$",+ ).update_layout(+ xaxis_title=r"$\sqrt{(n_\text{c}(t|{T_\text{early}}))}$",+ yaxis_title=r"$d, r \text{ (solar radius)}$",+ )+ return+++if __name__ == "__main__":+ app.run()