A cell output in one of my Jupyter notebooks has a vertical scrollable side bar. When I added this notebook to my GitHub repository, the full output (which takes up a lot of space) was displayed. Is it possible for GitHub to display the cell output with a sidebar?
Below is a minimal working example illustrating the problem. Here is a screenshot of a cell in a Jupyter Notebook that has a scrollbar:
If this notebook is converted to HTML via jupyter nbconvert --to html name.ipynb and viewed in a browser (to replicate publishing and viewing the notebook on GitHub), then the output looks like this (there is no scrollbar):
I found the following related links, but no one has posted a solution yet:
How to get a vertical scrollbar in HTML output from Jupyter notebooks
How to add a vertical scrollbar in html output from jupyter notebook with nbconvert?
Any help would be appreciated!
Related
I used to always have my dataframes displayed correctly in a nice table in jupyter notebook but now everytime I display one, it's like I printed it unformated.
I tried to use display(df_main) but it's still not displaying it correctly.
I've googled a bit but everything points to the Jupyter notebook, not vscode and was just wondering if there are any resources available on how to use these cell tags in VSCode. Simply copying a tag in doesnt seem to do anything in my notebook.
So basically 2 questions:
How do you use this tab?
What do cell tags do?
The markdown code below can be rendered in Jupyter notebook locally in my browser, but it doesn't reader on GitHub (instead shown as broken image icons)
<img src="img/plot1_m_over_n=5.svg" width="500"> <img src="img/plot2_m_over_n=10.svg" width="500">
There's a lot of math so I used Jupyter notebook (LaTeX) for the readme (no code cells, just lots of markdown cells), and I know there is a python solution here (In [8]), but I don't want to show the python code. I just want the SVGs to be rendered! Plus it can't resize the svg. How can I adjust the markdown code above so that it can be rendered on GitHub?
I have issues on jupyter notebook conversion. It looks fine on jupyter notebook. However if I convert it to html or upload to github, it displays like photo above.
Instead of vertical(scroll up and down), I have to scroll left and right and each cell are really narrowed.
Any suggestion?
Thanks in advance!
This is typical of a library you use emitting invalid HTML. I would suggest opening an issue or contacting the Jupyter mailing list to help you debug this as StackOverflow will not be the right place to have a back and forth.
You should be able to narrow down which library does that by:
- backup your notebook.
- Delete cells one and until notebook looks normal. (tip use nbconvert locally instead of uploading, and use python -m http.server)
- the last cell you delete have a issue.
It may be a bug in nbconvert but I doubt it.
In this tutorial presentation they use this, but, apparently, they don't show you how to do it.
http://www.damian.oquanta.info/posts/make-your-slides-with-ipython.html
Thanks,
I am sorry, I completely misunderstood your question.
If you mean embedding code which you do not execute, then you can use simple markdown syntax (similar to StackOverflow for example). To include inline code, just but it between backticks:
For example `a[::2]` selects every second element of the list `a`.
If you want to include a code block, either indent the whole block by 4 spaces, or put the block between 3 backticks (the latter also supports syntax highlighting if you specify the language):
a = foo()
b = bar(a)
or
```python
a = foo()
b = foo(a)
```
For more, see this markdown tutorial.
If you want to include executable cells and markdown on the same slide, then you need to put your code and markdown into different cells, and for slide type select slide for the topmost cell, and - for the subsequent cells that you want to have on the same slide. - means "do not start a new slide for this cell".
Old answer (how to convert a notebook to a reveal.js presentation)
You can convert your ipython notebook to a Reveal.js presentation using nbconvert.
First you have to specify the structure of the presentation. For that click on View -> Cell Toolbar -> Slideshow. Then at the top of every cell you can select whether you want it to be a new slide (horizontal direction), a subslide (vertical direction), a fragment (appear on the same slide with a fade-in) and some others.
Once you are set, you can use the nbconvert utility to transform your notebook into a presentation. The basic usage is
jupyter nbconvert example.ipynb --to slides
Then you get a HTML which you can serve up later using some web server.
If you want to show off your slides right away, jupyter provides a shortcut: you can do
jupyter nbconvert example.ipynb --to slides --post serve
Using this jupyter starts a local server after the conversion and opens the presentation in your default browser.
Last, if you want to easily share your presentation online, you can upload the notebook to some online repository (for example to github as a gist), and you can use nbviewer to share it. It will have a box-like icon in the top right corner. If you press it, it will change from notebook mode to presentation mode (I don't understand the box analogy either).
For more info please consult the jupyter documentation.