@ -26,4 +26,4 @@ include("file2.jl")</code></pre><p>Let's say we have saved this fi
@@ -26,4 +26,4 @@ include("file2.jl")</code></pre><p>Let's say we have saved this fi
end
return str
end</code></pre><p>(of course replace <code>included</code> with your respective files)</p><p>Finally, you simply pass this function to e.g. <ahref="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a> as</p><pre><codeclass="language-julia hljs">Literate.markdown("examples.jl", "path/to/save/markdown";
name = "markdown_file_name", preprocess = replace_includes)</code></pre><p>and you will see that in the final output file (here <code>markdown_file_name.md</code>) the <code>include</code> statements are replaced with the actual code to be included!</p><p>This approach is used for generating <ahref="https://juliadynamics.github.io/TimeseriesPrediction.jl/latest/stexamples/">the examples</a> in the documentation of the <ahref="https://github.com/JuliaDynamics/TimeseriesPrediction.jl">TimeseriesPrediction.jl</a> package. The <ahref="https://github.com/JuliaDynamics/TimeseriesPrediction.jl/tree/dcb080376a7861716147c04e45c473f55bb9a078/examples">example files</a>, included together in the <ahref="https://github.com/JuliaDynamics/TimeseriesPrediction.jl/blob/dcb080376a7861716147c04e45c473f55bb9a078/docs/src/stexamples.jl">stexamples.jl</a> file, are processed by literate via this <ahref="https://github.com/JuliaDynamics/TimeseriesPrediction.jl/blob/dcb080376a7861716147c04e45c473f55bb9a078/docs/make.jl">make.jl</a> file to generate the markdown and code cells of the documentation.</p></article><navclass="docs-footer"><aclass="docs-footer-prevpage"href="../outputformats/">« <strong>4.</strong> Output formats</a><aclass="docs-footer-nextpage"href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl »</a><divclass="flexbox-break"></div><pclass="footer-message">Powered by <ahref="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <ahref="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><divclass="modal"id="documenter-settings"><divclass="modal-background"></div><divclass="modal-card"><headerclass="modal-card-head"><pclass="modal-card-title">Settings</p><buttonclass="delete"></button></header><sectionclass="modal-card-body"><p><labelclass="label">Theme</label><divclass="select"><selectid="documenter-themepicker"><optionvalue="auto">Automatic (OS)</option><optionvalue="documenter-light">documenter-light</option><optionvalue="documenter-dark">documenter-dark</option><optionvalue="catppuccin-latte">catppuccin-latte</option><optionvalue="catppuccin-frappe">catppuccin-frappe</option><optionvalue="catppuccin-macchiato">catppuccin-macchiato</option><optionvalue="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <ahref="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <spanclass="colophon-date"title="Tuesday 2 September 2025 08:16">Tuesday 2 September 2025</span>. Using Julia version 1.11.6.</p></section><footerclass="modal-card-foot"></footer></div></div></div></body></html>
name = "markdown_file_name", preprocess = replace_includes)</code></pre><p>and you will see that in the final output file (here <code>markdown_file_name.md</code>) the <code>include</code> statements are replaced with the actual code to be included!</p><p>This approach is used for generating <ahref="https://juliadynamics.github.io/TimeseriesPrediction.jl/latest/stexamples/">the examples</a> in the documentation of the <ahref="https://github.com/JuliaDynamics/TimeseriesPrediction.jl">TimeseriesPrediction.jl</a> package. The <ahref="https://github.com/JuliaDynamics/TimeseriesPrediction.jl/tree/dcb080376a7861716147c04e45c473f55bb9a078/examples">example files</a>, included together in the <ahref="https://github.com/JuliaDynamics/TimeseriesPrediction.jl/blob/dcb080376a7861716147c04e45c473f55bb9a078/docs/src/stexamples.jl">stexamples.jl</a> file, are processed by literate via this <ahref="https://github.com/JuliaDynamics/TimeseriesPrediction.jl/blob/dcb080376a7861716147c04e45c473f55bb9a078/docs/make.jl">make.jl</a> file to generate the markdown and code cells of the documentation.</p></article><navclass="docs-footer"><aclass="docs-footer-prevpage"href="../outputformats/">« <strong>4.</strong> Output formats</a><aclass="docs-footer-nextpage"href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl »</a><divclass="flexbox-break"></div><pclass="footer-message">Powered by <ahref="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <ahref="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><divclass="modal"id="documenter-settings"><divclass="modal-background"></div><divclass="modal-card"><headerclass="modal-card-head"><pclass="modal-card-title">Settings</p><buttonclass="delete"></button></header><sectionclass="modal-card-body"><p><labelclass="label">Theme</label><divclass="select"><selectid="documenter-themepicker"><optionvalue="auto">Automatic (OS)</option><optionvalue="documenter-light">documenter-light</option><optionvalue="documenter-dark">documenter-dark</option><optionvalue="catppuccin-latte">catppuccin-latte</option><optionvalue="catppuccin-frappe">catppuccin-frappe</option><optionvalue="catppuccin-macchiato">catppuccin-macchiato</option><optionvalue="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <ahref="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.16.0 on <spanclass="colophon-date"title="Wednesday 19 November 2025 18:04">Wednesday 19 November 2025</span>. Using Julia version 1.12.1.</p></section><footerclass="modal-card-foot"></footer></div></div></div></body></html>
> An important warning.</code></pre></li><li><p>Whereas Documenter requires HTML blocks to be escaped</p><pre><codeclass="nohighlight hljs">```@raw html
<tag>...</tag>
```</code></pre><p>the output to a notebook markdown cell will be raw HTML</p><pre><codeclass="nohighlight hljs"><tag>...</tag></code></pre></li></ul><h3id="[Literate.script](@ref):"><aclass="docs-heading-anchor"href="#[Literate.script](@ref):"><ahref="../outputformats/#Literate.script"><code>Literate.script</code></a>:</a><aid="[Literate.script](@ref):-1"></a><aclass="docs-heading-anchor-permalink"href="#[Literate.script](@ref):"title="Permalink"></a></h3><ul><li>Documenter style <code>@ref</code>s, <code>@extref</code>s and <code>@id</code> will be removed. This means that you can use <code>@ref</code>, <code>@extref</code> and <code>@id</code> in the source file without them leaking to the script.</li></ul></article><navclass="docs-footer"><aclass="docs-footer-prevpage"href="../customprocessing/">« <strong>5.</strong> Custom pre- and post-processing</a><aclass="docs-footer-nextpage"href="../tips/"><strong>7.</strong> Tips and tricks »</a><divclass="flexbox-break"></div><pclass="footer-message">Powered by <ahref="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <ahref="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><divclass="modal"id="documenter-settings"><divclass="modal-background"></div><divclass="modal-card"><headerclass="modal-card-head"><pclass="modal-card-title">Settings</p><buttonclass="delete"></button></header><sectionclass="modal-card-body"><p><labelclass="label">Theme</label><divclass="select"><selectid="documenter-themepicker"><optionvalue="auto">Automatic (OS)</option><optionvalue="documenter-light">documenter-light</option><optionvalue="documenter-dark">documenter-dark</option><optionvalue="catppuccin-latte">catppuccin-latte</option><optionvalue="catppuccin-frappe">catppuccin-frappe</option><optionvalue="catppuccin-macchiato">catppuccin-macchiato</option><optionvalue="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <ahref="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <spanclass="colophon-date"title="Tuesday 2 September 2025 08:16">Tuesday 2 September 2025</span>. Using Julia version 1.11.6.</p></section><footerclass="modal-card-foot"></footer></div></div></div></body></html>
```</code></pre><p>the output to a notebook markdown cell will be raw HTML</p><pre><codeclass="nohighlight hljs"><tag>...</tag></code></pre></li></ul><h3id="[Literate.script](@ref):"><aclass="docs-heading-anchor"href="#[Literate.script](@ref):"><ahref="../outputformats/#Literate.script"><code>Literate.script</code></a>:</a><aid="[Literate.script](@ref):-1"></a><aclass="docs-heading-anchor-permalink"href="#[Literate.script](@ref):"title="Permalink"></a></h3><ul><li>Documenter style <code>@ref</code>s, <code>@extref</code>s and <code>@id</code> will be removed. This means that you can use <code>@ref</code>, <code>@extref</code> and <code>@id</code> in the source file without them leaking to the script.</li></ul></article><navclass="docs-footer"><aclass="docs-footer-prevpage"href="../customprocessing/">« <strong>5.</strong> Custom pre- and post-processing</a><aclass="docs-footer-nextpage"href="../tips/"><strong>7.</strong> Tips and tricks »</a><divclass="flexbox-break"></div><pclass="footer-message">Powered by <ahref="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <ahref="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><divclass="modal"id="documenter-settings"><divclass="modal-background"></div><divclass="modal-card"><headerclass="modal-card-head"><pclass="modal-card-title">Settings</p><buttonclass="delete"></button></header><sectionclass="modal-card-body"><p><labelclass="label">Theme</label><divclass="select"><selectid="documenter-themepicker"><optionvalue="auto">Automatic (OS)</option><optionvalue="documenter-light">documenter-light</option><optionvalue="documenter-dark">documenter-dark</option><optionvalue="catppuccin-latte">catppuccin-latte</option><optionvalue="catppuccin-frappe">catppuccin-frappe</option><optionvalue="catppuccin-macchiato">catppuccin-macchiato</option><optionvalue="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <ahref="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.16.0 on <spanclass="colophon-date"title="Wednesday 19 November 2025 18:04">Wednesday 19 November 2025</span>. Using Julia version 1.12.1.</p></section><footerclass="modal-card-foot"></footer></div></div></div></body></html>
@ -24,9 +24,9 @@ This is also markdown.
@@ -24,9 +24,9 @@ This is also markdown.
# Title
blah blah blah
"""</code></pre><p>is rewritten to</p><pre><codeclass="nohighlight hljs"># # Title
# blah blah blah</code></pre><p>This is not enabled by default – it requires passing <code>mdstrings=true</code>. <code>Literate.markdown</code>/<code>Literate.notebook</code>/<code>Literate.script</code>.</p><h2id="Filtering-lines"><aclass="docs-heading-anchor"href="#Filtering-lines"><strong>2.2.</strong> Filtering lines</a><aid="Filtering-lines-1"></a><aclass="docs-heading-anchor-permalink"href="#Filtering-lines"title="Permalink"></a></h2><p>It is often useful to filter out lines in the source depending on the output format. For this purpose there are a number of "tokens" that can be used to mark the purpose of certain lines:</p><ul><li><code>#md</code>: line exclusive to markdown output,</li><li><code>#nb</code>: line exclusive to notebook output,</li><li><code>#jl</code>: line exclusive to script output,</li><li><code>#src</code>: line exclusive to the source code and thus filtered out unconditionally.</li></ul><p>Lines <em>starting</em> or <em>ending</em> with one of these tokens are filtered out in the <ahref="../pipeline/#Pre-processing">preprocessing step</a>. In addition, for markdown output, lines ending with <code>#hide</code> are filtered out similar to Documenter.jl.</p><divclass="admonition is-info"><headerclass="admonition-header">Difference between `#src` and `#hide`</header><divclass="admonition-body"><p><code>#src</code> and <code>#hide</code> are quite similar. The only difference is that <code>#src</code> lines are filtered out <em>before</em> execution (if <code>execute=true</code>) and <code>#hide</code> lines are filtered out <em>after</em> execution.</p></div></div><divclass="admonition is-success"><headerclass="admonition-header">Tip</header><divclass="admonition-body"><p>The tokens can also be negated, for example a line starting with <code>#!nb</code> would be included in markdown and script output, but filtered out for notebook output.</p></div></div><p>Suppose, for example, that we want to include a docstring within a <code>@docs</code> block using Documenter. Obviously we don't want to include this in the notebook, since <code>@docs</code> is Documenter syntax that the notebook will not understand. This is a case where we can prepend <code>#md</code> to those lines:</p><pre><codeclass="language-julia hljs">#md # ```@docs
# blah blah blah</code></pre><p>This is not enabled by default – it requires passing <code>mdstrings=true</code>. <code>Literate.markdown</code>/<code>Literate.notebook</code>/<code>Literate.script</code>.</p><h2id="Filtering-lines"><aclass="docs-heading-anchor"href="#Filtering-lines"><strong>2.2.</strong> Filtering lines</a><aid="Filtering-lines-1"></a><aclass="docs-heading-anchor-permalink"href="#Filtering-lines"title="Permalink"></a></h2><p>It is often useful to filter out lines in the source depending on the output format. For this purpose there are a number of "tokens" that can be used to mark the purpose of certain lines:</p><ul><li><code>#md</code>: line exclusive to markdown output,</li><li><code>#nb</code>: line exclusive to notebook output,</li><li><code>#jl</code>: line exclusive to script output,</li><li><code>#src</code>: line exclusive to the source code and thus filtered out unconditionally.</li></ul><p>Lines <em>starting</em> or <em>ending</em> with one of these tokens are filtered out in the <ahref="../pipeline/#Pre-processing">preprocessing step</a>. In addition, for markdown output, lines ending with <code>#hide</code> are filtered out similar to Documenter.jl.</p><divclass="admonition is-info"id="Difference-between-#src-and-#hide-d43ff38d8c47a3a3"><headerclass="admonition-header">Difference between `#src` and `#hide`<aclass="admonition-anchor"href="#Difference-between-#src-and-#hide-d43ff38d8c47a3a3"title="Permalink"></a></header><divclass="admonition-body"><p><code>#src</code> and <code>#hide</code> are quite similar. The only difference is that <code>#src</code> lines are filtered out <em>before</em> execution (if <code>execute=true</code>) and <code>#hide</code> lines are filtered out <em>after</em> execution.</p></div></div><divclass="admonition is-success"id="Tip-5011ca2a8bf01b70"><headerclass="admonition-header">Tip<aclass="admonition-anchor"href="#Tip-5011ca2a8bf01b70"title="Permalink"></a></header><divclass="admonition-body"><p>The tokens can also be negated, for example a line starting with <code>#!nb</code> would be included in markdown and script output, but filtered out for notebook output.</p></div></div><p>Suppose, for example, that we want to include a docstring within a <code>@docs</code> block using Documenter. Obviously we don't want to include this in the notebook, since <code>@docs</code> is Documenter syntax that the notebook will not understand. This is a case where we can prepend <code>#md</code> to those lines:</p><pre><codeclass="language-julia hljs">#md # ```@docs
#md # Literate.markdown
#md # Literate.notebook
#md # Literate.script
#md # ```</code></pre><p>The lines in the example above would be filtered out in the preprocessing step, unless we are generating a markdown file. When generating a markdown file we would simply remove the leading <code>#md</code> from the lines. Beware that the space after the tag is also removed.</p><p>The <code>#src</code> token can also be placed at the <em>end</em> of a line. This is to make it possible to have code lines exclusive to the source code, and not just comment lines. For example, if the source file is included in the test suite we might want to add a <code>@test</code> at the end without this showing up in the outputs:</p><pre><codeclass="language-julia hljs">using Test #src
@test result == expected_result #src</code></pre><h2id="Default-replacements"><aclass="docs-heading-anchor"href="#Default-replacements"><strong>2.3.</strong> Default replacements</a><aid="Default-replacements-1"></a><aclass="docs-heading-anchor-permalink"href="#Default-replacements"title="Permalink"></a></h2><p>The following convenience "macros"/source placeholders are always expanded:</p><ul><li><p><code>@__NAME__</code>:</p><p>expands to the <code>name</code> keyword argument to <ahref="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <ahref="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <ahref="../outputformats/#Literate.script"><code>Literate.script</code></a> (defaults to the filename of the input file).</p></li><li><p><code>@__REPO_ROOT_URL__</code>:</p><p>Can be used to link to files in the repository. For example <code>@__REPO_ROOT_URL__/src/Literate.jl</code> would link to the <ahref="https://github.com/fredrikekre/Literate.jl/blob/master/src/Literate.jl">source of the Literate module</a>. This variable is automatically determined on Travis CI, GitHub Actions and GitLab CI, but can be configured, see <ahref="../outputformats/#Configuration">Configuration</a>.</p></li><li><p><code>@__NBVIEWER_ROOT_URL__</code>:</p><p>Can be used if you want a link that opens the generated notebook in <ahref="http://nbviewer.jupyter.org/">http://nbviewer.jupyter.org/</a>. This variable is automatically determined on Travis CI, GitHub Actions and GitLab CI, but can be configured, see <ahref="../outputformats/#Configuration">Configuration</a>.</p></li><li><p><code>@__BINDER_ROOT_URL__</code>:</p><p>Can be used if you want a link that opens the generated notebook in <ahref="https://mybinder.org/">https://mybinder.org/</a>. For example, to add a binder-badge in e.g. the HTML output you can use:</p><pre><codeclass="nohighlight hljs">[](@__BINDER_ROOT_URL__/path/to/notebook.inpynb)</code></pre><p>This variable is automatically determined on Travis CI, GitHub Actions and GitLab CI, but can be configured, see <ahref="../outputformats/#Configuration">Configuration</a>.</p></li></ul></article><navclass="docs-footer"><aclass="docs-footer-prevpage"href="../">« <strong>1.</strong> Introduction</a><aclass="docs-footer-nextpage"href="../pipeline/"><strong>3.</strong> Processing pipeline »</a><divclass="flexbox-break"></div><pclass="footer-message">Powered by <ahref="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <ahref="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><divclass="modal"id="documenter-settings"><divclass="modal-background"></div><divclass="modal-card"><headerclass="modal-card-head"><pclass="modal-card-title">Settings</p><buttonclass="delete"></button></header><sectionclass="modal-card-body"><p><labelclass="label">Theme</label><divclass="select"><selectid="documenter-themepicker"><optionvalue="auto">Automatic (OS)</option><optionvalue="documenter-light">documenter-light</option><optionvalue="documenter-dark">documenter-dark</option><optionvalue="catppuccin-latte">catppuccin-latte</option><optionvalue="catppuccin-frappe">catppuccin-frappe</option><optionvalue="catppuccin-macchiato">catppuccin-macchiato</option><optionvalue="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <ahref="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <spanclass="colophon-date"title="Tuesday 2 September 2025 08:16">Tuesday 2 September 2025</span>. Using Julia version 1.11.6.</p></section><footerclass="modal-card-foot"></footer></div></div></div></body></html>
@test result == expected_result #src</code></pre><h2id="Default-replacements"><aclass="docs-heading-anchor"href="#Default-replacements"><strong>2.3.</strong> Default replacements</a><aid="Default-replacements-1"></a><aclass="docs-heading-anchor-permalink"href="#Default-replacements"title="Permalink"></a></h2><p>The following convenience "macros"/source placeholders are always expanded:</p><ul><li><p><code>@__NAME__</code>:</p><p>expands to the <code>name</code> keyword argument to <ahref="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <ahref="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <ahref="../outputformats/#Literate.script"><code>Literate.script</code></a> (defaults to the filename of the input file).</p></li><li><p><code>@__REPO_ROOT_URL__</code>:</p><p>Can be used to link to files in the repository. For example <code>@__REPO_ROOT_URL__/src/Literate.jl</code> would link to the <ahref="https://github.com/fredrikekre/Literate.jl/blob/master/src/Literate.jl">source of the Literate module</a>. This variable is automatically determined on Travis CI, GitHub Actions and GitLab CI, but can be configured, see <ahref="../outputformats/#Configuration">Configuration</a>.</p></li><li><p><code>@__NBVIEWER_ROOT_URL__</code>:</p><p>Can be used if you want a link that opens the generated notebook in <ahref="http://nbviewer.jupyter.org/">http://nbviewer.jupyter.org/</a>. This variable is automatically determined on Travis CI, GitHub Actions and GitLab CI, but can be configured, see <ahref="../outputformats/#Configuration">Configuration</a>.</p></li><li><p><code>@__BINDER_ROOT_URL__</code>:</p><p>Can be used if you want a link that opens the generated notebook in <ahref="https://mybinder.org/">https://mybinder.org/</a>. For example, to add a binder-badge in e.g. the HTML output you can use:</p><pre><codeclass="nohighlight hljs">[](@__BINDER_ROOT_URL__/path/to/notebook.inpynb)</code></pre><p>This variable is automatically determined on Travis CI, GitHub Actions and GitLab CI, but can be configured, see <ahref="../outputformats/#Configuration">Configuration</a>.</p></li></ul></article><navclass="docs-footer"><aclass="docs-footer-prevpage"href="../">« <strong>1.</strong> Introduction</a><aclass="docs-footer-nextpage"href="../pipeline/"><strong>3.</strong> Processing pipeline »</a><divclass="flexbox-break"></div><pclass="footer-message">Powered by <ahref="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <ahref="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><divclass="modal"id="documenter-settings"><divclass="modal-background"></div><divclass="modal-card"><headerclass="modal-card-head"><pclass="modal-card-title">Settings</p><buttonclass="delete"></button></header><sectionclass="modal-card-body"><p><labelclass="label">Theme</label><divclass="select"><selectid="documenter-themepicker"><optionvalue="auto">Automatic (OS)</option><optionvalue="documenter-light">documenter-light</option><optionvalue="documenter-dark">documenter-dark</option><optionvalue="catppuccin-latte">catppuccin-latte</option><optionvalue="catppuccin-frappe">catppuccin-frappe</option><optionvalue="catppuccin-macchiato">catppuccin-macchiato</option><optionvalue="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <ahref="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.16.0 on <spanclass="colophon-date"title="Wednesday 19 November 2025 18:04">Wednesday 19 November 2025</span>. Using Julia version 1.12.1.</p></section><footerclass="modal-card-foot"></footer></div></div></div></body></html>
@ -29,4 +29,4 @@ x = 1 // 3
@@ -29,4 +29,4 @@ x = 1 // 3
y = 2 // 5</code></pre><p>Chunk #3:</p><pre><codeclass="language-markdown hljs">When adding `x` and `y` together we obtain a new rational number:</code></pre><p>Chunk #4:</p><pre><codeclass="language-julia hljs">z = x + y</code></pre><p>It is then up to the <ahref="#Document-generation">Document generation</a> step to decide how these chunks should be treated.</p><h3id="Custom-control-over-chunk-splits"><aclass="docs-heading-anchor"href="#Custom-control-over-chunk-splits">Custom control over chunk splits</a><aid="Custom-control-over-chunk-splits-1"></a><aclass="docs-heading-anchor-permalink"href="#Custom-control-over-chunk-splits"title="Permalink"></a></h3><p>Sometimes it is convenient to be able to manually control how the chunks are split. For example, if you want to split a block of code into two, such that they end up in two different <code>@example</code> blocks or notebook cells. The <code>#-</code> token can be used for this purpose. All lines starting with <code>#-</code> are used as "chunk-splitters":</p><pre><codeclass="language-julia hljs">x = 1 // 3
y = 2 // 5
#-
z = x + y</code></pre><p>The example above would result in two consecutive code-chunks.</p><divclass="admonition is-success"><headerclass="admonition-header">Tip</header><divclass="admonition-body"><p>The rest of the line, after <code>#-</code>, is discarded, so it is possible to use e.g. <code>#-------------</code> as a chunk splitter, which may make the source code more readable.</p></div></div><p>It is also possible to use <code>#+</code> as a chunk splitter. The difference between <code>#+</code> and <code>#-</code> is that <code>#+</code> enables Documenter's "continued"-blocks, see the <ahref="https://juliadocs.github.io/Documenter.jl/stable/">Documenter manual</a>.</p><h2id="Document-generation"><aclass="docs-heading-anchor"href="#Document-generation"><strong>3.3.</strong> Document generation</a><aid="Document-generation-1"></a><aclass="docs-heading-anchor-permalink"href="#Document-generation"title="Permalink"></a></h2><p>After the parsing it is time to generate the output. What is done in this step is very different depending on the output target, and it is described in more detail in the Output format sections: <ahref="../outputformats/#Markdown-output">Markdown output</a>, <ahref="../outputformats/#Notebook-output">Notebook output</a> and <ahref="../outputformats/#Script-output">Script output</a>. Using the default settings, the following is happening:</p><ul><li>Markdown output: markdown chunks are printed as-is, code chunks are put inside a code fence (defaults to <code>@example</code>-blocks),</li><li>Notebook output: markdown chunks are printed in markdown cells, code chunks are put in code cells,</li><li>Script output: markdown chunks are discarded, code chunks are printed as-is.</li></ul><h2id="Post-processing"><aclass="docs-heading-anchor"href="#Post-processing"><strong>3.4.</strong> Post-processing</a><aid="Post-processing-1"></a><aclass="docs-heading-anchor-permalink"href="#Post-processing"title="Permalink"></a></h2><p>When the document is generated the user, again, has the option to hook-into the generation with a custom post-processing function. The reason is that one might want to change things that are only visible in the rendered document. See <ahref="../customprocessing/#Custom-pre-and-post-processing">Custom pre- and post-processing</a>.</p><h2id="Writing-to-file"><aclass="docs-heading-anchor"href="#Writing-to-file"><strong>3.5.</strong> Writing to file</a><aid="Writing-to-file-1"></a><aclass="docs-heading-anchor-permalink"href="#Writing-to-file"title="Permalink"></a></h2><p>The last step of the generation is writing to file. The result is written to <code>$(outputdir)/$(name)(.md|.ipynb|.jl)</code> where <code>outputdir</code> is the output directory supplied by the user (for example <code>docs/generated</code>), and <code>name</code> is a user supplied filename. It is recommended to add the output directory to <code>.gitignore</code> since the idea is that the generated documents will be generated as part of the build process rather than being files in the repo.</p></article><navclass="docs-footer"><aclass="docs-footer-prevpage"href="../fileformat/">« <strong>2.</strong> File format</a><aclass="docs-footer-nextpage"href="../outputformats/"><strong>4.</strong> Output formats »</a><divclass="flexbox-break"></div><pclass="footer-message">Powered by <ahref="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <ahref="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><divclass="modal"id="documenter-settings"><divclass="modal-background"></div><divclass="modal-card"><headerclass="modal-card-head"><pclass="modal-card-title">Settings</p><buttonclass="delete"></button></header><sectionclass="modal-card-body"><p><labelclass="label">Theme</label><divclass="select"><selectid="documenter-themepicker"><optionvalue="auto">Automatic (OS)</option><optionvalue="documenter-light">documenter-light</option><optionvalue="documenter-dark">documenter-dark</option><optionvalue="catppuccin-latte">catppuccin-latte</option><optionvalue="catppuccin-frappe">catppuccin-frappe</option><optionvalue="catppuccin-macchiato">catppuccin-macchiato</option><optionvalue="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <ahref="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <spanclass="colophon-date"title="Tuesday 2 September 2025 08:16">Tuesday 2 September 2025</span>. Using Julia version 1.11.6.</p></section><footerclass="modal-card-foot"></footer></div></div></div></body></html>
z = x + y</code></pre><p>The example above would result in two consecutive code-chunks.</p><divclass="admonition is-success"id="Tip-fe7226d986c6db44"><headerclass="admonition-header">Tip<aclass="admonition-anchor"href="#Tip-fe7226d986c6db44"title="Permalink"></a></header><divclass="admonition-body"><p>The rest of the line, after <code>#-</code>, is discarded, so it is possible to use e.g. <code>#-------------</code> as a chunk splitter, which may make the source code more readable.</p></div></div><p>It is also possible to use <code>#+</code> as a chunk splitter. The difference between <code>#+</code> and <code>#-</code> is that <code>#+</code> enables Documenter's "continued"-blocks, see the <ahref="https://juliadocs.github.io/Documenter.jl/stable/">Documenter manual</a>.</p><h2id="Document-generation"><aclass="docs-heading-anchor"href="#Document-generation"><strong>3.3.</strong> Document generation</a><aid="Document-generation-1"></a><aclass="docs-heading-anchor-permalink"href="#Document-generation"title="Permalink"></a></h2><p>After the parsing it is time to generate the output. What is done in this step is very different depending on the output target, and it is described in more detail in the Output format sections: <ahref="../outputformats/#Markdown-output">Markdown output</a>, <ahref="../outputformats/#Notebook-output">Notebook output</a> and <ahref="../outputformats/#Script-output">Script output</a>. Using the default settings, the following is happening:</p><ul><li>Markdown output: markdown chunks are printed as-is, code chunks are put inside a code fence (defaults to <code>@example</code>-blocks),</li><li>Notebook output: markdown chunks are printed in markdown cells, code chunks are put in code cells,</li><li>Script output: markdown chunks are discarded, code chunks are printed as-is.</li></ul><h2id="Post-processing"><aclass="docs-heading-anchor"href="#Post-processing"><strong>3.4.</strong> Post-processing</a><aid="Post-processing-1"></a><aclass="docs-heading-anchor-permalink"href="#Post-processing"title="Permalink"></a></h2><p>When the document is generated the user, again, has the option to hook-into the generation with a custom post-processing function. The reason is that one might want to change things that are only visible in the rendered document. See <ahref="../customprocessing/#Custom-pre-and-post-processing">Custom pre- and post-processing</a>.</p><h2id="Writing-to-file"><aclass="docs-heading-anchor"href="#Writing-to-file"><strong>3.5.</strong> Writing to file</a><aid="Writing-to-file-1"></a><aclass="docs-heading-anchor-permalink"href="#Writing-to-file"title="Permalink"></a></h2><p>The last step of the generation is writing to file. The result is written to <code>$(outputdir)/$(name)(.md|.ipynb|.jl)</code> where <code>outputdir</code> is the output directory supplied by the user (for example <code>docs/generated</code>), and <code>name</code> is a user supplied filename. It is recommended to add the output directory to <code>.gitignore</code> since the idea is that the generated documents will be generated as part of the build process rather than being files in the repo.</p></article><navclass="docs-footer"><aclass="docs-footer-prevpage"href="../fileformat/">« <strong>2.</strong> File format</a><aclass="docs-footer-nextpage"href="../outputformats/"><strong>4.</strong> Output formats »</a><divclass="flexbox-break"></div><pclass="footer-message">Powered by <ahref="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <ahref="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><divclass="modal"id="documenter-settings"><divclass="modal-background"></div><divclass="modal-card"><headerclass="modal-card-head"><pclass="modal-card-title">Settings</p><buttonclass="delete"></button></header><sectionclass="modal-card-body"><p><labelclass="label">Theme</label><divclass="select"><selectid="documenter-themepicker"><optionvalue="auto">Automatic (OS)</option><optionvalue="documenter-light">documenter-light</option><optionvalue="documenter-dark">documenter-dark</option><optionvalue="catppuccin-latte">catppuccin-latte</option><optionvalue="catppuccin-frappe">catppuccin-frappe</option><optionvalue="catppuccin-macchiato">catppuccin-macchiato</option><optionvalue="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <ahref="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.16.0 on <spanclass="colophon-date"title="Wednesday 19 November 2025 18:04">Wednesday 19 November 2025</span>. Using Julia version 1.12.1.</p></section><footerclass="modal-card-foot"></footer></div></div></div></body></html>