llorracc / as.180.369-2023-Fall

Johns Hopkins AS.180.369—“Tools for Writing a Research Paper in Economics” (Fall 2023)
1 stars 15 forks source link

How to hide code that appears on JupyterBook (so it is less clustered) #25

Open avnikadubey opened 10 months ago

avnikadubey commented 10 months ago

Hi everyone! Does anyone know how to hide the code for an output you want to display on your JupyterBook build? I noticed that my JupyterBook was looking a little clustered, so I wanted to see if I could get rid of some of the code on my book. I consulted ChatGPT and found a few resources online, but each time I try to incorporate them nothing happens. For reference, I have been using the {toggle} feature as described on the website listed below, but it only works when the cell is markdown and not code? I also tried the "Edit cell" method as instructed by ChatGPT, but turns out ChatGPT was wrong and there no longer is an "Add Cell Tag" feature anymore. If anyone has run into this issue and has a solution, I would appreciate any help you may have to offer! Thank you in advance!

Link: https://jupyterbook.org/en/stable/interactive/hiding.html

galibest2 commented 10 months ago

You can use the tools and tags segment on the notebook

image

This image is on the right-hand side

You can then choose to hide the code and still make it visible when clicked or remove it from view completely.

image

Only tag the cells you want hidden or removed.