1import marimo
2
3__generated_with = "0.13.0"
4app = marimo.App()
5
6
7@app.cell
8def title():
9 import marimo as mo
10 mo.md("""
11 # Markdown Cells
12
13 marimo notebooks mix **code** and **markdown** cells. markdown cells use `mo.md()` and render as rich text.
14 """)
15 return (mo,)
16
17
18@app.cell
19def explanation(mo):
20 mo.md("""
21 ## how it works
22
23 - code cells contain Python and show syntax-highlighted source
24 - markdown cells render as formatted text with headings, lists, links
25 - cells can return values that other cells depend on
26 - the DAG ensures correct execution order
27 """)
28 return ()
29
30
31@app.cell
32def compute():
33 data = {"pi": 3.14159, "e": 2.71828, "phi": 1.61803}
34 return (data,)
35
36
37@app.cell
38def show_results(mo, data):
39 lines = [f"- **{k}**: {v}" for k, v in data.items()]
40 mo.md("## constants\n\n" + "\n".join(lines))
41 return ()
42
43
44@app.cell
45def code_example():
46 # this is a plain code cell — no mo.md()
47 # it shows as syntax-highlighted Python
48 numbers = [x ** 2 for x in range(10)]
49 print(f"squares: {numbers}")
50 return ()
51
52
53if __name__ == "__main__":
54 app.run()