[IPython-dev] Hide some code cells, show others?

François Deheeger francois.deheeger at free.fr
Thu Jun 12 17:04:35 EDT 2014


Hi,

one of the way is to use the cell toolbar and "tag" the cells you want to
keep (or delete... depends on the number of both !).
I usually use the 'slideshow' mode of that cell toolbar and tag with
'Notes' cells i want to keep.

Then, by using the idea of the stackoverflow post you mentioned, create the
template you need. It might look like:

{%- extends 'full.tpl' -%}
{% block input_group %}
    {% if cell['metadata'].get('slideshow',{}).get('slide_type','') ==
'Notes' -%}
        {{ super() }}
    {% endif %}
{%- endblock input_group %}

And then use that template through nbconvert.

Hope it helps,

Francois




2014-06-12 16:37 GMT-04:00 Nathan Goldbaum <nathan12343 at gmail.com>:

> Hi all,
>
> Apologies if this has been asked before - my google-fu has failed me.
>
> I'm currently writing a proceedings for the scipy conference.  Since they
> require and .rst file with a custom format I was planning to use the rst
> nbconvert template to generate my talk, using raw nbconvert cells to supply
> rst formatting as needed.
>
> I'd also like to include code for some cells but not all.  In particular,
> one or two of the plots have pretty lengthy scripts associated with them
> and I'd prefer not to have to include them in the paper.
>
> I've found this StackOverflow discussion, which seems to sort of do what I
> want:
>
>
> http://stackoverflow.com/questions/19524554/suppress-code-in-nbconvert-ipython
>
> but this will suppress the output of *all* code cells.  Is there a way
> (possibly through an IPython extension) in the notebook interface to
> indicate whether or not I want to include a code cell in the nbconvert
> output?
>
> Thanks for your help,
>
> Nathan
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>


-- 

François Deheeger
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140612/4f806895/attachment.html>


More information about the IPython-dev mailing list