You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
8.6 KiB

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>4. Output formats · Examples.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>Examples.jl</h1><select id="version-selector" onChange="window.location.href=this.value" style="visibility: hidden"></select><form class="search" id="search-form" action="search.html"><input id="search-query" name="q" type="text" placeholder="Search docs"/></form><ul><li><a class="toctext" href="index.html"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="fileformat.html"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="pipeline.html"><strong>3.</strong> Processing pipeline</a></li><li class="current"><a class="toctext" href="outputformats.html"><strong>4.</strong> Output formats</a><ul class="internal"><li><a class="toctext" href="#Markdown-output-1"><strong>4.1.</strong> Markdown output</a></li><li><a class="toctext" href="#Notebook-output-1"><strong>4.2.</strong> Notebook output</a></li><li><a class="toctext" href="#Script-output-1"><strong>4.3.</strong> Script output</a></li></ul></li><li><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li><li><a class="toctext" href="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><a class="toctext" href="generated/example.html"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href="outputformats.html"><strong>4.</strong> Output formats</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Examples.jl/blob/master/docs/src/outputformats.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>4. Output formats</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Output-formats-1" href="#Output-formats-1"><strong>4.</strong> Output formats</a></h1><h2><a class="nav-anchor" id="Markdown-output-1" href="#Markdown-output-1"><strong>4.1.</strong> Markdown output</a></h2><pre><code class="language-none">#&#39; # Markdown ┐
#&#39;
#&#39; This line is treated as markdown, since it starts with #&#39;
#&#39; The leading #&#39; (including the space) is removed ┘
#&#39; Here is an example with some code ]
x = sin.(cos.([1, 2, 3])) ┐
y = x.^2 - x ┘</code></pre><p>By default, <code>CodeChunks</code> written to Documenter <code>@example</code> blocks. For example, the code above would result in the following markdown:</p><pre><code class="language-markdown"># Markdown
This line is treated as markdown, since it starts with #&#39;
The leading #&#39; (including the space) is removed
Here is an example with some code
```@example
x = sin.(cos.([1, 2, 3]))
y = x.^2 - x
```</code></pre><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Examples.markdown" href="#Examples.markdown"><code>Examples.markdown</code></a><span class="docstring-category">Function</span>.</div><div><div><pre><code class="language-none">Examples.markdown(inputfile, outputdir; kwargs...)</code></pre><p>Generate a markdown file from <code>inputfile</code> and write the result to the directory<code>outputdir</code>.</p><p>Keyword arguments:</p><ul><li><code>name</code>: name of the output file, excluding <code>.md</code>. <code>name</code> is also used to name all the <code>@example</code> blocks. Defaults to the filename of <code>inputfile</code>.</li><li><code>preprocess</code>, <code>postprocess</code>: custom pre- and post-processing functions, see the <a href="customprocessing.html#Custom-pre-and-post-processing-1">Custom pre- and post-processing</a> section of the manual. Defaults to <code>identity</code>.</li><li><code>documenter</code>: boolean that tells if the output is intended to use with Documenter.jl. Defaults to <code>true</code>. See the the manual section on <a href="documenter.html#Interaction-with-Documenter-1">Interaction with Documenter</a>.</li><li><code>codefence</code>: A <code>Pair</code> of opening and closing code fence. Defaults to<pre><code class="language-none">&quot;```@example $(name)&quot; =&gt; &quot;```&quot;</code></pre>if <code>documenter = true</code> and<pre><code class="language-none">&quot;```julia&quot; =&gt; &quot;```&quot;</code></pre>if <code>documenter = false</code>.</li></ul></div></div><a class="source-link" target="_blank" href="https://github.com/fredrikekre/Examples.jl/blob/2dcf8dca0a49f51ac963ac96d114811729b464d5/src/Examples.jl#L158-L182">source</a></section><h2><a class="nav-anchor" id="Notebook-output-1" href="#Notebook-output-1"><strong>4.2.</strong> Notebook output</a></h2><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Examples.notebook" href="#Examples.notebook"><code>Examples.notebook</code></a><span class="docstring-category">Function</span>.</div><div><div><pre><code class="language-none">Examples.notebook(inputfile, outputdir; kwargs...)</code></pre><p>Generate a notebook from <code>inputfile</code> and write the result to <code>outputdir</code>.</p><p>Keyword arguments:</p><ul><li><code>name</code>: name of the output file, excluding <code>.ipynb</code>. Defaults to the filename of <code>inputfile</code>.</li><li><code>preprocess</code>, <code>postprocess</code>: custom pre- and post-processing functions, see the <a href="customprocessing.html#Custom-pre-and-post-processing-1">Custom pre- and post-processing</a> section of the manual. Defaults to <code>identity</code>.</li><li><code>execute</code>: a boolean deciding if the generated notebook should also be executed or not. Defaults to <code>true</code>.</li><li><code>documenter</code>: boolean that says if the source contains Documenter.jl specific things to filter out during notebook generation. Defaults to <code>true</code>. See the the manual section on <a href="documenter.html#Interaction-with-Documenter-1">Interaction with Documenter</a>.</li></ul></div></div><a class="source-link" target="_blank" href="https://github.com/fredrikekre/Examples.jl/blob/2dcf8dca0a49f51ac963ac96d114811729b464d5/src/Examples.jl#L268-L284">source</a></section><h2><a class="nav-anchor" id="Script-output-1" href="#Script-output-1"><strong>4.3.</strong> Script output</a></h2><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Examples.script" href="#Examples.script"><code>Examples.script</code></a><span class="docstring-category">Function</span>.</div><div><div><pre><code class="language-none">Examples.script(inputfile, outputdir; kwargs...)</code></pre><p>Generate a plain script file from <code>inputfile</code> and write the result to <code>outputdir</code>.</p><p>Keyword arguments:</p><ul><li><code>name</code>: name of the output file, excluding <code>.jl</code>. Defaults to the filename of <code>inputfile</code>.</li><li><code>preprocess</code>, <code>postprocess</code>: custom pre- and post-processing functions, see the <a href="customprocessing.html#Custom-pre-and-post-processing-1">Custom pre- and post-processing</a> section of the manual. Defaults to <code>identity</code>.</li></ul></div></div><a class="source-link" target="_blank" href="https://github.com/fredrikekre/Examples.jl/blob/2dcf8dca0a49f51ac963ac96d114811729b464d5/src/Examples.jl#L93-L104">source</a></section><footer><hr/><a class="previous" href="pipeline.html"><span class="direction">Previous</span><span class="title"><strong>3.</strong> Processing pipeline</span></a><a class="next" href="customprocessing.html"><span class="direction">Next</span><span class="title"><strong>5.</strong> Custom pre- and post-processing</span></a></footer></article></body></html>