- 
                Notifications
    You must be signed in to change notification settings 
- Fork 748
feat: Add markdown to the cell level #6479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| The latest updates on your projects. Learn more about Vercel for GitHub. 
 | 
        
          
                marimo/_ast/compiler.py
              
                Outdated
          
        
      | markdown_lines = [ | ||
| line for line in code.strip().split("\n") if line.startswith("mo.md(") | ||
| ] | ||
| if len(markdown_lines) > 1: | 
There was a problem hiding this comment.
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")
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
7e2dcb3    to
    0f2f471      
    Compare
  
    |  | ||
| # Mark the cell as not stale (already "run") | ||
| CellOp.broadcast_stale(cell_id=cell_id, stale=False) | ||
| del execution_requests[cell_id] | 
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this 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
📝 Summary
closes #5942
Extracts markdown on compilation level allowing for native rendering. On startup, before:
(auto off)

(auto on)

After:
(auto off)

(auto on)

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