Skip to content

Conversation

@dmadisetti
Copy link
Collaborator

@dmadisetti dmadisetti commented Sep 22, 2025

📝 Summary

closes #5942

Extracts markdown on compilation level allowing for native rendering. On startup, before:

(auto off)
image

(auto on)
image

After:

(auto off)
image

(auto on)
image

print there to ensure not loading from a session.json, but tests should capture this too.

@vercel
Copy link

vercel bot commented Sep 22, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
marimo-docs Ready Ready Preview Comment Sep 23, 2025 4:37pm

markdown_lines = [
line for line in code.strip().split("\n") if line.startswith("mo.md(")
]
if len(markdown_lines) > 1:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could be slightly cheaper some(line.startswith("mo.md(") for line in code.strip().split("\n")

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice- we don't actually need this check at all, ast parse handles this case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but isn't ast.parse more expensive. should we have a cheap check first and then actual parsing?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the cheap one could even be "mo.md(" in code

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have the have the ast already- so in those cases just directly use that, while allowing for the early stopping if extracted directly from code.


# Mark the cell as not stale (already "run")
CellOp.broadcast_stale(cell_id=cell_id, stale=False)
del execution_requests[cell_id]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any way to break some of this up outside of the Runner? its gotten quite large. i know it doesn't really belong in hooks, but maybe a function in the same file

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good point, but we still call some functions on the object

mscolnick
mscolnick previously approved these changes Sep 23, 2025
Copy link
Contributor

@mscolnick mscolnick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good! small nits, but not blocking

@mscolnick mscolnick merged commit df8d8f0 into main Sep 23, 2025
25 of 41 checks passed
@mscolnick mscolnick deleted the dm/native-md branch September 23, 2025 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run all markdown cells on startup

3 participants