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: Show outputs below in HTML export if configured (#2129)
Myles Scolnick3c05818df60a
diff --git a/frontend/src/components/editor/renderers/vertical-layout/vertical-layout.tsx b/frontend/src/components/editor/renderers/vertical-layout/vertical-layout.tsxindex 4d9eceeb3a..447d74b203 100644--- a/frontend/src/components/editor/renderers/vertical-layout/vertical-layout.tsx+++ b/frontend/src/components/editor/renderers/vertical-layout/vertical-layout.tsx@@ -36,6 +36,7 @@ import type { CellConfig } from "@/core/network/types";import { useAtomValue } from "jotai";import { FloatingOutline } from "../../chrome/panels/outline/floating-outline";import { KnownQueryParams } from "@/core/constants";+import { useUserConfig } from "@/core/config/config";type VerticalLayout = null;type VerticalLayoutProps = ICellRendererProps<VerticalLayout>;@@ -47,6 +48,7 @@ const VerticalLayoutRenderer: React.FC<VerticalLayoutProps> = ({}) => {const { invisible } = useDelayVisibility(cells.length, mode);const kioskMode = useAtomValue(kioskModeAtom);+ const [userConfig] = useUserConfig();const urlParams = new URLSearchParams(window.location.search);const showCodeDefault = urlParams.get(KnownQueryParams.showCode);@@ -86,6 +88,7 @@ const VerticalLayoutRenderer: React.FC<VerticalLayoutProps> = ({status={cell.status}code={cell.code}config={cell.config}+ cellOutputArea={userConfig.display.cell_output}stopped={cell.stopped}showCode={showCode && canShowCode}errored={cell.errored}@@ -196,6 +199,7 @@ interface VerticalCellProps| "staleInputs"| "runStartTimestamp"> {+ cellOutputArea: "above" | "below";cellId: CellId;config: CellConfig;code: string;@@ -209,6 +213,7 @@ const VerticalCell = memo(({output,consoleOutputs,+ cellOutputArea,cellId,status,stopped,@@ -250,21 +255,26 @@ const VerticalCell = memo(// Read mode and show codeif ((mode === "read" && showCode) || kioskFull) {+ const outputArea = (+ <OutputArea+ allowExpand={true}+ output={output}+ className="output-area"+ cellId={cellId}+ stale={outputStale}+ />+ );+return (<div tabIndex={-1} id={HTMLId} ref={cellRef} className={className}>- <OutputArea- allowExpand={true}- output={output}- className="output-area"- cellId={cellId}- stale={outputStale}- />+ {cellOutputArea === "above" && outputArea}<div className="tray"><ReadonlyPythonCodeinitiallyHideCode={config.hide_code || kiosk}code={code}/></div>+ {cellOutputArea === "below" && outputArea}<ConsoleOutputconsoleOutputs={consoleOutputs}stale={outputStale}diff --git a/marimo/_server/export/exporter.py b/marimo/_server/export/exporter.pyindex 840de66336..2a3b6b00b3 100644--- a/marimo/_server/export/exporter.py+++ b/marimo/_server/export/exporter.py@@ -67,6 +67,10 @@ class Exporter:base64.b64encode(buffer_contents),)+ # We only want pass the display config in the static notebook,+ # since we use:+ # - display.theme+ # - display.cell_outputconfig = _deep_copy(DEFAULT_CONFIG)config["display"] = display_configdiff --git a/marimo/_server/templates/templates.py b/marimo/_server/templates/templates.pyindex 38a69c98db..38a2700d9c 100644--- a/marimo/_server/templates/templates.py+++ b/marimo/_server/templates/templates.py@@ -84,6 +84,10 @@ def static_notebook_template(asset_url = f"https://cdn.jsdelivr.net/npm/@marimo-team/frontend@{__version__}/dist"html = html.replace("{{ base_url }}", "")+ # We don't need all this user config when we export the notebook,+ # but we do need some:+ # - display.theme+ # - display.cell_outputhtml = html.replace("{{ user_config }}", json.dumps(user_config, sort_keys=True))