Weave.jl/doc/src/notebooks.md

48 lines
1.3 KiB
Markdown
Raw Normal View History

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
2016-12-15 20:08:49 +01:00
Weave supports using Jupyter notebooks as input format, this means you
can weave notebooks to any supported formats. You can't use chunk options with notebooks.
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
weave("notebook.ipynb")
```
2018-01-07 11:31:06 +01:00
## Output to Jupyter notebooks
As of Weave 0.5.1. there is new `notebook` method to convert Weave documents
to Jupyter notebooks using [nbconvert](http://nbconvert.readthedocs.io/en/latest/execute_api.html). The code **is not executed by Weave**
and the output doesn't always work properly,
2018-01-07 11:31:06 +01:00
see [#116](https://github.com/mpastell/Weave.jl/issues/116).
```@docs
notebook(source::String, out_path=:pwd)
```
You might want to use the `convert_doc` method below instead and run the code in Jupyter.
You can select the `jupyter` used to execute the notebook with the `jupyter_path` argument (this defaults to the string "jupyter," i.e., whatever you have linked to that location.)
2016-12-12 13:05:26 +01:00
## Converting between formats
You can convert between all supported input formats using the `convert_doc`
function.
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")
```
and from notebooks to markdown use:
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
convert_doc(infile::String, outfile::String)
```