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
feat: parse indented code blocks (#7817)
Myles Scolnick66637807bfb7
diff --git a/marimo/_output/md.py b/marimo/_output/md.pyindex 2734430d77..9527b86d2b 100644--- a/marimo/_output/md.py+++ b/marimo/_output/md.py@@ -131,7 +131,7 @@ def _get_extension_configs() -> dict[str, dict[str, Any]]:"pygments_lang_class": True,},"pymdownx.superfences": {- "disable_indented_code_blocks": True,+ "disable_indented_code_blocks": False,"css_class": "codehilite",},"pymdownx.emoji": {diff --git a/tests/_output/test_md.py b/tests/_output/test_md.pyindex b68276827d..4be66a82a7 100644--- a/tests/_output/test_md.py+++ b/tests/_output/test_md.py@@ -622,3 +622,28 @@ def test_md_with_b64_in_wasm(# In WASM mode with b64 extension, the image should be base64 encodedassert "data:image/png;base64," in resultassert "alt text" in result+++def test_md_indented_code_blocks() -> None:+ # Test that indented code blocks (4 spaces) are properly recognized+ # This requires disable_indented_code_blocks=False in pymdownx.superfences+ indented_code_input = """This is some text++ def foo():+ return "bar"++And more text"""++ result = _md(indented_code_input, apply_markdown_class=False).text++ # Should contain a code block with proper syntax highlighting+ assert "<code>" in result+ assert "def" in result+ assert "foo" in result++ # Verify it's wrapped in proper code block structure+ assert "codehilite" in result or "<pre>" in result++ # Test that the text before and after is preserved+ assert "This is some text" in result+ assert "And more text" in result