@ -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">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></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="documenter-light">documenter-light</option><optionvalue="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <ahref="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <spanclass="colophon-date"title="Thursday 9 April 2020 22:57">Thursday 9 April 2020</span>. Using Julia version 1.4.0.</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></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="documenter-light">documenter-light</option><optionvalue="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <ahref="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <spanclass="colophon-date"title="Tuesday 14 April 2020 09:51">Tuesday 14 April 2020</span>. Using Julia version 1.4.0.</p></section><footerclass="modal-card-foot"></footer></div></div></div></body></html>
```</code></pre>is replaced with notebook compatible<pre><codeclass="language-none">$$
\int f dx
$$</code></pre></li></ul><h3id="[Literate.script](@ref):-1"><aclass="docs-heading-anchor"href="#[Literate.script](@ref):-1"><ahref="../outputformats/#Literate.script"><code>Literate.script</code></a>:</a><aclass="docs-heading-anchor-permalink"href="#[Literate.script](@ref):-1"title="Permalink"></a></h3><ul><li>Documenter style <code>@ref</code>s and <code>@id</code> will be removed. This means that you can use <code>@ref</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></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="documenter-light">documenter-light</option><optionvalue="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <ahref="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <spanclass="colophon-date"title="Thursday 9 April 2020 22:57">Thursday 9 April 2020</span>. Using Julia version 1.4.0.</p></section><footerclass="modal-card-foot"></footer></div></div></div></body></html>
$$</code></pre></li></ul><h3id="[Literate.script](@ref):-1"><aclass="docs-heading-anchor"href="#[Literate.script](@ref):-1"><ahref="../outputformats/#Literate.script"><code>Literate.script</code></a>:</a><aclass="docs-heading-anchor-permalink"href="#[Literate.script](@ref):-1"title="Permalink"></a></h3><ul><li>Documenter style <code>@ref</code>s and <code>@id</code> will be removed. This means that you can use <code>@ref</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></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="documenter-light">documenter-light</option><optionvalue="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <ahref="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <spanclass="colophon-date"title="Tuesday 14 April 2020 09:51">Tuesday 14 April 2020</span>. Using Julia version 1.4.0.</p></section><footerclass="modal-card-foot"></footer></div></div></div></body></html>
<h3id="Custom-processing-1"><aclass="docs-heading-anchor"href="#Custom-processing-1">Custom processing</a><aclass="docs-heading-anchor-permalink"href="#Custom-processing-1"title="Permalink"></a></h3><p>It is possible to give Literate custom pre- and post-processing functions. For example, here we insert a placeholder value <code>y = 321</code> in the source, and use a preprocessing function that replaces it with <code>y = 321</code> in the rendered output.</p><pre><codeclass="language-julia">x = 123</code></pre><pre><codeclass="language-none">123</code></pre><p>In this case the preprocessing function is defined by</p><pre><codeclass="language-julia">function pre(s::String)
s = replace(s, "x = 123" =>"y = 321")
return s
end</code></pre><pre><codeclass="language-none">pre (generic function with 1 method)</code></pre><h3id="documenter-interaction-1"><aclass="docs-heading-anchor"href="#documenter-interaction-1">Documenter.jl interaction</a><aclass="docs-heading-anchor-permalink"href="#documenter-interaction-1"title="Permalink"></a></h3><p>In the source file it is possible to use Documenter.jl style references, such as <code>@ref</code> and <code>@id</code>. These will be filtered out in the notebook output. For example, <ahref="#documenter-interaction-1">here is a link</a>, but it is only visible as a link if you are reading the markdown output. We can also use equations:</p><div>\[\int_\Omega \nabla v \cdot \nabla u\ \mathrm{d}\Omega = \int_\Omega v f\ \mathrm{d}\Omega\]</div><p>using Documenters math syntax. Documenters syntax is automatically changed to <code>\begin{equation} ... \end{equation}</code> in the notebook output to display correctly.</p><hr/><p><em>This page was generated using <ahref="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p></article><navclass="docs-footer"><aclass="docs-footer-prevpage"href="../../tips/">« <strong>7.</strong> Tips and Tricks</a></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="documenter-light">documenter-light</option><optionvalue="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <ahref="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <spanclass="colophon-date"title="Thursday 9 April 2020 22:57">Thursday 9 April 2020</span>. Using Julia version 1.4.0.</p></section><footerclass="modal-card-foot"></footer></div></div></div></body></html>
end</code></pre><pre><codeclass="language-none">pre (generic function with 1 method)</code></pre><h3id="documenter-interaction-1"><aclass="docs-heading-anchor"href="#documenter-interaction-1">Documenter.jl interaction</a><aclass="docs-heading-anchor-permalink"href="#documenter-interaction-1"title="Permalink"></a></h3><p>In the source file it is possible to use Documenter.jl style references, such as <code>@ref</code> and <code>@id</code>. These will be filtered out in the notebook output. For example, <ahref="#documenter-interaction-1">here is a link</a>, but it is only visible as a link if you are reading the markdown output. We can also use equations:</p><div>\[\int_\Omega \nabla v \cdot \nabla u\ \mathrm{d}\Omega = \int_\Omega v f\ \mathrm{d}\Omega\]</div><p>using Documenters math syntax. Documenters syntax is automatically changed to <code>\begin{equation} ... \end{equation}</code> in the notebook output to display correctly.</p><hr/><p><em>This page was generated using <ahref="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p></article><navclass="docs-footer"><aclass="docs-footer-prevpage"href="../../tips/">« <strong>7.</strong> Tips and Tricks</a></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="documenter-light">documenter-light</option><optionvalue="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <ahref="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <spanclass="colophon-date"title="Tuesday 14 April 2020 09:51">Tuesday 14 April 2020</span>. Using Julia version 1.4.0.</p></section><footerclass="modal-card-foot"></footer></div></div></div></body></html>
<htmllang="en"><head><metacharset="UTF-8"/><metaname="viewport"content="width=device-width, initial-scale=1.0"/><title>Search · Literate.jl</title><linkhref="https://fonts.googleapis.com/css?family=Lato|Roboto+Mono"rel="stylesheet"type="text/css"/><linkhref="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/fontawesome.min.css"rel="stylesheet"type="text/css"/><linkhref="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/solid.min.css"rel="stylesheet"type="text/css"/><linkhref="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/brands.min.css"rel="stylesheet"type="text/css"/><linkhref="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/katex.min.css"rel="stylesheet"type="text/css"/><script>documenterBaseURL=".."</script><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js"data-main="../assets/documenter.js"></script><scriptsrc="../siteinfo.js"></script><scriptsrc="../../versions.js"></script><linkhref="../assets/custom.css"rel="stylesheet"type="text/css"/><linkhref="../assets/favicon.ico"rel="icon"type="image/x-icon"/><linkclass="docs-theme-link"rel="stylesheet"type="text/css"href="../assets/themes/documenter-dark.css"data-theme-name="documenter-dark"/><linkclass="docs-theme-link"rel="stylesheet"type="text/css"href="../assets/themes/documenter-light.css"data-theme-name="documenter-light"data-theme-primary/><scriptsrc="../assets/themeswap.js"></script></head><body><divid="documenter"><navclass="docs-sidebar"><aclass="docs-logo"href="../"><imgsrc="../assets/logo.png"alt="Literate.jl logo"/></a><divclass="docs-package-name"><spanclass="docs-autofit">Literate.jl</span></div><formclass="docs-search"action><inputclass="docs-search-query"id="documenter-search-query"name="q"type="text"placeholder="Search docs"/></form><ulclass="docs-menu"><li><aclass="tocitem"href="../"><strong>1.</strong> Introduction</a></li><li><aclass="tocitem"href="../fileformat/"><strong>2.</strong> File Format</a></li><li><aclass="tocitem"href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><aclass="tocitem"href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li><aclass="tocitem"href="../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><aclass="tocitem"href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><aclass="tocitem"href="../tips/"><strong>7.</strong> Tips and Tricks</a></li><li><aclass="tocitem"href="../generated/example/"><strong>8.</strong> Example</a></li></ul><divclass="docs-version-selector field has-addons"><divclass="control"><spanclass="docs-label button is-static is-size-7">Version</span></div><divclass="docs-selector control is-expanded"><divclass="select is-fullwidth is-size-7"><selectid="documenter-version-selector"></select></div></div></div></nav><divclass="docs-main"><headerclass="docs-navbar"><navclass="breadcrumb"><ulclass="is-hidden-mobile"><liclass="is-active"><ahref>Search</a></li></ul><ulclass="is-hidden-tablet"><liclass="is-active"><ahref>Search</a></li></ul></nav><divclass="docs-right"><aclass="docs-settings-button fas fa-cog"id="documenter-settings-button"href="#"title="Settings"></a><aclass="docs-sidebar-button fa fa-bars is-hidden-desktop"id="documenter-sidebar-button"href="#"></a></div></header><article><pid="documenter-search-info">Loading search...</p><ulid="documenter-search-results"></ul></article></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="documenter-light">documenter-light</option><optionvalue="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <ahref="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <spanclass="colophon-date"title="Thursday 9 April 2020 22:57">Thursday 9 April 2020</span>. Using Julia version 1.4.0.</p></section><footerclass="modal-card-foot"></footer></div></div></div></body><scriptsrc="../search_index.js"></script><scriptsrc="../assets/search.js"></script></html>
<htmllang="en"><head><metacharset="UTF-8"/><metaname="viewport"content="width=device-width, initial-scale=1.0"/><title>Search · Literate.jl</title><linkhref="https://fonts.googleapis.com/css?family=Lato|Roboto+Mono"rel="stylesheet"type="text/css"/><linkhref="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/fontawesome.min.css"rel="stylesheet"type="text/css"/><linkhref="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/solid.min.css"rel="stylesheet"type="text/css"/><linkhref="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/brands.min.css"rel="stylesheet"type="text/css"/><linkhref="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/katex.min.css"rel="stylesheet"type="text/css"/><script>documenterBaseURL=".."</script><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js"data-main="../assets/documenter.js"></script><scriptsrc="../siteinfo.js"></script><scriptsrc="../../versions.js"></script><linkhref="../assets/custom.css"rel="stylesheet"type="text/css"/><linkhref="../assets/favicon.ico"rel="icon"type="image/x-icon"/><linkclass="docs-theme-link"rel="stylesheet"type="text/css"href="../assets/themes/documenter-dark.css"data-theme-name="documenter-dark"/><linkclass="docs-theme-link"rel="stylesheet"type="text/css"href="../assets/themes/documenter-light.css"data-theme-name="documenter-light"data-theme-primary/><scriptsrc="../assets/themeswap.js"></script></head><body><divid="documenter"><navclass="docs-sidebar"><aclass="docs-logo"href="../"><imgsrc="../assets/logo.png"alt="Literate.jl logo"/></a><divclass="docs-package-name"><spanclass="docs-autofit">Literate.jl</span></div><formclass="docs-search"action><inputclass="docs-search-query"id="documenter-search-query"name="q"type="text"placeholder="Search docs"/></form><ulclass="docs-menu"><li><aclass="tocitem"href="../"><strong>1.</strong> Introduction</a></li><li><aclass="tocitem"href="../fileformat/"><strong>2.</strong> File Format</a></li><li><aclass="tocitem"href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><aclass="tocitem"href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li><aclass="tocitem"href="../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><aclass="tocitem"href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><aclass="tocitem"href="../tips/"><strong>7.</strong> Tips and Tricks</a></li><li><aclass="tocitem"href="../generated/example/"><strong>8.</strong> Example</a></li></ul><divclass="docs-version-selector field has-addons"><divclass="control"><spanclass="docs-label button is-static is-size-7">Version</span></div><divclass="docs-selector control is-expanded"><divclass="select is-fullwidth is-size-7"><selectid="documenter-version-selector"></select></div></div></div></nav><divclass="docs-main"><headerclass="docs-navbar"><navclass="breadcrumb"><ulclass="is-hidden-mobile"><liclass="is-active"><ahref>Search</a></li></ul><ulclass="is-hidden-tablet"><liclass="is-active"><ahref>Search</a></li></ul></nav><divclass="docs-right"><aclass="docs-settings-button fas fa-cog"id="documenter-settings-button"href="#"title="Settings"></a><aclass="docs-sidebar-button fa fa-bars is-hidden-desktop"id="documenter-sidebar-button"href="#"></a></div></header><article><pid="documenter-search-info">Loading search...</p><ulid="documenter-search-results"></ul></article></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="documenter-light">documenter-light</option><optionvalue="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <ahref="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <spanclass="colophon-date"title="Tuesday 14 April 2020 09:51">Tuesday 14 April 2020</span>. Using Julia version 1.4.0.</p></section><footerclass="modal-card-foot"></footer></div></div></div></body><scriptsrc="../search_index.js"></script><scriptsrc="../assets/search.js"></script></html>