jupyter / nbconvert Goto Github PK
View Code? Open in Web Editor NEWJupyter Notebook Conversion
Home Page: https://nbconvert.readthedocs.io/
License: BSD 3-Clause "New" or "Revised" License
Jupyter Notebook Conversion
Home Page: https://nbconvert.readthedocs.io/
License: BSD 3-Clause "New" or "Revised" License
But is documented as the thing to do.
The output_prompt
block doesn't do anything in the HTML templates - there's a comment saying:
{#
output_prompt doesn't do anything in HTML,
because there is a prompt div in each output area (see output block)
#}
The output prompts are generated inside the output
block for an execute_result output, but there's no easy way (that I can see) to disable them in a subclass template.
Try viewing this notebook on github/nbconvert vs as running notebook.
The last cell output should be 50×50 pixel big, but only is when viewed in a running notebook. The nbconvert (and therefore GitHub’s) rendering doesn’t respect that.
Exporting as PDF gives an error when there's strikethroughs in the markdown text. The webpage displays the error "nbconvert failed: PDF creating failed", and the server displays the error,
(/usr/local/texlive/2014/texmf-dist/tex/latex/ucs/data/uni-0.def)
! Undefined control sequence.
l.240 by \sout
{Matlab's} Python's \texttt{exp} function. For which of the
?
! Emergency stop.
l.240 by \sout
{Matlab's} Python's \texttt{exp} function. For which of the
! ==> Fatal error occurred, no output PDF file produced!
Transcript written on notebook.log.
Making an issue so it doesn't get forgotten. @jhamrick volunteered on Hackpad to take the lead here, and @jdfreder and I are willing to help.
There's a simple skeleton of docs there, but we should:
jupyter nbconvert
instead of ipython nbconvert
)This is going to be super-fun to debug:
* $A \parallel B_{CD}$
renders as
in --to slides
(a line break is inserted or so). It renders correctly in --to html
. Removing any one of *
, \parallel
, or replacing {CD}
with {C}
fixes the rendering.
A workaround is to split a single math environment into several: $A$ $\parallel$ $B_{CD}$
. Not sure what to do with $$ $$
.
Fragments are being propagated to other slides where you have "-" cells.
This is reported on the ipython/ipython repo at:
It's impossible to install nbconvert
in ubuntu 14.04 with python 2.7 since this commit. There is a bug in urlib http://bugs.python.org/issue11220 urllib send SSLv23 protocol and the jupyter cdn server only accepts SSLv3.
With
foo.md:
if x > 0:
print x
Then:
pandoc -s foo.md -o foo.tex
foo.tex contains:
\newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}}
and many similar commands.
But https://github.com/jupyter/nbconvert/blob/master/nbconvert/templates/latex/base.tplx
defines only a subset of these. (Using pandoc 1.15.0.6)
This means that a similar IPython notebook crashes with an undefined command \ControlFlowTok
when
running nbconvert --to pdf
.
Markdown heading anchors carry over to slides, where they have no effect due to being overridden. Their presence leads to visual junk on mouseover, and the slides jump to start when an anchor is accidentally clicked.
I guess removing anchor generation in markdown2html
would be a solution.
http://nbconvert.readthedocs.org/en/latest/customizing.html
near the end.
Not sure if conversion issue, or missing from source file.
When attempting to convert a (seemingly valid) NotebookNode
created a couple different ways, some throw errors at me.
import json
import nbconvert
import nbformat
mydict = json.loads('{"cells":[{"cell_type":"code","execution_count":null,"metadata":{"collapsed":true},"outputs":[],"source":[]}],"metadata":{"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.4.2"}},"nbformat":4,"nbformat_minor":0}')
nnode1 = nbformat.NotebookNode(mydict) # exporting causes AttributeError
nnode2 = nbformat.from_dict(mydict) # exporting causes TypeError
nnode3 = nbformat.reads(json.dumps(mydict), as_version=4)
exporter = nbconvert.html.HTMLExporter()
exporter.from_notebook_node(nnode3)
Attempting to convert nnode1
gives AttributeError: 'dict' object has no attribute 'cell_type', while no. 2 results in TypeError: expected string or buffer, both in and around nbconvert/preprocessors/highlightmagics.py:preprocess_cell(...).
Am I doing it wrong or is the package?
Since we also have to use mathjax in the html output (not only slides) it makes sense to use our custom mathjax macro as we do right now, but we can probably improve it to make it more compatible with the slides using ideas from the reveal mathjax plugin implementation.
Running
jupyter nbconvert --execute notebook_jl.ipynb --to markdown
(on the file in nbconvert/tests/files/) gives the following error
[NbConvertApp] Converting notebook notebook_jl.ipynb to markdown
[NbConvertApp] Executing notebook with kernel: julia-0.4
Starting kernel event loops.
[NbConvertApp] ERROR | failed to run cell: KeyError('status',)
[NbConvertApp] ERROR | function foobar(x)
100x
end
Traceback (most recent call last):
File "/usr/local/bin/jupyter-nbconvert", line 6, in <module>
main()
File "/usr/local/lib/python2.7/site-packages/jupyter_core/application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/usr/local/lib/python2.7/site-packages/traitlets/config/application.py", line 592, in launch_instance
app.start()
File "/usr/local/lib/python2.7/site-packages/nbconvert/nbconvertapp.py", line 286, in start
self.convert_notebooks()
File "/usr/local/lib/python2.7/site-packages/nbconvert/nbconvertapp.py", line 409, in convert_notebooks
self.convert_single_notebook(notebook_filename)
File "/usr/local/lib/python2.7/site-packages/nbconvert/nbconvertapp.py", line 380, in convert_single_notebook
output, resources = self.export_single_notebook(notebook_filename, resources)
File "/usr/local/lib/python2.7/site-packages/nbconvert/nbconvertapp.py", line 332, in export_single_notebook
output, resources = self.exporter.from_filename(notebook_filename, resources=resources)
File "/usr/local/lib/python2.7/site-packages/nbconvert/exporters/exporter.py", line 166, in from_filename
return self.from_notebook_node(nbformat.read(f, as_version=4), resources=resources, **kw)
File "/usr/local/lib/python2.7/site-packages/nbconvert/exporters/templateexporter.py", line 198, in from_notebook_node
nb_copy, resources = super(TemplateExporter, self).from_notebook_node(nb, resources, **kw)
File "/usr/local/lib/python2.7/site-packages/nbconvert/exporters/exporter.py", line 131, in from_notebook_node
nb_copy, resources = self._preprocess(nb_copy, resources)
File "/usr/local/lib/python2.7/site-packages/nbconvert/exporters/exporter.py", line 303, in _preprocess
nbc, resc = preprocessor(nbc, resc)
File "/usr/local/lib/python2.7/site-packages/nbconvert/preprocessors/base.py", line 47, in __call__
return self.preprocess(nb,resources)
File "/usr/local/lib/python2.7/site-packages/nbconvert/preprocessors/execute.py", line 83, in preprocess
nb, resources = super(ExecutePreprocessor, self).preprocess(nb, resources)
File "/usr/local/lib/python2.7/site-packages/nbconvert/preprocessors/base.py", line 70, in preprocess
nb.cells[index], resources = self.preprocess_cell(cell, resources, index)
File "/usr/local/lib/python2.7/site-packages/nbconvert/preprocessors/execute.py", line 97, in preprocess_cell
outputs = self.run_cell(cell)
File "/usr/local/lib/python2.7/site-packages/nbconvert/preprocessors/execute.py", line 128, in run_cell
if msg['metadata']['status'] == 'error' and not self.allow_errors:
KeyError: 'status'
Try with this nb:
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"# Header 1"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "fragment"
}
},
"source": [
"fragment"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"#head2"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"10"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"5+5"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"No fragment"
]
}
],
"metadata": {
"celltoolbar": "Slideshow",
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.9"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Converting markdown like [Header](#Header)
to LaTeX just strips out the anchor link instead of inserting \ref{header}
(even though \label{header}
is actually inserted next to the header)
When a cell times out in nbconvert with --execute
flag the traceback shows this traceback:
[NbConvertApp] ERROR | from time import sleep
sleep(2 * 60)
Traceback (most recent call last):
File "/usr/local/bin/ipython", line 11, in <module>
sys.exit(start_ipython())
File "/usr/local/lib/python2.7/dist-packages/IPython/__init__.py", line 120, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/IPython/config/application.py", line 574, in launch_instance
app.start()
File "/usr/local/lib/python2.7/dist-packages/IPython/terminal/ipapp.py", line 367, in start
return self.subapp.start()
File "/usr/local/lib/python2.7/dist-packages/IPython/nbconvert/nbconvertapp.py", line 278, in start
self.convert_notebooks()
File "/usr/local/lib/python2.7/dist-packages/IPython/nbconvert/nbconvertapp.py", line 401, in convert_notebooks
self.convert_single_notebook(notebook_filename)
File "/usr/local/lib/python2.7/dist-packages/IPython/nbconvert/nbconvertapp.py", line 372, in convert_single_notebook
output, resources = self.export_single_notebook(notebook_filename, resources)
File "/usr/local/lib/python2.7/dist-packages/IPython/nbconvert/nbconvertapp.py", line 324, in export_single_notebook
output, resources = self.exporter.from_filename(notebook_filename, resources=resources)
File "/usr/local/lib/python2.7/dist-packages/IPython/nbconvert/exporters/exporter.py", line 156, in from_filename
return self.from_notebook_node(nbformat.read(f, as_version=4), resources=resources, **kw)
File "/usr/local/lib/python2.7/dist-packages/IPython/nbconvert/exporters/notebook.py", line 26, in from_notebook_node
nb_copy, resources = super(NotebookExporter, self).from_notebook_node(nb, resources, **kw)
File "/usr/local/lib/python2.7/dist-packages/IPython/nbconvert/exporters/exporter.py", line 127, in from_notebook_node
nb_copy, resources = self._preprocess(nb_copy, resources)
File "/usr/local/lib/python2.7/dist-packages/IPython/nbconvert/exporters/exporter.py", line 281, in _preprocess
nbc, resc = preprocessor(nbc, resc)
File "/usr/local/lib/python2.7/dist-packages/IPython/nbconvert/preprocessors/base.py", line 47, in __call__
return self.preprocess(nb,resources)
File "/usr/local/lib/python2.7/dist-packages/IPython/nbconvert/preprocessors/execute.py", line 59, in preprocess
nb, resources = super(ExecutePreprocessor, self).preprocess(nb, resources)
File "/usr/local/lib/python2.7/dist-packages/IPython/nbconvert/preprocessors/base.py", line 70, in preprocess
nb.cells[index], resources = self.preprocess_cell(cell, resources, index)
File "/usr/local/lib/python2.7/dist-packages/IPython/nbconvert/preprocessors/execute.py", line 73, in preprocess_cell
outputs = self.run_cell(cell)
File "/usr/local/lib/python2.7/dist-packages/IPython/nbconvert/preprocessors/execute.py", line 87, in run_cell
msg = self.kc.shell_channel.get_msg(timeout=self.timeout)
File "/usr/local/lib/python2.7/dist-packages/IPython/kernel/blocking/channels.py", line 57, in get_msg
raise Empty
Empty
If you suspect this is an IPython bug, please report it at:
https://github.com/ipython/ipython/issues
or send an email to the mailing list at [email protected]
You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.
Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
c.Application.verbose_crash=True
I believe the raised error message here should be more informative (I didn't realize there was a timeout at all).
Details: tested on IPython 3.2.1, with a notebook containing a single cell
from time import sleep
sleep(2 * 60)
Using the command ipython nbconvert --to notebook --execute test_notebook.ipynb
.
When I use --execute
with a python 3 kernel the cells get not evaluated. Instead I get a timeout for each cell:
$ jupyter nbconvert --execute dummy.ipynb
[NbConvertApp] Converting notebook dummy.ipynb to html
[NbConvertApp] Executing notebook with kernel: python_dummy
[NbConvertApp] WARNING | Timeout waiting for IOPub output
[NbConvertApp] WARNING | Timeout waiting for IOPub output
[NbConvertApp] WARNING | Timeout waiting for IOPub output
[NbConvertApp] Writing 188812 bytes to dummy.html
The output dummy.html
doesn't have any output cells.
I create a kernel python_dummy
with this kernel.json
{
"display_name": "Python kernel for dummy",
"language": "python",
"argv": [
"/usr/bin/python3",
"-m",
"ipykernel",
"-f",
"{connection_file}"
]
}
With ipython notebook
I create a simple notebook dummy.ipynb
that runs kernel python_dummy
and has only two input cells:
In [1]: x = 3
In [2]: x
Out[2]: 3
In [ ]:
From Out[2]
we can see that python_dummy
was started sucessfully.
When I run jupyter nbconvert --execute dummy.ipynb
I get the problem mentioned above.
When change to python2 in kernel.json
:
{
"display_name": "Python kernel for dummy",
"language": "python",
"argv": [
"/usr/bin/python2",
"-m",
"ipykernel",
"-f",
"{connection_file}"
]
}
everything works as expected:
jupyter nbconvert --execute dummy.ipynb
[NbConvertApp] Converting notebook dummy.ipynb to html
[NbConvertApp] Executing notebook with kernel: python_dummy
[NbConvertApp] Writing 189041 bytes to dummy.html
dummy.html
now contains the Out[2]: 3
as well.
Replacing ipykernel
with IPython.kernel
produces the same results.
python3
ipykernel==4.0.3
ipyparallel==4.0.2
ipython==4.0.0
ipython-genutils==0.1.0
ipywidgets==4.0.2
jupyter==1.0.0
jupyter-client==4.0.0
jupyter-console==4.0.2
jupyter-core==4.0.4
nbconvert==4.0.0
nbformat==4.0.0
python2
ipykernel==4.0.3
ipyparallel==4.0.2
ipython==4.0.0
ipython-genutils==0.1.0
jupyter-client==4.0.0
jupyter-core==4.0.4
nbconvert==4.0.0
nbformat==4.0.0
Migrating this issue from ipython/ipython#8286 so it can be tracked here.
@damontallen opened ipython/ipython#8026
As an example this notebook renders correctly in nbviewer and in the live notebook but when it is converted to Latex the cell output is forced to one line (pdf output). I've traced the problem to the addition of adjustbox to equation output. According to the documentation at ftp://ftp.dante.de/tex-archive/macros/latex/contrib/adjustbox/adjustbox.pdf (section 4.10, page 20) minipage must be used with adjustbox to allow for the use of linebreaks - "This allows for line breaks and footnotes in the adjustbox ."
Adjustbox was implemented in PR ipython/ipython#5694 to limit equations to page width but instead of using "max width" it should be minipage (line 164 of IPython/nbconvert/templates/latex/base.tplx). However there needs to be an additional addition of '' for ever newline in an equation's output and I don't know where that needs to be added. This also changes the behaviour of the rendering of the equation from centered to left justified even when '$$' was used. I don't know how to fix this.
I am using IPython 4.0.0 and the new separate Jupyter command format with my Notebooks. I believe there is a bug that was always present in IPython 3.4 wherein converting a Notebook containing a commuting diagram (included in the Notebook via MathJax extension AMScd.js) to HTML leads to striping of some backslashes within the \begin{CD} … \end{CD}
environment. Here's a minimal example.
## A minimal (non)working example for AMScd
$\require{AMScd}$
\begin{CD}
A @>a>> B\\
@AAA @AAA\\
C @>c>> D
\end{CD}
The output looks like:
whereas it should like:
The latter was obtained by explicitly fixing the generated HTML file (as below) by adding in the stripped backslashes.
<body>
<div tabindex="-1" id="notebook" class="border-box-sizing">
<div class="container" id="notebook-container">
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h2 id="A-minimal-(non)working-example-for-AMScd">A minimal (non)working example for AMScd<a class="anchor-link" href="#A-minimal-(non)working-example-for-AMScd">¶</a></h2><p>$\require{AMScd}$
\begin{CD}
A @>a>> B\\
@AAA @AAA\\
C @>c>> D
\end{CD}</p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
@bollwyvl has raised a lot of concern about this and I agree with most of them, I think we should revisit our previous decision to have scrolling slides or make something like a long slide
for people interested in that option.
Check @bollwyvl 's points below:
I think the phrase I used before was that they "break the medium"... slides "unintentionally" bigger (i.e. not infinite like prezi, etc.) than the screen...
perhaps an explicit longslide slidetype that, if found, would enable the scrolling, while slide would conform to the reveal model would be less surprising.
Hello! A bit of a regression in the new v4 header types. Prior to nbconvert 4, running this code converted a python notebook into something that was able to be read by Sphinx properly:
app = nb.NbConvertApp.instance() # @UndefinedVariable
app.initialize(argv=['--to', 'rst', ipythonNotebookFilePath])
app.writer.build_directory = os.path.dirname(ipythonNotebookFilePath)
app.start()
In the newest version, however, all headings (which are now just markdown with # prefixes) get converted to top level ============ rst headings, rather than ======== or --------- or ~~~~~~~ according to the context. Generating the markdown directly via nbconvert and then converting via pandoc to rst does not show this problem whether or not --atx-headers
is selected.
Thanks for great work!
Downstream issue:
jupyter/nbviewer#466
Minimal test case:
https://gist.github.com/9a387ff6c870a59889c2.git
Error occurs here:
https://github.com/ipython/ipython/blob/3.x/IPython/nbconvert/preprocessors/revealhelp.py#L54
Possible fixes:
do two passes through the cells, first with the current:
https://github.com/ipython/ipython/blob/3.x/IPython/nbconvert/preprocessors/revealhelp.py#L34-37
then repeat the loop with the rest of the loop.
Cloning and executing pip install -r requirements.txt -e . results into
Running setup.py develop for nbconvert
Complete output from command /home/xxx/.virtualenvs/jupyter-dev/bin/python -c "import setuptools, tokenize; __file__='/home/xxx/code/nbconvert/setup.py'; exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" develop --no-deps:
/home/xxx/.virtualenvs/jupyter-dev/local/lib/python2.7/site-packages/setuptools/dist.py:282: UserWarning: Normalizing '4.0.0.dev' to '4.0.0.dev0'
normalized_version,
running develop
running css
Failed to download css from https://cdn.jupyter.org/notebook/4.0.0-dev/style/style.min.css: [Errno socket error] [Errno 1] _ssl.c:510: error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error
error: Need Notebook CSS to proceed: nbconvert/resources/style.min.css
Any ideas?
Install notebook but display this error:
Complete output from command /Users/dongweiming/.virtualenvs/jupyter_notebook/bin/python -c "import setuptools, tokenize; __file__='/Users/dongweiming/.virtualenvs/jupyter_notebook/src/nbconvert/setup.py'; exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" develop --no-deps:
running develop
running css
Failed to download css from https://cdn.jupyter.org/notebook/4.0.0-dev/style/style.min.css: [Errno socket error] [Errno 1] _ssl.c:504: error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error
error: None
----------------------------------------
Command "/Users/dongweiming/.virtualenvs/jupyter_notebook/bin/python -c "import setuptools, tokenize; __file__='/Users/dongweiming/.virtualenvs/jupyter_notebook/src/nbconvert/setup.py'; exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" develop --no-deps" failed with error code 1 in /Users/dongweiming/.virtualenvs/jupyter_notebook/src/nbconvert
i have to use http://
instead of https://
Instead of serving to the localhost
ip address, I would like to configure the ip address and port served for viewing the slide shows. This could be done by adding another post-processor to the nbconvert
command:
jupyter nbconvert --to slides --post serve --ip X.X.X.X --port XXXX <notebook.ipynb
The default value would continue to be 127.0.0.0
but this would allow the usage of 0.0.0.0
or any other custom IP address for serving the slide show on the local or public network. This would also allow for custom port incase the default 8000 is already used.
I have the following notebook:
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"$s_i = s_{i}\n",
"$"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.9"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
The math $s_i = s_{i}$
renders correctly in the notebook interface, but ipython nbconvert --to html bad_mathjax.ipynb
gives the following HTML for the math:
<p>$s<em>i = s</em>{i}
$</p>
So - the underscores in the math have been interpreted as markdown emphasis. This does not occur when the closing dollar is on the same line as the rest of the inline math, and does not occur when using pandoc to convert the equivalent pure markdown file.
nbconvert is currently bundling CSS from notebook master. This should be updated to 4.0 stable when we release the notebook package.
The .ipnb to .py translation works wonderfully, except that some imports are taken for granted when working in an IPython notebook. For the exported .py script to work properly, the packages and modules used should be explicitly 'imported' at the top of the .py file.
I'm pretty sure this issue has to do with Jupyter more than IPython, seeing that nbconvert under the IPython repo has been inactive for a couple of years
I have observed that slides generated by nbconvert from current master trigger mathjax redraws on every navigation event:
See
http://nbviewer.ipython.org/format/slides/url/antonakhmerov.org/misc/slides_mathjax_render.ipynb (nbviewer seems to have the same issue)
In case nbviewer code is modified, here's the generated html:
http://antonakhmerov.org/misc/slides_mathjax_render.slides.html
The bug manifests in blinking of $\LaTeX$
when the next fragment is shown.
Resolving #67 could solve also this issue.
When trying to convert a notebook that has -
in the name, I get the following error:
[NbConvertApp] CRITICAL | Bad config encountered during initialization:
[NbConvertApp] CRITICAL | Invalid argument: '-'
This was done using the following command:
jupyter nbconvert "0 - <notebook name>.ipynb" --to slides --post serve
The live Notebook allows for rendering markdown inside inline block-level html, such that both of these show up in the notebook:
<div>[a link in a block](#)</div>
<span>[a link in a span](#)</span>
nbconvert, and therefore nbviewer, will not render the first link if using the mistune engine, as the author has indicated that mistune will continue to be spec-driven in lepture/mistune#51, following this guidance:
Note that Markdown formatting syntax is not processed within block-level HTML tags. E.g., you can’t use Markdown-style emphasis inside an HTML block.
...
Unlike block-level HTML tags, Markdown syntax is processed within span-level tags.
So... options:
pedantic
mode, potentially breaking a lot of notebooks for being not up to spec.linked to jupyter/nbviewer#458
The HTML full.tpl template has a large (~50 line) header block. Templates inheriting from this will likely want to add to the HTML headers, but they can't use super()
to add to it, because it closes the <head></head>
tag inside the block, so additions would fall outside that.
There should be one or more Jinja blocks inside the <head></head>
tag which other templates can override.
I recently encounter a problem that does not happen when I use ipython 2.x.
I convert ipynb to pdf using my own template which refers to additional files like logo.eps etc.
Before I always create my own working directory and put all files (ipynb file, tplx file, eps file, etc) under it and run nbconvert. It works fine.
However it breaks recently due to that in the new PDFExporter, the pdflatex runs in another temporary directory where only the tex files and the output files along with the latex generations are written to that directory. So I will get a '***' File Not Found error finally because the pdflatex cannot find the 'eps' file.
In contrast, in the old days, the 'PDF' postprocessor (deprecated now) did run in-place so there was no such problems.
Do we have an elegant way to specify additional files that should run with pdflatex? I found it's not obvious to insert the files i need in resources['outputs']
, although it's not impossible
It would be nice to find a way when you remove Javascript from display_priority to have a prefiter and a template to ass a warning that JS has been disbled.
Assigning to me, but I'll probably not have a look in the couple few weeks.
Missing tokens definitions when converting to Pdf
The default value for Type
when no default specified changed from None
to object
, to make validation more consistent. However, nbconvert relies on the default for NbconvertApp.postprocessor_factory
being None (or Falsy, at least).
This is simple to fix, I'm just contemplating the best way to do it.
If you create a markdown cell with the following contents:
# header
The resulting rendered cell is blank.
http://stackoverflow.com/questions/32556675/writing-a-header-in-ipython-notebook-causes-the-header-to-be-invisible
I'm using IPython 3.0.0 and having various issues with slide conversion.
(I had to manually install mistune (pip installed mistune.version '0.5.1')
Scenario 0:
ipython nbconvert --to slides TestSlides.ipynb --post serve
This works, but you see it is getting an old reveal 2.6.2
[NbConvertApp] Redirecting reveal.js requests to https://cdn.jsdelivr.net/reveal.js/2.6.2
Note, if you use nbviewer it uses reveal 3.1.0
The problem is that you can't put these on a live server unless it is has reveal.js installed in that local directory.
Scenario 1:
ipython nbconvert --to slides TestSlides.ipynb
python -m SimpleHTTPServer 8000
This browser sees the html, but they don't act as slides b/c reveal.js isn't found.
Scenario 2:
ipython nbconvert --to slides TestSlides.ipynb
wget https://github.com/hakimel/reveal.js/archive/3.0.0.tar.gz
tar -xvf 3.0.0.tar.gz
mv reveal.js-3.0.0 reveal.js
python -m SimpleHTTPServer 8000
Now the browser sees the reveal.js (js and css) resources, but for some reason it renders as a blank screen. It also still has problem that you can't deploy without making a copy of reveal.js in the corresponding directory on the live server.
Scenario 3:
ipython nbconvert --to slides TestSlides.ipynb --reveal-prefix https://cdn.jsdelivr.net/reveal.js/2.6.2
python -m SimpleHTTPServer 8000
This works now locally and on live server, but with old reveal.js
Scenario 4:
ipython nbconvert --to slides TestSlides.ipynb --reveal-prefix http://cdn.bootcss.com/reveal.js/3.1.0
python -m SimpleHTTPServer 8000
This gives similar behavior as Scenario 2, the resources are there but the browser renders an empty screen. In both Scenario 2 & 4 I see these errors in the console:
[Error] ReferenceError: Can't find variable: Reveal
global code (TestSlides.slides.html, line 333)
[Error] Error: Mismatched anonymous define() module: function () {
root.Reveal = factory();
return root.Reveal;
}
http://requirejs.org/docs/errors.html#mismatch
da (require.min.js, line 8)
w (require.min.js, line 12)
M (require.min.js, line 15)
(anonymous function) (require.min.js, line 26)
Nbconvert tries to import jupyter_notebook
in order to include some CSS files from it:
from jupyter_notebook import DEFAULT_STATIC_FILES_PATH
This is causing test failures because we don't declare jupyter_notebook as a dependency, so it's not installed for the tests. We could add it as a dependency, but then there's a circular dependency, which is a bit messy.
When converting a notebook to RST, code blocks with magics are still converted into python code blocks. For example, this:
%%bash
git checkout master
... gets translated to this:
.. code:: python
%%bash
git checkout master
Shouldn't it be converted to recognize the language specific cell magics, like the following?
.. code:: bash
git checkout master
Over on nbviewer, there are enough differences from how we construct the page vs the standalone slides output (menus, etc.) that we can't use the body
of reveal_slides.tpl. I use a regular expression to strip out everything prior to the body
tag, but this has proven brittle (though I'm staying with it for now).
In the same vein as #64, It would be nice to break up the template into even more blocks: this would have no impact on the actual template output, but would make subclassing the templates far easier. A quick look through the template suggest to me:
header
title
cdn_assets
resources_inlining
inline_css
body
reveal
slides
post_slides
Happy to help/PR if this is welcome.
Hi,
I'm experiencing an issue that I think has been fixed, I may just not be able to link to the proper version of reveal.js
When I do ipython nbconvert Untitled6.ipynb --to slides --post serve --reveal-prefix http://cdn.jsdelivr.net/reveal.js/2.6.2
, everything works fine, but if I use ipython nbconvert --to slides --post serve --reveal-prefix http://cdn.bootcss.com/reveal.js/3.1.0
, I see a blank screen.
Now I've tried downloading the master and dev branches and adding them locally (e.g. --reveal-prefix "reveal.js-dev"
), but I get the same result.
The reason I want to access a newer version of reveal.js is maybe a bit trivial: I'd like to use the black theme, which doesn't seem to be available in 2.6.2.
We currently explicitly have the latex syntax highlighting commands in https://github.com/jupyter/nbconvert/blob/master/nbconvert/templates/latex/base.tplx.
Don't want to force a pandoc dependency for install, so can't auto extract these there, I think.
Perhaps do this with a script which runs in travis and updates this repo?
See my comment in PR #62.
Something else to consider: merely setting the theme for reveal.js is not enough, some of the CSS produced by nbconvert will override stuff in the reveal.js theme. The fix might be as easy as moving the position of the revealjs link
tag further down, but I haven't looked into it enough yet.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.