Weave.jl/v0.9.0/notebooks/index.html

3 lines
6.5 KiB
HTML

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Working with Jupyter notebooks · Weave.jl</title><link href="https://cdnjs.cloudflare.com/ajax/libs/normalize/4.2.0/normalize.min.css" rel="stylesheet" type="text/css"/><link href="https://fonts.googleapis.com/css?family=Lato|Roboto+Mono" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL=".."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js" data-main="../assets/documenter.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/></head><body><nav class="toc"><h1>Weave.jl</h1><select id="version-selector" onChange="window.location.href=this.value" style="visibility: hidden"></select><form class="search" id="search-form" action="../search/"><input id="search-query" name="q" type="text" placeholder="Search docs"/></form><ul><li><a class="toctext" href="../">Weave.jl - Scientific Reports Using Julia</a></li><li><a class="toctext" href="../getting_started/">Getting started</a></li><li><a class="toctext" href="../usage/">Using Weave</a></li><li><a class="toctext" href="../publish/">Publishing to html and pdf</a></li><li><a class="toctext" href="../chunk_options/">Chunk options</a></li><li class="current"><a class="toctext" href>Working with Jupyter notebooks</a><ul class="internal"><li><a class="toctext" href="#Weaving-from-Jupyter-notebooks-1">Weaving from Jupyter notebooks</a></li><li><a class="toctext" href="#Output-to-Jupyter-notebooks-1">Output to Jupyter notebooks</a></li><li><a class="toctext" href="#Converting-between-formats-1">Converting between formats</a></li></ul></li><li><a class="toctext" href="../function_index/">Function index</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href>Working with Jupyter notebooks</a></li></ul><a class="edit-page" href="https://github.com/mpastell/Weave.jl/blob/master/doc/src/notebooks.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>Working with Jupyter notebooks</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Working-with-Jupyter-notebooks-1" href="#Working-with-Jupyter-notebooks-1">Working with Jupyter notebooks</a></h1><h2><a class="nav-anchor" id="Weaving-from-Jupyter-notebooks-1" href="#Weaving-from-Jupyter-notebooks-1">Weaving from Jupyter notebooks</a></h2><p>Weave supports using Jupyter notebooks as input format, this means you can weave notebooks to any supported formats. You can&#39;t use chunk options with notebooks.</p><pre><code class="language-julia">weave(&quot;notebook.ipynb&quot;)</code></pre><h2><a class="nav-anchor" id="Output-to-Jupyter-notebooks-1" href="#Output-to-Jupyter-notebooks-1">Output to Jupyter notebooks</a></h2><p>As of Weave 0.5.1. there is new <code>notebook</code> method to convert Weave documents to Jupyter notebooks using <a href="http://nbconvert.readthedocs.io/en/latest/execute_api.html">nbconvert</a>. The code <strong>is not executed by Weave</strong> and the output doesn&#39;t always work properly, see <a href="https://github.com/mpastell/Weave.jl/issues/116">#116</a>.</p><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Weave.notebook" href="#Weave.notebook"><code>Weave.notebook</code></a><span class="docstring-category">Function</span>.</div><div><div><p>notebook(source::String, out<em>path=:pwd, timeout=-1, nbconvert</em>options=&quot;&quot;)</p><p>Convert Weave document <code>source</code> to Jupyter notebook and execute the code using nbconvert. Requires IJulia. <strong>Ignores</strong> all chunk options</p><ul><li><code>out_path</code>: Path where the output is generated. Can be: <code>:doc</code>: Path of the source document, <code>:pwd</code>: Julia working directory, <code>&quot;somepath&quot;</code>: Path as a String e.g <code>&quot;/home/mpastell/weaveout&quot;</code></li><li><code>timeout</code>: nbconvert cell timeout in seconds. Defaults to -1 (no timeout)</li><li><code>nbconvert_options</code>: string of additional options to pass to nbconvert, such as <code>--allow-errors</code></li></ul></div></div><a class="source-link" target="_blank" href="https://github.com/mpastell/Weave.jl/blob/c9a814759dba764931582f7dc91e0d92633a7e4d/src/Weave.jl#L173-L184">source</a></section><p>You might wan&#39;t to use the <code>convert_doc</code> method below instead and run the code in Jupyter.</p><h2><a class="nav-anchor" id="Converting-between-formats-1" href="#Converting-between-formats-1">Converting between formats</a></h2><p>You can convert between all supported input formats using the <code>convert_doc</code> function.</p><p>To convert from script to notebook:</p><pre><code class="language-julia">convert_doc(&quot;examples/FIR_design.jl&quot;, &quot;FIR_design.ipynb&quot;)</code></pre><p>and from notebooks to markdown use:</p><pre><code class="language-julia">convert_doc(&quot;FIR_design.ipynb&quot;, &quot;FIR_design.jmd&quot;)</code></pre><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Weave.convert_doc-Tuple{String,String}" href="#Weave.convert_doc-Tuple{String,String}"><code>Weave.convert_doc</code></a><span class="docstring-category">Method</span>.</div><div><div><p><code>convert_doc(infile::AbstractString, outfile::AbstractString; format = nothing)</code></p><p>Convert Weave documents between different formats</p><ul><li><code>infile</code> = Name of the input document</li><li><code>outfile</code> = Name of the output document</li><li><code>format</code> = Output format (optional). Detected from outfile extension, but can be set to <code>&quot;script&quot;</code>, <code>&quot;markdown&quot;</code>, <code>&quot;notebook&quot;</code> or <code>&quot;noweb&quot;</code>.</li></ul></div></div><a class="source-link" target="_blank" href="https://github.com/mpastell/Weave.jl/blob/c9a814759dba764931582f7dc91e0d92633a7e4d/src/writers.jl#L33-L42">source</a></section><footer><hr/><a class="previous" href="../chunk_options/"><span class="direction">Previous</span><span class="title">Chunk options</span></a><a class="next" href="../function_index/"><span class="direction">Next</span><span class="title">Function index</span></a></footer></article></body></html>