Skip to content

Hide cells both in jupyterlab and myst rendering#335

Merged
bsipocz merged 2 commits into
Caltech-IPAC:mainfrom
bsipocz:hide_cells
Jul 11, 2026
Merged

Hide cells both in jupyterlab and myst rendering#335
bsipocz merged 2 commits into
Caltech-IPAC:mainfrom
bsipocz:hide_cells

Conversation

@bsipocz

@bsipocz bsipocz commented Jun 17, 2026

Copy link
Copy Markdown
Member

Experimenting with a bit back and forth with Angus, I found a solution that apparently works for both usages we have. Draft as I still need to run a grep/sed to change all. And will also need to follow-up with a bit of documentation cleanup in the mystmd docs.

#myst-education-2026

closes https://github.com/IPAC-SW/irsa-datascience/issues/171

@bsipocz bsipocz added the infrastructure Infrastructure related issues/PRs. label Jun 17, 2026
@bsipocz bsipocz marked this pull request as ready for review June 18, 2026 13:40
@bsipocz

bsipocz commented Jun 18, 2026

Copy link
Copy Markdown
Member Author

Test failures are not related to changes here and this is ready for review and merge.

With the review I mean @jkrick or @troyraen - please have a look at the rendering to see if you are happy with the hidden cells, e.g. in here: https://circle.scientific-python.dev/output/job/701f33d8-d06c-4171-9a38-d0054519489e/artifacts/0/_build/html/openuniverse2024-tde-light-curve

Other option is that we can hide input or we can hide output, right now I went with hiding the whole cell.

@jkrick

jkrick commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Thanks for working on this. I think this is an improvement over having the code cells in the notebook. I don't like that the hidden cell in the rendering says "Notebook ...". Do we have the ability to change that text phrase to be something of our choosing? ie., "Function Definitions" or "Code Cell" or ??

@troyraen troyraen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @bsipocz! This will be helpful.

I see a couple cells that produce figures so I feel they should use hide-input instead of hide-cell so the figures are still displayed by default. I'll mark them. But actually I don't see a reason not to just use hide-input for everything.

hidden cell in the rendering says "Notebook ...". Do we have the ability to change that text phrase to be something of our choosing?

I agree it would be great to customize the text if possible so the user sees something more informative than "Notebook Cell". I checked docs and found that according to myst-nb docs (which might not be relevant), it might be possible with something like:

---
jupyter:
  source_hidden: true
tags: [hide-cell]
mystnb:
  code_prompt_show: "Show code"
  code_prompt_hide: "Hide code"
---

That doesn't work for me when building locally, but I'm building with myst start so it may still work in production with npm.

---
jupyter:
source_hidden: true
tags: [hide-cell]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
tags: [hide-cell]
tags: [hide-input]

---
jupyter:
source_hidden: true
tags: [hide-cell]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
tags: [hide-cell]
tags: [hide-input]

@bsipocz

bsipocz commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

I see a couple cells that produce figures so I feel they should use hide-input instead of hide-cell so the figures are still displayed by default. I'll mark them. But actually I don't see a reason not to just use hide-input for everything.

sure, I was very much on the fence if it should be hide-cell or hide-input, so will just change everything to hide-input.

I agree it would be great to customize the text if possible so the user sees something more informative than "Notebook Cell". I checked docs and found that according to myst-nb docs (which might not be relevant), it might be possible with something like:

We don't use myst-nb, that is part of the old JB1 stack

@bsipocz

bsipocz commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

Afaik there is no way currently to customise the text, but I made a note about it and will follow-up upstream.

@bsipocz

bsipocz commented Jul 11, 2026

Copy link
Copy Markdown
Member Author

I'm going ahead and merge this now. All the test failures are unrelated and are due to some yet unchartered problem with the TDE notebook. The same errors are present in the more relevant PR #326, so we should focus on fixing them there or open a separate issue for it.

@bsipocz bsipocz merged commit 6f539ca into Caltech-IPAC:main Jul 11, 2026
5 of 7 checks passed
@bsipocz bsipocz deleted the hide_cells branch July 11, 2026 02:19
github-actions Bot pushed a commit that referenced this pull request Jul 11, 2026
Hide cells both in jupyterlab and myst rendering 6f539ca
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infrastructure Infrastructure related issues/PRs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants