Skip to content

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.

fix: use markdown sane_lists, to support different starts (#3003)

Myles Scolnick9b0ca93a46b8
diff --git a/marimo/_output/md.py b/marimo/_output/md.py
index a326b6f599..c341d2f46a 100644
--- a/marimo/_output/md.py
+++ b/marimo/_output/md.py
@@ -65,6 +65,8 @@ def _md(
"footnotes",
# Admonitions
"admonition",
+ # Sane lists, to include <ol start="n">
+ "sane_lists",
# Links
ExternalLinksExtension(),
# Iconify
diff --git a/marimo/_smoke_tests/markdown/sane_lists.py b/marimo/_smoke_tests/markdown/sane_lists.py
new file mode 100644
index 0000000000..7d2cfe61ca
--- /dev/null
+++ b/marimo/_smoke_tests/markdown/sane_lists.py
@@ -0,0 +1,50 @@
+import marimo
+
+__generated_with = "0.9.27"
+app = marimo.App(width="medium")
+
+
+def __(mo):
+ mo.md(
+ """
+ 2. hey
+ 2. hey
+ 2. hey
+ """
+ )
+ return
+
+
+def __(mo):
+ mo.md(
+ """
+ 1. hey
+ 1. hey
+ 1. hey
+ """
+ )
+ return
+
+
+def __(mo):
+ mo.md(
+ r"""
+ 1. hey
+ 2. hey
+ 2. hey
+ """
+ )
+ return
+
+
+def __():
+ import marimo as mo
+ return (mo,)
+
+
+if __name__ == "__main__":
+ app.run()
diff --git a/tests/_output/test_md.py b/tests/_output/test_md.py
index a9071c62fc..c4d54a1aa6 100644
--- a/tests/_output/test_md.py
+++ b/tests/_output/test_md.py
@@ -79,3 +79,9 @@ def test_md_iconify() -> None:
mixed_input = "# Header with ::lucide:star:: icon\n\n**Bold text with ::mdi:alert:: icon**" # noqa: E501
expected_output = '<h1 id="header-with-icon">Header with <iconify-icon icon="lucide:star" inline=""></iconify-icon> icon</h1>\n<span class="paragraph"><strong>Bold text with <iconify-icon icon="mdi:alert" inline=""></iconify-icon> icon</strong></span>' # noqa: E501
assert _md(mixed_input, apply_markdown_class=False).text == expected_output
+
+
+def test_md_sane_lists() -> None:
+ input_text = "2. hey\n3. hey"
+ expected_output = '<ol start="2">\n<li>hey</li>\n<li>hey</li>\n</ol>'
+ assert _md(input_text, apply_markdown_class=False).text == expected_output