Repository navigation
Hide code in book: toggle in HTML, removed in PDF - #46
Merged
Merged
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Dependency Review✅ No vulnerabilities found.Scanned FilesNone |
There was a problem hiding this comment.
🟡 Changes recommended
The callback runs after MyST-NB copies the Sphinx options, so the LaTeX override is applied too late and code source remains visible in the PDF.
1 open issue
What changed in this PR
This PR adjusts the MRI education book to emphasize text and figures, with collapsible code in HTML and an extension intended to omit code from PDF builds.
Changes:
- Adds
hide-inputtags across 17 notebooks without changing code or outputs. - Adds and registers a LaTeX-specific source-hiding extension.
- Removes the ineffective
jupyter: hide-inputconfiguration.
| File | Description |
|---|---|
| Notebooks/Spectral-Spatial RF Pulses.ipynb | Adds code-input hiding tags. |
| Notebooks/Spatial Encoding.ipynb | Adds code-input hiding tags. |
| Notebooks/RF Pulses.ipynb | Adds a code-input hiding tag. |
| Notebooks/RF Pulse Design.ipynb | Adds code-input hiding tags. |
| Notebooks/Point Spread Function Analysis.ipynb | Adds code-input hiding tags. |
| Notebooks/MRI Math Concepts.ipynb | Adds code-input hiding tags. |
| Notebooks/Magnetic Fields in MRI.ipynb | Adds code-input hiding tags. |
| Notebooks/K-space.ipynb | Adds code-input hiding tags. |
| Notebooks/Image Reconstruction.ipynb | Adds a code-input hiding tag. |
| Notebooks/Image Contrast Examples.ipynb | Adds a code-input hiding tag. |
| Notebooks/hide_code_latex.py | Adds a builder-specific source-removal callback. |
| Notebooks/FOV and Resolution.ipynb | Adds code-input hiding tags. |
| Notebooks/Fast Imaging Pulse Sequences.ipynb | Adds a code-input hiding tag. |
| Notebooks/Bloch Equation.ipynb | Adds code-input hiding tags. |
| Notebooks/Basic Contrast Mechanisms.ipynb | Adds tags while preserving existing metadata. |
| Notebooks/Artifacts.ipynb | Adds code-input hiding tags. |
| Notebooks/Advanced SNR.ipynb | Adds code-input hiding tags. |
| Notebooks/Accelerated Imaging Methods.ipynb | Adds code-input hiding tags. |
| Notebooks/_config.yml | Registers the extension and removes ineffective configuration. |
Review effort: Balanced
|
|
||
|
|
||
| def setup(app): | ||
| app.connect("builder-inited", _on_builder_inited, priority=900) |
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.

Readers of the book mostly want the figures and text, so code cells are now hidden by default.
hide-input, so the source sits behind a "Show code cell source" toggle and outputs stay visible.Notebooks/hide_code_latex.py, registered in_config.yml) setsnb_remove_code_sourceonly for latex/pdflatex builds, so the PDF omits code.jupyter: hide-inputblock in_config.yml, which is not a valid Jupyter Book option and had no effect.Notes: notebook diffs only add the cell tag. Not yet verified with a full HTML or PDF build; worth checking the PR's deploy output.