Giter Club home page Giter Club logo

nbconvert's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nbconvert's Issues

Add the --ip and --port post processors for the --post serve

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.

Incorrect conversion of inline math in markdown cell

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.

Converting some NotebookNodes to HTML throws errors

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?

h1 scrollbars in reveal

A markdown cell containing only a single first level heading acquires an ugly scrollbar.

caption_scrollbar_chrome

Adding an extra markdown line, or changing to heading 2 removes the scrollbar.

Review the scroll functionality in the slideshow

@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...

  • are not supported on any other slide platform
  • magnify the "i'm going to read you this slide" presentation style... most people can read well north of 300 words per minute in their mother tongue, and showing someone a dense slide, they'll likely tune you out until they've read it
  • break URLs: no way to link to a particular scrolled location. not that the reveal ones are great to begin with
  • are not liked by reveal, hence all our troubles
    • will likely never printable or exportable, one of the use cases i value a lot but haven't been able to handle succinctly... even without scrolling slides... but at least it is theoretically doable!
  • which require a scroll wheel/bar during a talk is distracting to the speaker and the listeners, and content will be in a half-revealed state, which again breaks focus for both parties
    • if the content really is big, like a big diagram or visualization, then temporary full screen/scroll/zoom on that content is a better fit... with text and margins so big, it's hard to even get 80 character code on a screen
  • break touch gestures (unless you've fixed that!)

perhaps an explicit longslide slidetype that, if found, would enable the scrolling, while slide would conform to the reveal model would be less surprising.

Bogus error message on timeout with --execute

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.

Latex error with strikethrough

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.

blank page when using -to slides

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.

Multiple line Latex output of code cells rendering all on one line.

@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.

Missing Kate highlighting commands in templates/latex/base.tplx

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.

--execute on julia kernel throws error

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'

convert to RST - cell magics in code blocks?

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

Cann't download css files

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://

"--execute" not working with python3 kernel.

The problem

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.

How to reproduce

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.

No issues with python2

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.

Versions

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

Markdown to RST converts all Headers to level 1

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!

Anchor links and conversion to LaTeX

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)

Export to .py should add 'import's

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

No easy way to disable output prompts in HTML templates

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.

Anchors in reveal

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.

Docs

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:

  • Update stuff (e.g. it's now jupyter nbconvert instead of ipython nbconvert)
  • Flesh out the descriptive info
  • Config docs (steal machinery from jupyter_console to generate these).
  • Create API docs
  • Get it building on RTD

slides display problem: reveal.js version conflict?

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)

Reveal ships a mathjax plugin... let's take the nice things of it

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.

Circular dependency between nbconvert and notebook

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.

Missing file during install

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?

markdown inside inline block-level HTML?

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:

  • this repo could opine "more like Notebook", and choose to re-implement this on top of mistune (we're already overloading it for math) or,
  • the Notebook could opine "more like the spec" and turn on marked's pedantic mode, potentially breaking a lot of notebooks for being not up to spec.
  • use commonmark and break everything

linked to jupyter/nbviewer#458

Totally broken by recent change to traitlets

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.

[slides] break up template into more blocks

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
    • reveal_require (a la #65)
      • reveal_init
        • reveal_config
          • would love to see this as a a json object in resources that could be extended, and ouput via something like this
      • reveal_events
    • reveal_mathjax
      • reveal_mathjax_config as above

Happy to help/PR if this is welcome.

Critical Error when converting python notebooks that contain `-` in the name

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

HTML from notebook containing commuting diagrams (via AMScd) has backslashes stripped

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:

ipynb_amscd_mnwe

whereas it should like:

jupyternb_amscd_mnwe

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">&#182;</a></h2><p>$\require{AMScd}$
\begin{CD}
A @&gt;a&gt;&gt; B\\
@AAA @AAA\\
C @&gt;c&gt;&gt; D
\end{CD}</p>

</div>
</div>
</div>
    </div>
  </div>
</body>
</html>

Add a template block in slides section to allow customisation of reveal.js

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.

Mathjax redraw in slides

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.

Warn if JS has been stripped

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.

CSS conflict with bokeh in conversion to slides?

When my nbconvert slides include a Bokeh plot, I get unwanted borders around the <td>, <tr> and <table> elements of the plot, inheriting from .rendered_html. The appearance of the dropdown for crosshair/hover is also affected (forced 'on').

screen shot 2015-06-03 at 14 10 37

Jupytr 3.1.0
Reveal.js 2.6.2
Bokeh 0.9.0

Reveal odd latex formatting

This is going to be super-fun to debug:

* $A \parallel B_{CD}$

renders as

reveal_bug

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 $$ $$.

nbviewer gives same behaviour with celltypes "Fragment" and "–"

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
}

Blocks to add to HTML header

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.

Additional Files not found when running pdflatex in PDFExporter

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

nbconvert_bug

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.