-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hide input cells #534
Comments
Woot! BTW, I like our variation of making a Tabbed Input/Output cell [1] such that you can see the code in the Input tab, but defaults to showing the Output tab initially. Also can display the input next to output. |
I can imagine that this view would be useful sometimes. But initially this On Tue, Oct 6, 2015 at 4:02 PM, Doug Blank notifications@github.com wrote:
Brian E. Granger |
Would it be possible to expose the JS so that it survives nbconvert? Otherwise any derived materials would need to re-implement show/hide machinery. I'm also 👍 on the possibility of switching input on one cell only, imagine publishing lecture materials in a non-programming course, where you only might want to check how a particular thing is produced. |
Here's a snipped that works for me if I run as HTML in the 1st cell. <script>
var code_show=true; //true -> hide code at first
function code_toggle() {
$('div.prompt').hide(); // always hide prompt
if (code_show){
$('div.input').hide();
} else {
$('div.input').show();
}
code_show = !code_show
}
$( document ).ready(code_toggle);
</script> Here's the button. <a href="javascript:code_toggle()">[Toggle Code]</a> |
I just signed in to thank @Saynah for that great hack. I don't use Jupyter specifically because it doesn't have cell folding, but this is the closest I've found so far. |
It seems like this would be nice done a cell magic, then it's easy to selectively hide cells, not sure though. still learning the system. Plus I seem to be running an ancient version |
I don't think a cell magic is the right thing for this:
If you're on an old version, have a look at the upgrade instructions here: |
Hiding input cells for HTML output would be greatly appreciated! |
I second that! |
I have cell hiding on HTML export figured out with a helpful piece of code to trigger upon export; but now that I'm moving to deploying Jupyterhub in my organization I really would appreciate the ability to hide live input cells so users don't see them when they run their notebooks. |
The |
You can hide the code in nbconvert using a custom template. For conversion to TeX or PDF you can take a look at this template printviewlatex.tplx and modify it accordingly. |
I think it would be cleaner to do this with a preprocessor (which I just did locally). I fell the hiding of cells should be independent of the template. |
It would be neat if in addition to the feature we could allow to export to pdf/html removing/hiding input cell code and prompt so we could have a clean pdf/html output without any code but with the beautiful graphs, markdown and results. |
@BreitA that's super easy. The hard part is getting rid of the prompt for the output. Lemme send a PR. |
Hm actually I realized that I was doing the wrong thing and also removed the output of the cell. That was simple. |
Oops, ping @JamiesHQ |
I don't think the notebook web interface uses any metadata for hiding input yet, though maybe it's gone in without me noticing. Stuff to check: browser Javascript console, logging from the server, run |
+10, would be perfect if we can edit the meta-data in Jupyter Lab to:
See Ref. here. |
It is my understanding that what @takluyver says is correct (not using the metadata in notebook yet). We do have work in progress to add that handling to lab though. |
I realize this has been open for a while and there were some difficulties here, but I have been getting a lot of questions regarding why classic jupyter doesn't respect the I see there's a lot of discussion on the DOM structure and how JupyterLab reimplemented that, but it seems like
display: None be 80% of the work for source_hidden ? Seems like it'd only need to capture initial render and metadata edit events to adjust the display attribute.
Thoughts/comments? |
Thanks @ellisonbg! This is a great idea! This is currently possible in JupyterLab and will be possible in the coming Notebook v7 (which inherits from JupyterLab's notebook package). Look out for this feature in our next major release! We'll leave this issue open until v7 is published. |
Notebook 7 is close to be published. JupyterLab adds ability to collapse an input cell so that only 1st line of the cell is visible. But this does not hide the input cell completely which is the desired feature here. Moving this issue to 7.0.x for further discussion and follow up, please let me know if I'm missing something (CC @Zsailer). |
Love it. That's a great start. |
I plan on implementing the hiding of input cells. Might not happen for 4.1, but I will be optimistic for now.
The text was updated successfully, but these errors were encountered: