remove input for hidden cells for exports#9548
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
Honors hide_code=True cells when exporting marimo notebooks via nbconvert (PDF, WebPDF, Slides) by tagging them with the remove-input nbconvert tag and adding jupyter.source_hidden=true metadata for editor UIs (VS Code, JupyterLab).
Changes:
- Add
NBCONVERT_REMOVE_INPUT_TAGand emitremove-inputtag +jupyter.source_hiddenmetadata in_create_ipynb_cellfor hidden-code cells. - Configure
PDFExporter,WebPDFExporter, andSlidesExporterwith aTagRemovePreprocessorconfig that strips inputs for tagged cells. - Update snapshots and add unit/integration tests verifying the tag/metadata are emitted and that nbconvert strips the hidden cell source.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| marimo/_convert/ipynb/from_ir.py | Adds remove-input tag and jupyter.source_hidden metadata to hidden-code cells in ipynb export. |
| marimo/_server/export/exporter.py | Wires TagRemovePreprocessor config into PDF/WebPDF/Slides nbconvert exporters. |
| tests/_convert/ipynb/test_from_ir.py | Adds unit test asserting hidden-cell metadata/tags. |
| tests/_server/export/test_exporter.py | Adds integration test confirming nbconvert strips hidden cell source. |
| tests/_convert/ipynb/snapshots/*.ipynb.txt | Updates snapshots for new metadata/tag fields. |
Contributor
There was a problem hiding this comment.
1 issue found across 6 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="tests/_server/export/test_exporter.py">
<violation number="1" location="tests/_server/export/test_exporter.py:1241">
P2: Guard this nbconvert-based test with `DependencyManager.nbconvert.has()` too; otherwise it fails in optional-dependency environments.</violation>
</file>
Architecture diagram
sequenceDiagram
participant Exporter as Export Service
participant IR as IR Converter
participant Config as Traitlets Config
participant NBFormat as nbformat
participant NBConvert as nbconvert (PDF/HTML/LaTeX/Slides)
Note over Exporter,NBConvert: Export flow for hidden code cells
Exporter->>IR: convert_from_ir_to_ipynb()
IR->>IR: Build IPYNB cells from marimo IR
alt Cell has hide_code=True
IR->>IR: Set jupyter.source_hidden = True
IR->>IR: Add "remove-input" to metadata.tags
end
IR-->>Exporter: IPYNB JSON string
Exporter->>NBFormat: nbformat.reads(ipynb)
NBFormat-->>Exporter: Notebook node
alt PDF via standard exporter
Exporter->>Config: _nbconvert_tag_remove_config()
Config->>Config: Enable TagRemovePreprocessor
Config->>Config: Set remove_input_tags = [NBCONVERT_REMOVE_INPUT_TAG]
Config-->>Exporter: traitlets Config
Exporter->>NBConvert: PDFExporter(config=config)
NBConvert->>NBConvert: TagRemovePreprocessor strips cells with "remove-input"
NBConvert-->>Exporter: PDF bytes
else PDF via WebPDF
Exporter->>Config: _nbconvert_tag_remove_config()
Config-->>Exporter: traitlets Config
Exporter->>NBConvert: WebPDFExporter(config=config)
NBConvert->>NBConvert: TagRemovePreprocessor strips cells with "remove-input"
NBConvert-->>Exporter: PDF bytes
else Slides export
Exporter->>Config: _nbconvert_tag_remove_config()
Config-->>Exporter: traitlets Config
Exporter->>NBConvert: SlidesExporter(config=config)
NBConvert->>NBConvert: TagRemovePreprocessor strips cells with "remove-input"
NBConvert-->>Exporter: HTML with reveal.js
end
Exporter-->>Exporter: Return exported data
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
peter-gy
approved these changes
May 14, 2026
Contributor
peter-gy
left a comment
There was a problem hiding this comment.
This is great, thanks for addressing it so quickly!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Summary
Related to #9523 . For hidden cells, we don't include them in the export. Also adds source_hidden which is respected by Vscode, Jupyter notebooks.

📋 Pre-Review Checklist
✅ Merge Checklist