Skip to content

Conversation

@mscolnick
Copy link
Contributor

@mscolnick mscolnick commented Jan 22, 2026

This prints plain HTML dataframes when we are exporting to non-interactive environments (e.g. ipynb, pdf)

@vercel
Copy link

vercel bot commented Jan 22, 2026

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

Project Deployment Review Updated (UTC)
marimo-docs Ready Ready Preview, Comment Jan 23, 2026 2:41pm

Request Review

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the rendering of dataframe-based UI components in non-interactive environments (such as GitHub viewers) by renaming the is_no_js() function to is_non_interactive() for better clarity, and implementing _mime_() methods that downgrade interactive table and dataframe widgets to plain HTML representations when JavaScript is not available.

Changes:

  • Renamed is_no_js() to is_non_interactive() across the codebase for better semantic clarity
  • Implemented _mime_() methods in table and dataframe classes to provide plain HTML fallbacks in non-interactive environments
  • Added test coverage for both mo.ui.table() and mo.ui.dataframe() in the export fixture

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
marimo/_output/hypertext.py Renamed is_no_js() to is_non_interactive() for better semantic clarity
marimo/_output/md.py Updated function call to use is_non_interactive()
marimo/_output/formatting.py Updated function call to use is_non_interactive()
marimo/_output/formatters/df_formatters.py Updated function call to use is_non_interactive()
marimo/_plugins/ui/_impl/table.py Replaced _repr_markdown_() with _mime_() method that conditionally returns plain HTML in non-interactive environments
marimo/_plugins/ui/_impl/dataframes/dataframe.py Added _mime_() method to provide plain HTML fallback in non-interactive environments
marimo/_plugins/ui/_impl/plotly.py Updated function call to use is_non_interactive()
marimo/_plugins/ui/_impl/altair_chart.py Updated function call to use is_non_interactive()
tests/fixtures/notebook_with_media.py Added test cells for mo.ui.table() and mo.ui.dataframe()
tests/_cli/snapshots/export/ipynb/ipynb_with_media_outputs.txt Updated snapshot with expected HTML outputs for table and dataframe widgets

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Comment on lines +237 to +239
repr_html = getattr(self._data, "_repr_html_", None)
if repr_html is not None and callable(repr_html):
return ("text/html", cast(str, repr_html()))
Copy link
Contributor

Choose a reason for hiding this comment

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

should we move this logic to hypertext.py?
the logic is also repeated in table.py

Copy link
Contributor Author

@mscolnick mscolnick Jan 23, 2026

Choose a reason for hiding this comment

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

i think the duplication is fine since, its about 2 lines and they are both tested

@mscolnick mscolnick merged commit ba994d1 into main Jan 26, 2026
44 of 49 checks passed
@mscolnick mscolnick deleted the ms/downgrade-tables branch January 26, 2026 15:20
@github-actions
Copy link

🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.19.7-dev3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

3 participants