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
Revert "improve: Hide code by default for Markdown cells (#2507)" (#2585)
Akshay Agrawal09f1eab0c22c
diff --git a/frontend/src/components/editor/cell/code/cell-editor.tsx b/frontend/src/components/editor/cell/code/cell-editor.tsxindex 3f65054648..6ac0fc2e00 100644--- a/frontend/src/components/editor/cell/code/cell-editor.tsx+++ b/frontend/src/components/editor/cell/code/cell-editor.tsx@@ -37,7 +37,6 @@ import { autoInstantiateAtom, isAiEnabled } from "@/core/config/config";import { maybeAddMarimoImport } from "@/core/cells/add-missing-import";import { OverridingHotkeyProvider } from "@/core/hotkeys/hotkeys";import { useSplitCellCallback } from "../useSplitCell";-import { MarkdownLanguageAdapter } from "@/core/codemirror/language/markdown";export interface CellEditorPropsextends Pick<CellRuntimeState, "status">,@@ -326,7 +325,7 @@ const CellEditorInternal = ({};}, [editorViewRef]);- const temporarilyShowCode = useCallback(async () => {+ const temporarilyShowCode = async () => {if (hidden) {updateCellConfig({ cellId, config: { hide_code: false } });editorViewRef.current?.focus();@@ -351,17 +350,7 @@ const CellEditorInternal = ({{ signal: abortController.signal },);}- }, [hidden, cellId, updateCellConfig, editorViewRef]);-- // For a newly created Markdown cell, which defaults to- // hidden code, we temporarily show the code editor- useEffect(() => {- if (code === new MarkdownLanguageAdapter().defaultCode) {- return;- }- temporarilyShowCode();- // eslint-disable-next-line react-hooks/exhaustive-deps- }, [code]);+ };return (<AiCompletionEditordiff --git a/frontend/src/core/cells/cells.ts b/frontend/src/core/cells/cells.tsindex e72e164db5..cbfce6e831 100644--- a/frontend/src/core/cells/cells.ts+++ b/frontend/src/core/cells/cells.ts@@ -29,11 +29,7 @@ import { deserializeBase64, deserializeJson } from "@/utils/json/base64";import { historyField } from "@codemirror/commands";import { clamp } from "@/utils/math";import type { LayoutState } from "../layout/layout";-import {- isMarkdown,- notebookIsRunning,- notebookQueueOrRunningCount,-} from "./utils";+import { notebookIsRunning, notebookQueueOrRunningCount } from "./utils";import {splitEditor,updateEditorCodeFromPython,@@ -256,10 +252,6 @@ const {lastCodeRun,lastExecutionTime,edited: Boolean(code) && code !== lastCodeRun,- config: {- disabled: false,- hide_code: isMarkdown(code),- },}),},cellRuntime: {diff --git a/frontend/src/core/cells/utils.ts b/frontend/src/core/cells/utils.tsindex 340b00e7e9..e551912a0f 100644--- a/frontend/src/core/cells/utils.ts+++ b/frontend/src/core/cells/utils.ts@@ -10,7 +10,6 @@ import {type LastSavedNotebook,staleCellIds,} from "./cells";-import { LanguageAdapters } from "../codemirror/language/LanguageAdapters";export function notebookIsRunning(state: NotebookState) {return Object.values(state.cellRuntime).some(@@ -104,9 +103,3 @@ export function getDescendantsStatus(state: NotebookState, cellId: CellId) {runningOrQueued,};}--export function isMarkdown(code: string | undefined) {- return code && code !== ""- ? LanguageAdapters.markdown().isSupported(code)- : false;-}