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: add more markdown css rules to clamp at desired max-width (#4626)

Myles Scolnick4a7246ed4830
diff --git a/frontend/src/components/editor/output/Outputs.css b/frontend/src/components/editor/output/Outputs.css
index e8215b471d..26bd4944a4 100644
--- a/frontend/src/components/editor/output/Outputs.css
+++ b/frontend/src/components/editor/output/Outputs.css
@@ -34,11 +34,17 @@
> pre,
> ul,
+ > ol,
+ > blockquote,
div.codehilite,
/* Target <span> that is not empty and does not consist entirely of child elements;
* this makes sure text with embedded HTML (such as a slider) has a max width,
* but standalone elements (like tables, plots) don't get a max width. */
- > span.paragraph:not(:has(> :only-child)):not(:empty) {
+ > span.paragraph:not(:has(> :only-child)):not(:empty),
+ /* Target span.paragraph that only contains basic elements */
+ > span.paragraph:not(
+ :has(> :not(code, a, strong, i, b, del, em, u, mark, sub, sup))
+ ) {
max-width: var(--markdown-max-width);
}
}
diff --git a/marimo/_smoke_tests/issues/4624_markdown_max_width.py b/marimo/_smoke_tests/issues/4624_markdown_max_width.py
new file mode 100644
index 0000000000..3b5662541e
--- /dev/null
+++ b/marimo/_smoke_tests/issues/4624_markdown_max_width.py
@@ -0,0 +1,82 @@
+
+
+import marimo
+
+__generated_with = "0.13.0"
+app = marimo.App(width="full")
+
+
+def _():
+ import marimo as mo
+ return (mo,)
+
+
+def _(mo):
+ mo.md(
+ r"""
+ # Hello World in Markdown
+
+ **Bold Text:** Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
+
+ *Italic Text:* Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
+
+ ~~Strikethrough~~: Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
+
+ **Underline Text:** Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
+
+ <u>Underline Another Way:</u> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
+
+ [Link Example](https://www.example.com): Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
+
+ - **Unordered List:**
+ - Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
+ - Item 2
+ - Item 3
+
+ 1. **Ordered List:**
+ 1. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
+ 2. Second Item
+ 3. Third Item
+
+ > **Blockquote:** Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
+
+ `Inline Code:` Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
+
+ ```
+ Code Block:
+ For longer code examples, use triple backticks.
+ def hello_world():
+ print("Hello, World!")
+ ```
+
+ **Image:**
+
+ ![Alt Text for Image](https://placehold.co/800x400)
+
+ **Horizontal Rule:**
+
+ ---
+
+ Use hyphens (`---`), asterisks (`***`), or underscores (`___`) to create horizontal rules.
+
+ **Table:**
+
+ | Header 1 | Header 2 | Header 3 |
+ |:--------:|:--------:|:--------:|
+ | Row 1, Col 1 Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text | Row 1, Col 2 | Row 1, Col 3 |
+ | Row 2, Col 1 | Row 2, Col 2 | Row 2, Col 3 |
+ """
+ )
+ return
+
+
+def _(mo):
+ mo.md(r"""This cell now contains a link to [marimo](https://docs.marimo.io/), and suddenly all sort of weird things are happening - line widths change, and there is no lie wrap anymore!""")
+ return
+
+
+if __name__ == "__main__":
+ app.run()