2016-12-12 13:05:26 +01:00
|
|
|
|
|
|
|
# Working with Jupyter notebooks
|
|
|
|
|
2018-01-07 11:31:06 +01:00
|
|
|
## Weaving from Jupyter notebooks
|
2016-12-12 13:05:26 +01:00
|
|
|
|
2020-03-27 12:43:33 +01:00
|
|
|
Weave supports using [Jupyter Notebook](https://jupyter.org/)s as input format.
|
|
|
|
This means you can [`weave`](@ref) notebooks to any supported formats;
|
|
|
|
by default, it will be weaved to HTML.
|
2016-12-12 13:05:26 +01:00
|
|
|
|
2016-12-12 20:40:05 +01:00
|
|
|
```julia
|
2020-03-27 12:43:33 +01:00
|
|
|
weave("notebook.ipynb") # will be weaved to HTML
|
2016-12-12 13:05:26 +01:00
|
|
|
```
|
|
|
|
|
2020-03-27 12:43:33 +01:00
|
|
|
!!! warning
|
|
|
|
You can't use chunk options with notebooks.
|
|
|
|
|
2018-01-07 11:31:06 +01:00
|
|
|
## Output to Jupyter notebooks
|
|
|
|
|
2020-03-27 12:43:33 +01:00
|
|
|
As of Weave 0.5.1. there is new [`notebook`](@ref) method to convert Weave documents to Jupyter notebooks using
|
|
|
|
[nbconvert](http://nbconvert.readthedocs.io/en/latest/execute_api.html).
|
2018-01-07 11:31:06 +01:00
|
|
|
|
|
|
|
```@docs
|
2020-03-06 01:59:32 +01:00
|
|
|
notebook
|
2018-01-07 11:31:06 +01:00
|
|
|
```
|
|
|
|
|
2020-03-27 12:43:33 +01:00
|
|
|
You can specify `jupyter` used to execute the notebook with the `jupyter_path` keyword argument
|
|
|
|
(this defaults to the `"jupyter"`, i.e. whatever you have linked to that location).
|
2019-06-19 19:26:13 +02:00
|
|
|
|
2020-03-27 12:43:33 +01:00
|
|
|
Instead, you might want to use the [`convert_doc`](@ref) method below and run the code in Jupyter.
|
2016-12-12 13:05:26 +01:00
|
|
|
|
|
|
|
## Converting between formats
|
|
|
|
|
2020-03-26 09:35:43 +01:00
|
|
|
You can convert between all supported input formats using the [`convert_doc`](@ref) function.
|
2016-12-12 13:05:26 +01:00
|
|
|
|
|
|
|
To convert from script to notebook:
|
|
|
|
|
2016-12-12 20:40:05 +01:00
|
|
|
```julia
|
2016-12-12 13:05:26 +01:00
|
|
|
convert_doc("examples/FIR_design.jl", "FIR_design.ipynb")
|
|
|
|
```
|
|
|
|
|
2020-03-27 12:43:33 +01:00
|
|
|
and from notebook to Markdown use:
|
2016-12-12 13:05:26 +01:00
|
|
|
|
2016-12-12 20:40:05 +01:00
|
|
|
```julia
|
2016-12-12 13:05:26 +01:00
|
|
|
convert_doc("FIR_design.ipynb", "FIR_design.jmd")
|
|
|
|
```
|
|
|
|
|
|
|
|
```@docs
|
2020-05-15 17:32:28 +02:00
|
|
|
convert_doc
|
2016-12-12 13:05:26 +01:00
|
|
|
```
|