-
Notifications
You must be signed in to change notification settings - Fork 809
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
nbextensions and nbconvert #847
Comments
Some of them support nbconvert, to various degrees. This is down to which have had templates, exporters etc written for them. See jupyter-contrib-nbextensions.readthedocs.io/en/latest/exporting for docs on the subject.
Well, that advice is a little out of date, and a lot of that process is now done automatically by the package installation. Again, refer to the docs at jupyter-contrib-nbextensions.readthedocs.io/en/latest/exporting for the latest info.
I'm not completely familiar with how toc2 might function even without extra options passed to nbconvert, although I know it does provide an exporter for embedding into html output (see http://jupyter-contrib-nbextensions.readthedocs.io/en/latest/exporting.html#export-table-of-contents). The support for |
That would be great. This feature is very useful to read my long notebook. I just wrote a makeshift jquery script and put it in my notebook as a raw nbconvert script. I will use this for now. https://gist.github.com/tarokiritani/b1b5fefa5f19e57f107bd1c3b16c742a |
Today I was thinking on this, a way to make a composable conversion, i.e., to export using TOC2, hidden cells,..., without conflicts between them. Any idea or hint about how to start? A switch on a template? e.g.: {% block whatever %}
{% if TOC %}
{# ... #}
{% endif %}
{ % endblock %} Should be a defined way to do so? I'm thinking in exporting notebooks to blogpost or standalone web pages but maintining some of the interactive functionality (TOC, widgets, some ad-hoc js to hide-show code cells, collapse sections, add styles based on the chosen options of the conversion,...). Is there a roadmap for this? |
@kikocorreoso Normally there is no reason to have conflicts between these various extensions. The templates can inherit from other templates; which means that you can chain several templates, eg toc2.tpl, nbextensions.tpl [which I think includes the older hide_input.tpl/hide_input_output.tpl templates]. |
I have added a description of |
I've been thinking for a while of making an nbconvert exporter which can
embed generic CSS/js header tags, which could then be used for any
embeddable nbextension, without requiring altering anything beyond the head
tag in the HTML source. Unfortunately since none of the notebook JavaScript
frameworks get embedded (apart from mathjax, which brings requirejs and
jquery), the regular live-notebook nbextensions tend not to work without
rewrites/alterations.
You can already embed toc2 using its exporter - see exporting docs at
http://jupyter_contrib_nbextensions.readthedocs.io (I think, might have
address wrong).
|
thanks @jfbercher @juhasch @jcb91 for all the valuable suggestions, PR and for pointing me to some valid resources. |
I've added proper html-export capability for collapsible_headings in #892. However, given the export mechanism, it's not currently possible to support exports to both collapsible_headings and toc2 at the same time (not that difficult to fix though, I think, if people think it useful) |
I've recently been exploring the use of the code prettifier extension, and it strikes me that this is another extension that could be valuable as an Anyone know of a snippet that demonstrates how this can be done? (i.e. how to invoke the code prettifier in the context of |
@jcb91 hi, thanks for your work on collapsible_headings. I came across this thread looking for a way to combine the collapsible_headings and toc2 extensions into my html export of my Jupyter notebook (exactly as you said). Now both extensions have support for an exporter:
What's the proper way to do the export if I want both extensions? Thank you. |
@thatlittleboy Hi, did you ever figure out how to include both toc2 and collapsible_headings in your html export? |
@Dekermanjian No I didn't, I just went with toc2 and forgo-ed collapsible_headings. |
@thatlittleboy Alright, I guess the functionality isn't there yet. Thank you for the quick response. |
Is it possible to use nbextensions with nbconvert? I ran
jupyter nbconvert --to html nynotebook.ipynb
. Then, toc2 seems to be effective in the resulting html. However, collapsible headings is no longer working.Based on the previous issue #198, I understand that in order to use nbextensions with nbconvert I need to
Am I mistaken? I have not found collapsible_headings.py in my env, and have not figured out the format of the template file. Could anyone give me pointers?
The text was updated successfully, but these errors were encountered: