Browse Source

Add outdated warning.

gh-pages
Fredrik Ekre 5 years ago
parent
commit
7873977d4c
  1. 51
      v0.1.0/customprocessing.html
  2. 53
      v0.1.0/documenter.html
  3. 65
      v0.1.0/fileformat.html
  4. 51
      v0.1.0/generated/example.html
  5. 45
      v0.1.0/index.html
  6. 61
      v0.1.0/outputformats.html
  7. 69
      v0.1.0/pipeline.html
  8. 45
      v0.1.0/search.html
  9. 49
      v0.2.0/customprocessing.html
  10. 53
      v0.2.0/documenter.html
  11. 49
      v0.2.0/fileformat.html
  12. 51
      v0.2.0/generated/example.html
  13. 45
      v0.2.0/index.html
  14. 53
      v0.2.0/outputformats.html
  15. 51
      v0.2.0/pipeline.html
  16. 45
      v0.2.0/search.html
  17. 49
      v0.2.1/customprocessing.html
  18. 53
      v0.2.1/documenter.html
  19. 49
      v0.2.1/fileformat.html
  20. 51
      v0.2.1/generated/example.html
  21. 45
      v0.2.1/index.html
  22. 53
      v0.2.1/outputformats.html
  23. 51
      v0.2.1/pipeline.html
  24. 45
      v0.2.1/search.html
  25. 49
      v0.2.2/customprocessing.html
  26. 53
      v0.2.2/documenter.html
  27. 49
      v0.2.2/fileformat.html
  28. 188
      v0.2.2/generated/example.html
  29. 45
      v0.2.2/index.html
  30. 53
      v0.2.2/outputformats.html
  31. 51
      v0.2.2/pipeline.html
  32. 45
      v0.2.2/search.html
  33. 49
      v0.3.0/customprocessing.html
  34. 53
      v0.3.0/documenter.html
  35. 49
      v0.3.0/fileformat.html
  36. 188
      v0.3.0/generated/example.html
  37. 45
      v0.3.0/index.html
  38. 53
      v0.3.0/outputformats.html
  39. 51
      v0.3.0/pipeline.html
  40. 45
      v0.3.0/search.html
  41. 49
      v1.0.0/customprocessing.html
  42. 53
      v1.0.0/documenter.html
  43. 49
      v1.0.0/fileformat.html
  44. 188
      v1.0.0/generated/example.html
  45. 45
      v1.0.0/index.html
  46. 53
      v1.0.0/outputformats.html
  47. 51
      v1.0.0/pipeline.html
  48. 45
      v1.0.0/search.html
  49. 49
      v1.0.1/customprocessing.html
  50. 53
      v1.0.1/documenter.html
  51. 49
      v1.0.1/fileformat.html
  52. 188
      v1.0.1/generated/example.html
  53. 45
      v1.0.1/index.html
  54. 53
      v1.0.1/outputformats.html
  55. 51
      v1.0.1/pipeline.html
  56. 45
      v1.0.1/search.html
  57. 49
      v1.0.2/customprocessing.html
  58. 53
      v1.0.2/documenter.html
  59. 49
      v1.0.2/fileformat.html
  60. 188
      v1.0.2/generated/example.html
  61. 45
      v1.0.2/index.html
  62. 53
      v1.0.2/outputformats.html
  63. 51
      v1.0.2/pipeline.html
  64. 45
      v1.0.2/search.html
  65. 63
      v1.0.3/customprocessing/index.html
  66. 53
      v1.0.3/documenter/index.html
  67. 49
      v1.0.3/fileformat/index.html
  68. 193
      v1.0.3/generated/example/index.html
  69. 45
      v1.0.3/index.html
  70. 53
      v1.0.3/outputformats/index.html
  71. 51
      v1.0.3/pipeline/index.html
  72. 45
      v1.0.3/search/index.html
  73. 63
      v1.0.4/customprocessing/index.html
  74. 53
      v1.0.4/documenter/index.html
  75. 49
      v1.0.4/fileformat/index.html
  76. 193
      v1.0.4/generated/example/index.html
  77. 45
      v1.0.4/index.html
  78. 53
      v1.0.4/outputformats/index.html
  79. 51
      v1.0.4/pipeline/index.html
  80. 45
      v1.0.4/search/index.html
  81. 63
      v1.0.5/customprocessing/index.html
  82. 53
      v1.0.5/documenter/index.html
  83. 49
      v1.0.5/fileformat/index.html
  84. 193
      v1.0.5/generated/example/index.html
  85. 45
      v1.0.5/index.html
  86. 53
      v1.0.5/outputformats/index.html
  87. 51
      v1.0.5/pipeline/index.html
  88. 45
      v1.0.5/search/index.html
  89. 63
      v1.1.0/customprocessing/index.html
  90. 53
      v1.1.0/documenter/index.html
  91. 49
      v1.1.0/fileformat/index.html
  92. 188
      v1.1.0/generated/example/index.html
  93. 45
      v1.1.0/index.html
  94. 53
      v1.1.0/outputformats/index.html
  95. 51
      v1.1.0/pipeline/index.html
  96. 45
      v1.1.0/search/index.html
  97. 63
      v2.0.0/customprocessing/index.html
  98. 53
      v2.0.0/documenter/index.html
  99. 49
      v2.0.0/fileformat/index.html
  100. 188
      v2.0.0/generated/example/index.html
  101. Some files were not shown because too many files have changed in this diff Show More

51
v0.1.0/customprocessing.html

@ -1,8 +1,49 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>5. Custom pre- and post-processing · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>5. Custom pre- and post-processing · Literate.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>Literate.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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li class="current"><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a><ul class="internal"></ul></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="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/customprocessing.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>5. Custom pre- and post-processing</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Custom-pre-and-post-processing-1" href="#Custom-pre-and-post-processing-1"><strong>5.</strong> Custom pre- and post-processing</a></h1><p>Since all packages are different, and may have different demands on how to create a nice example for the documentation it is important that the package maintainer does not feel limited by the by default provided syntax that this package offers. While you can generally come a long way by utilizing <a href="fileformat.html#Filtering-Lines-1">line filtering</a> there might be situations where you need to manually hook into the generation and change things. In Literate this is done by letting the user supply custom pre- and post-processing functions that may do transformation of the content.</p><p>All of the generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) accepts <code>preprocess</code> and <code>postprocess</code> keyword arguments. The default &quot;transformation&quot; is the <code>identity</code> function. The input to the transformation functions is a <code>String</code>, and the output should be the transformed <code>String</code>.</p><p><code>preprocess</code> is sent the raw input that is read from the source file (<a href="pipeline.html#Pre-processing-1">modulo the default line ending transformation</a>). <code>postprocess</code> is given different things depending on the output: For markdown and script output <code>postprocess</code> is given the content <code>String</code> just before writing it to the output file, but for notebook output <code>postprocess</code> is given the dictionary representing the notebook, since, in general, this is more useful.</p><p>As an example, lets say we want to splice the date of generation into the output. We could of course update our source file before generating the docs, but we could instead use a <code>preprocess</code> function that splices the date into the source for us. Consider the following source file:</p><pre><code class="language-julia">#&#39; # Example const head = document.getElementsByTagName('head')[0];
#&#39; This example was generated DATEOFTODAY
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li class="current"><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a><ul class="internal"></ul></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="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/customprocessing.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>5. Custom pre- and post-processing</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#Custom-pre-and-post-processing-1" id="Custom-pre-and-post-processing-1"><strong>5.</strong> Custom pre- and post-processing</a></h1><p>Since all packages are different, and may have different demands on how to create a nice example for the documentation it is important that the package maintainer does not feel limited by the by default provided syntax that this package offers. While you can generally come a long way by utilizing <a href="fileformat.html#Filtering-Lines-1">line filtering</a> there might be situations where you need to manually hook into the generation and change things. In Literate this is done by letting the user supply custom pre- and post-processing functions that may do transformation of the content.</p><p>All of the generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) accepts <code>preprocess</code> and <code>postprocess</code> keyword arguments. The default "transformation" is the <code>identity</code> function. The input to the transformation functions is a <code>String</code>, and the output should be the transformed <code>String</code>.</p><p><code>preprocess</code> is sent the raw input that is read from the source file (<a href="pipeline.html#Pre-processing-1">modulo the default line ending transformation</a>). <code>postprocess</code> is given different things depending on the output: For markdown and script output <code>postprocess</code> is given the content <code>String</code> just before writing it to the output file, but for notebook output <code>postprocess</code> is given the dictionary representing the notebook, since, in general, this is more useful.</p><p>As an example, lets say we want to splice the date of generation into the output. We could of course update our source file before generating the docs, but we could instead use a <code>preprocess</code> function that splices the date into the source for us. Consider the following source file:</p><pre><code class="language-julia">#' # Example
#' This example was generated DATEOFTODAY
x = 1 // 3</code></pre><p>where <code>DATEOFTODAY</code> is a placeholder, to make it easier for our <code>preprocess</code> function to find the location. Now, lets define the <code>preprocess</code> function, for example</p><pre><code class="language-julia">function update_date(content) x = 1 // 3</code></pre><p>where <code>DATEOFTODAY</code> is a placeholder, to make it easier for our <code>preprocess</code> function to find the location. Now, lets define the <code>preprocess</code> function, for example</p><pre><code class="language-julia">function update_date(content)
content = replace(content, &quot;DATEOFTODAY&quot; =&gt; Date(now())) content = replace(content, "DATEOFTODAY" =&gt; Date(now()))
return content return content
end</code></pre><p>which would replace every occurrence of <code>&quot;DATEOFTODAY&quot;</code> with the current date. We would now simply give this function to the generator, for example:</p><pre><code class="language-julia">Literate.markdown(&quot;input.jl&quot;, &quot;outputdir&quot;; preprocess = update_date)</code></pre><footer><hr/><a class="previous" href="outputformats.html"><span class="direction">Previous</span><span class="title"><strong>4.</strong> Output Formats</span></a><a class="next" href="documenter.html"><span class="direction">Next</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></html> end</code></pre><p>which would replace every occurrence of <code>"DATEOFTODAY"</code> with the current date. We would now simply give this function to the generator, for example:</p><pre><code class="language-julia">Literate.markdown("input.jl", "outputdir"; preprocess = update_date)</code></pre><footer><hr/><a class="previous" href="outputformats.html"><span class="direction">Previous</span><span class="title"><strong>4.</strong> Output Formats</span></a><a class="next" href="documenter.html"><span class="direction">Next</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></HTML>

53
v0.1.0/documenter.html

@ -1,12 +1,53 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>6. Interaction with Documenter.jl · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>6. Interaction with Documenter.jl · Literate.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>Literate.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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li><li class="current"><a class="toctext" href="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a><ul class="internal"></ul></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="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/documenter.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>6. Interaction with Documenter.jl</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Interaction-with-Documenter-1" href="#Interaction-with-Documenter-1"><strong>6.</strong> Interaction with Documenter.jl</a></h1><p>Literate can be used for any purpose, it spits out regular markdown files, and notebooks. Typically, though, these files will be used to render documentation for your package. The generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) supports a keyword argument <code>documenter</code> that lets the generator perform some extra things, keeping in mind that the source code have been written with Documenter.jl in mind. So lets take a look at what will happen if we set <code>documenter = true</code>:</p><h3><a class="nav-anchor" id="[Literate.markdown](@ref):-1" href="#[Literate.markdown](@ref):-1"><a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>:</a></h3><ul><li><p>The default code fence will change from</p><pre><code class="language-none">```julia const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li><li class="current"><a class="toctext" href="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a><ul class="internal"></ul></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="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/documenter.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>6. Interaction with Documenter.jl</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#Interaction-with-Documenter-1" id="Interaction-with-Documenter-1"><strong>6.</strong> Interaction with Documenter.jl</a></h1><p>Literate can be used for any purpose, it spits out regular markdown files, and notebooks. Typically, though, these files will be used to render documentation for your package. The generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) supports a keyword argument <code>documenter</code> that lets the generator perform some extra things, keeping in mind that the source code have been written with Documenter.jl in mind. So lets take a look at what will happen if we set <code>documenter = true</code>:</p><h3><a class="nav-anchor" href="#[Literate.markdown](@ref):-1" id="[Literate.markdown](@ref):-1"></a><a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>:</h3><ul><li><p>The default code fence will change from</p><pre><code class="language-none">```julia
# code # code
```</code></pre><p>to Documenters <code>@example</code> blocks:</p><pre><code class="language-none">```@examples $(name) ```</code></pre><p>to Documenters <code>@example</code> blocks:</p><pre><code class="language-none">```@examples $(name)
# code # code
```</code></pre></li><li><p>The following <code>@meta</code> block will be added to the top of the markdown page, which redirects the &quot;Edit on GitHub&quot; link on the top of the page to the <em>source file</em> rather than the generated <code>.md</code> file:</p><pre><code class="language-none">```@meta ```</code></pre></li><li><p>The following <code>@meta</code> block will be added to the top of the markdown page, which redirects the "Edit on GitHub" link on the top of the page to the <em>source file</em> rather than the generated <code>.md</code> file:</p><pre><code class="language-none">```@meta
EditURL = &quot;$(relpath(inputfile, outputdir))&quot; EditURL = "$(relpath(inputfile, outputdir))"
```</code></pre></li></ul><h3><a class="nav-anchor" id="[Literate.notebook](@ref):-1" href="#[Literate.notebook](@ref):-1"><a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a>:</a></h3><ul><li><p>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 notebook.</p></li><li><p>Documenter style markdown math</p><pre><code class="language-none">```math ```</code></pre></li></ul><h3><a class="nav-anchor" href="#[Literate.notebook](@ref):-1" id="[Literate.notebook](@ref):-1"></a><a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a>:</h3><ul><li><p>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 notebook.</p></li><li><p>Documenter style markdown math</p><pre><code class="language-none">```math
\int f dx \int f dx
```</code></pre><p>is replaced with notebook compatible</p><pre><code class="language-none">\begin{equation} ```</code></pre><p>is replaced with notebook compatible</p><pre><code class="language-none">\begin{equation}
\int f dx \int f dx
\end{equation}</code></pre></li></ul><h3><a class="nav-anchor" id="[Literate.script](@ref):-1" href="#[Literate.script](@ref):-1"><a href="outputformats.html#Literate.script"><code>Literate.script</code></a>:</a></h3><ul><li><p>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.</p></li></ul><footer><hr/><a class="previous" href="customprocessing.html"><span class="direction">Previous</span><span class="title"><strong>5.</strong> Custom pre- and post-processing</span></a><a class="next" href="generated/example.html"><span class="direction">Next</span><span class="title"><strong>7.</strong> Example</span></a></footer></article></body></html> \end{equation}</code></pre></li></ul><h3><a class="nav-anchor" href="#[Literate.script](@ref):-1" id="[Literate.script](@ref):-1"></a><a href="outputformats.html#Literate.script"><code>Literate.script</code></a>:</h3><ul><li><p>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.</p></li></ul><footer><hr/><a class="previous" href="customprocessing.html"><span class="direction">Previous</span><span class="title"><strong>5.</strong> Custom pre- and post-processing</span></a><a class="next" href="generated/example.html"><span class="direction">Next</span><span class="title"><strong>7.</strong> Example</span></a></footer></article></body></HTML>

65
v0.1.0/fileformat.html

@ -1,17 +1,58 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>2. File Format · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>2. File Format · Literate.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>Literate.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 class="current"><a class="toctext" href="fileformat.html"><strong>2.</strong> File Format</a><ul class="internal"><li><a class="toctext" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></li><li><a class="toctext" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</a></li><li><a class="toctext" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></li></ul></li><li><a class="toctext" href="pipeline.html"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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="fileformat.html"><strong>2.</strong> File Format</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/fileformat.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>2. File Format</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="**2.**-File-Format-1" href="#**2.**-File-Format-1"><strong>2.</strong> File Format</a></h1><p>The source file format for Literate is a regular, commented, julia (<code>.jl</code>) scripts. The idea is that the scripts also serve as documentation on their own and it is also simple to include them in the test-suite, with e.g. <code>include</code>, to make sure the examples stay up do date with other changes in your package.</p><h2><a class="nav-anchor" id="Syntax-1" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></h2><p>The basic syntax is simple:</p><ul><li><p>lines starting with <code>#&#39;</code> is treated as markdown,</p></li><li><p>all other lines are treated as julia code.</p></li></ul><p>The reason for using <code>#&#39;</code> instead of <code>#</code> is that we want to be able to use <code>#</code> as comments, just as in a regular script. Lets look at a simple example:</p><pre><code class="language-julia">#&#39; # Rational numbers const head = document.getElementsByTagName('head')[0];
#&#39;
#&#39; In julia rational numbers can be constructed with the `//` operator. // Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
#&#39; Lets define two rational numbers, `x` and `y`: if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="index.html"><strong>1.</strong> Introduction</a></li><li class="current"><a class="toctext" href="fileformat.html"><strong>2.</strong> File Format</a><ul class="internal"><li><a class="toctext" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></li><li><a class="toctext" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</a></li><li><a class="toctext" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></li></ul></li><li><a class="toctext" href="pipeline.html"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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="fileformat.html"><strong>2.</strong> File Format</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/fileformat.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>2. File Format</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#**2.**-File-Format-1" id="**2.**-File-Format-1"><strong>2.</strong> File Format</a></h1><p>The source file format for Literate is a regular, commented, julia (<code>.jl</code>) scripts. The idea is that the scripts also serve as documentation on their own and it is also simple to include them in the test-suite, with e.g. <code>include</code>, to make sure the examples stay up do date with other changes in your package.</p><h2><a class="nav-anchor" href="#Syntax-1" id="Syntax-1"><strong>2.1.</strong> Syntax</a></h2><p>The basic syntax is simple:</p><ul><li><p>lines starting with <code>#'</code> is treated as markdown,</p></li><li><p>all other lines are treated as julia code.</p></li></ul><p>The reason for using <code>#'</code> instead of <code>#</code> is that we want to be able to use <code>#</code> as comments, just as in a regular script. Lets look at a simple example:</p><pre><code class="language-julia">#' # Rational numbers
#'
#' In julia rational numbers can be constructed with the `//` operator.
#' Lets define two rational numbers, `x` and `y`:
x = 1//3 x = 1//3
y = 2//5 y = 2//5
#&#39; When adding `x` and `y` together we obtain a new rational number: #' When adding `x` and `y` together we obtain a new rational number:
z = x + y</code></pre><p>In the lines <code>#&#39;</code> we can use regular markdown syntax, for example the <code>#</code> used for the heading and the backticks for formatting code. The other lines are regular julia code. We note a couple of things:</p><ul><li><p>The script is valid julia, which means that we can <code>include</code> it and the example will run (for example in the <code>test/runtests.jl</code> script, to include the example in the test suite).</p></li><li><p>The script is &quot;self-explanatory&quot;, i.e. the markdown lines works as comments and thus serve as good documentation on its own.</p></li></ul><p>For simple use this is all you need to know. The following additional special syntax can also be used:</p><ul><li><p><code>#md</code>, <code>#nb</code>, <code>#jl</code>, <code>#src</code>: tags to filter lines, see <a href="fileformat.html#Filtering-Lines-1">Filtering Lines</a>,</p></li><li><p><code>#-</code>: tag to manually control chunk-splits, see <a href="pipeline.html#Custom-control-over-chunk-splits-1">Custom control over chunk splits</a>.</p></li></ul><p>There is also some default convenience replacements that will always be performed, see <a href="fileformat.html#Default-Replacements-1">Default Replacements</a>.</p><h2><a class="nav-anchor" id="Filtering-Lines-1" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</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 &quot;tokens&quot; that can be used to mark the purpose of certain lines:</p><ul><li><p><code>#md</code>: line exclusive to markdown output,</p></li><li><p><code>#nb</code>: line exclusive to notebook output,</p></li><li><p><code>#jl</code>: line exclusive to script output,</p></li><li><p><code>#src</code>: line exclusive to the source code and thus filtered out unconditionally.</p></li></ul><p>Lines <em>starting</em> with one of these tokens are filtered out in the <a href="pipeline.html#Pre-processing-1">preprocessing step</a>.</p><p>Suppose, for example, that we want to include a docstring within a <code>@docs</code> block using Documenter. Obviously we don&#39;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><code class="language-julia">#md #&#39; ```@docs z = x + y</code></pre><p>In the lines <code>#'</code> we can use regular markdown syntax, for example the <code>#</code> used for the heading and the backticks for formatting code. The other lines are regular julia code. We note a couple of things:</p><ul><li><p>The script is valid julia, which means that we can <code>include</code> it and the example will run (for example in the <code>test/runtests.jl</code> script, to include the example in the test suite).</p></li><li><p>The script is "self-explanatory", i.e. the markdown lines works as comments and thus serve as good documentation on its own.</p></li></ul><p>For simple use this is all you need to know. The following additional special syntax can also be used:</p><ul><li><p><code>#md</code>, <code>#nb</code>, <code>#jl</code>, <code>#src</code>: tags to filter lines, see <a href="fileformat.html#Filtering-Lines-1">Filtering Lines</a>,</p></li><li><p><code>#-</code>: tag to manually control chunk-splits, see <a href="pipeline.html#Custom-control-over-chunk-splits-1">Custom control over chunk splits</a>.</p></li></ul><p>There is also some default convenience replacements that will always be performed, see <a href="fileformat.html#Default-Replacements-1">Default Replacements</a>.</p><h2><a class="nav-anchor" href="#Filtering-Lines-1" id="Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</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><p><code>#md</code>: line exclusive to markdown output,</p></li><li><p><code>#nb</code>: line exclusive to notebook output,</p></li><li><p><code>#jl</code>: line exclusive to script output,</p></li><li><p><code>#src</code>: line exclusive to the source code and thus filtered out unconditionally.</p></li></ul><p>Lines <em>starting</em> with one of these tokens are filtered out in the <a href="pipeline.html#Pre-processing-1">preprocessing step</a>.</p><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><code class="language-julia">#md #' ```@docs
#md #&#39; Literate.markdown #md #' Literate.markdown
#md #&#39; Literate.notebook #md #' Literate.notebook
#md #&#39; Literate.markdown #md #' Literate.markdown
#md #&#39; ```</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 simple 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><code class="language-julia">using Test #src #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 simple 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><code class="language-julia">using Test #src
@test result == expected_result #src</code></pre><h2><a class="nav-anchor" id="Default-Replacements-1" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></h2><p>The following convenience &quot;macros&quot; are always expanded:</p><ul><li><p><code>@__NAME__</code></p><p>expands to the <code>name</code> keyword argument to <a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#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>expands to <code>https://github.com/$(ENV[&quot;TRAVIS_REPO_SLUG&quot;])/blob/master/</code> and is a convenient way to use when you want to link to files outside the doc-build directory. For example <code>@__REPO__ROOT_URL__src/Literate.jl</code> would link to the source of the Literate module.</p></li><li><p><code>@__NBVIEWER_ROOT_URL__</code></p><p>expands to <code>https://nbviewer.jupyter.org/github/$(ENV[&quot;TRAVIS_REPO_SLUG&quot;])/blob/gh-pages/$(folder)/</code> where <code>folder</code> is the folder that <code>Documenter.deploydocs</code> deploys too. This can be used if you want a link that opens the generated notebook in <a href="http://nbviewer.jupyter.org/">http://nbviewer.jupyter.org/</a>.</p></li></ul><footer><hr/><a class="previous" href="index.html"><span class="direction">Previous</span><span class="title"><strong>1.</strong> Introduction</span></a><a class="next" href="pipeline.html"><span class="direction">Next</span><span class="title"><strong>3.</strong> Processing pipeline</span></a></footer></article></body></html> @test result == expected_result #src</code></pre><h2><a class="nav-anchor" href="#Default-Replacements-1" id="Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></h2><p>The following convenience "macros" are always expanded:</p><ul><li><p><code>@__NAME__</code></p><p>expands to the <code>name</code> keyword argument to <a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#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>expands to <code>https://github.com/$(ENV["TRAVIS_REPO_SLUG"])/blob/master/</code> and is a convenient way to use when you want to link to files outside the doc-build directory. For example <code>@__REPO__ROOT_URL__src/Literate.jl</code> would link to the source of the Literate module.</p></li><li><p><code>@__NBVIEWER_ROOT_URL__</code></p><p>expands to <code>https://nbviewer.jupyter.org/github/$(ENV["TRAVIS_REPO_SLUG"])/blob/gh-pages/$(folder)/</code> where <code>folder</code> is the folder that <code>Documenter.deploydocs</code> deploys too. This can be used if you want a link that opens the generated notebook in <a href="http://nbviewer.jupyter.org/">http://nbviewer.jupyter.org/</a>.</p></li></ul><footer><hr/><a class="previous" href="index.html"><span class="direction">Previous</span><span class="title"><strong>1.</strong> Introduction</span></a><a class="next" href="pipeline.html"><span class="direction">Next</span><span class="title"><strong>3.</strong> Processing pipeline</span></a></footer></article></body></HTML>

51
v0.1.0/generated/example.html

@ -1,7 +1,48 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>7. Example · Literate.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 data-main="../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>7. Example · Literate.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>Literate.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><a class="toctext" href="../outputformats.html"><strong>4.</strong> Output Formats</a></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 class="current"><a class="toctext" href="example.html"><strong>7.</strong> Example</a><ul class="internal"></ul></li></ul></nav><article id="docs"><header><nav><ul><li><a href="example.html"><strong>7.</strong> Example</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>7. Example</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="**7.**-Example-1" href="#**7.**-Example-1"><strong>7.</strong> Example</a></h1><p>This is an example generated with Literate based on this source file: <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><code>example.jl</code></a>. You are seeing the html-output which Documenter have generated based on a markdown file generated with Literate. The corresponding notebook can be found here: <a href="https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v0.1.0/generated/example.ipynb"><code>example.ipynb</code></a>, and the plain script output can be found here: <a href="example.jl"><code>example.jl</code></a>.</p><p>It is recommended to have the <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl">source file</a> available when reading this, to better understand how the syntax in the source file corresponds to the output you are seeing.</p><h3><a class="nav-anchor" id="Basic-syntax-1" href="#Basic-syntax-1">Basic syntax</a></h3><p>The basic syntax for Literate is simple, lines starting with <code>#&#39;</code> is interpreted as markdown, and all the other lines are interpreted as code. Here is some code:</p><div><pre><code class="language-julia">x = 1//3 const head = document.getElementsByTagName('head')[0];
y = 2//5</code></pre><pre><code class="language-none">2//5</code></pre></div><p>In markdown sections we can use markdown syntax. For example, we can write <em>text in italic font</em>, <strong>text in bold font</strong> and use <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">links</a>.</p><p>It is possible to filter out lines depending on the output using the <code>#md</code>, <code>#nb</code>, <code>#jl</code> and <code>#src</code> tags (see <a href="../fileformat.html#Filtering-Lines-1">Filtering Lines</a>):</p><ul><li><p>This line starts with <code>#md</code> and is thus only visible in the markdown output.</p></li></ul><p>The source file is parsed in chunks of markdown and code. Starting a line with <code>#-</code> manually inserts a chunk break. For example, if we want to display the output of the following operations we may insert <code>#-</code> in between. These two code blocks will now end up in different <code>@example</code>-blocks in the markdown output, and two different notebook cells in the notebook output.</p><div><pre><code class="language-julia">x + y</code></pre><pre><code class="language-none">11//15</code></pre></div><div><pre><code class="language-julia">x * y</code></pre><pre><code class="language-none">2//15</code></pre></div><h3><a class="nav-anchor" id="Output-Capturing-1" href="#Output-Capturing-1">Output Capturing</a></h3><p>Code chunks are by default placed in Documenter <code>@example</code> blocks in the generated markdown. This means that the output will be captured in a block when Documenter is building the docs. In notebooks the output is captured in output cells, if the <code>execute</code> keyword argument is set to true. Output to <code>stdout</code>/<code>stderr</code> is also captured.</p><div><pre><code class="language-julia">function foo()
println(&quot;This string is printed to stdout.&quot;) // Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="../search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="../outputformats.html"><strong>4.</strong> Output Formats</a></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 class="current"><a class="toctext" href="example.html"><strong>7.</strong> Example</a><ul class="internal"></ul></li></ul></nav><article id="docs"><header><nav><ul><li><a href="example.html"><strong>7.</strong> Example</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>7. Example</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#**7.**-Example-1" id="**7.**-Example-1"><strong>7.</strong> Example</a></h1><p>This is an example generated with Literate based on this source file: <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><code>example.jl</code></a>. You are seeing the html-output which Documenter have generated based on a markdown file generated with Literate. The corresponding notebook can be found here: <a href="https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v0.1.0/generated/example.ipynb"><code>example.ipynb</code></a>, and the plain script output can be found here: <a href="example.jl"><code>example.jl</code></a>.</p><p>It is recommended to have the <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl">source file</a> available when reading this, to better understand how the syntax in the source file corresponds to the output you are seeing.</p><h3><a class="nav-anchor" href="#Basic-syntax-1" id="Basic-syntax-1">Basic syntax</a></h3><p>The basic syntax for Literate is simple, lines starting with <code>#'</code> is interpreted as markdown, and all the other lines are interpreted as code. Here is some code:</p><div><pre><code class="language-julia">x = 1//3
y = 2//5</code></pre><pre><code class="language-none">2//5</code></pre></div><p>In markdown sections we can use markdown syntax. For example, we can write <em>text in italic font</em>, <strong>text in bold font</strong> and use <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">links</a>.</p><p>It is possible to filter out lines depending on the output using the <code>#md</code>, <code>#nb</code>, <code>#jl</code> and <code>#src</code> tags (see <a href="../fileformat.html#Filtering-Lines-1">Filtering Lines</a>):</p><ul><li><p>This line starts with <code>#md</code> and is thus only visible in the markdown output.</p></li></ul><p>The source file is parsed in chunks of markdown and code. Starting a line with <code>#-</code> manually inserts a chunk break. For example, if we want to display the output of the following operations we may insert <code>#-</code> in between. These two code blocks will now end up in different <code>@example</code>-blocks in the markdown output, and two different notebook cells in the notebook output.</p><div><pre><code class="language-julia">x + y</code></pre><pre><code class="language-none">11//15</code></pre></div><div><pre><code class="language-julia">x * y</code></pre><pre><code class="language-none">2//15</code></pre></div><h3><a class="nav-anchor" href="#Output-Capturing-1" id="Output-Capturing-1">Output Capturing</a></h3><p>Code chunks are by default placed in Documenter <code>@example</code> blocks in the generated markdown. This means that the output will be captured in a block when Documenter is building the docs. In notebooks the output is captured in output cells, if the <code>execute</code> keyword argument is set to true. Output to <code>stdout</code>/<code>stderr</code> is also captured.</p><div><pre><code class="language-julia">function foo()
println("This string is printed to stdout.")
return [1, 2, 3, 4] return [1, 2, 3, 4]
end end
@ -10,4 +51,4 @@ foo()</code></pre><pre><code class="language-none">This string is printed to std
1 1
2 2
3 3
4</code></pre></div><h3><a class="nav-anchor" id="Custom-processing-1" href="#Custom-processing-1">Custom processing</a></h3><p>It is possible to give Literate custom pre- and post-processing functions. For example, here we insert two placeholders, which we will replace with something else at time of generation. We have here replaced our placeholders with <code>z</code> and <code>1.0 + 2.0im</code>:</p><div><pre><code class="language-julia">z = 1.0 + 2.0im</code></pre><pre><code class="language-none">1.0 + 2.0im</code></pre></div><h3><a class="nav-anchor" id="documenter-interaction-1" href="#documenter-interaction-1">Documenter.jl interaction</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, <a href="example.html#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><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p><footer><hr/><a class="previous" href="../documenter.html"><span class="direction">Previous</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></html> 4</code></pre></div><h3><a class="nav-anchor" href="#Custom-processing-1" id="Custom-processing-1">Custom processing</a></h3><p>It is possible to give Literate custom pre- and post-processing functions. For example, here we insert two placeholders, which we will replace with something else at time of generation. We have here replaced our placeholders with <code>z</code> and <code>1.0 + 2.0im</code>:</p><div><pre><code class="language-julia">z = 1.0 + 2.0im</code></pre><pre><code class="language-none">1.0 + 2.0im</code></pre></div><h3><a class="nav-anchor" href="#documenter-interaction-1" id="documenter-interaction-1">Documenter.jl interaction</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, <a href="example.html#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><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p><footer><hr/><a class="previous" href="../documenter.html"><span class="direction">Previous</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></HTML>

45
v0.1.0/index.html

File diff suppressed because one or more lines are too long

61
v0.1.0/outputformats.html

@ -1,16 +1,57 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>4. Output Formats · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>4. Output Formats · Literate.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>Literate.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/Literate.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><p>When the source is parsed, and have been processed it is time to render the output. We will consider the following source snippet:</p><pre><code class="language-julia">#&#39; # Rational numbers const head = document.getElementsByTagName('head')[0];
#&#39;
#&#39; In julia rational numbers can be constructed with the `//` operator. // Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
#&#39; Lets define two rational numbers, `x` and `y`: if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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/Literate.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" href="#Output-Formats-1" id="Output-Formats-1"><strong>4.</strong> Output Formats</a></h1><p>When the source is parsed, and have been processed it is time to render the output. We will consider the following source snippet:</p><pre><code class="language-julia">#' # Rational numbers
#'
#' In julia rational numbers can be constructed with the `//` operator.
#' Lets define two rational numbers, `x` and `y`:
x = 1//3 x = 1//3
#- #-
y = 2//5 y = 2//5
#&#39; When adding `x` and `y` together we obtain a new rational number: #' When adding `x` and `y` together we obtain a new rational number:
z = x + y</code></pre><p>and see how this is rendered in each of the output formats.</p><h2><a class="nav-anchor" id="Markdown-Output-1" href="#Markdown-Output-1"><strong>4.1.</strong> Markdown Output</a></h2><p>The (default) markdown output of the source snippet above is as follows</p><pre><code class="language-markdown"># Rational numbers z = x + y</code></pre><p>and see how this is rendered in each of the output formats.</p><h2><a class="nav-anchor" href="#Markdown-Output-1" id="Markdown-Output-1"><strong>4.1.</strong> Markdown Output</a></h2><p>The (default) markdown output of the source snippet above is as follows</p><pre><code class="language-markdown"># Rational numbers
In julia rational numbers can be constructed with the `//` operator. In julia rational numbers can be constructed with the `//` operator.
Lets define two rational numbers, `x` and `y`: Lets define two rational numbers, `x` and `y`:
@ -27,7 +68,7 @@ When adding `x` and `y` together we obtain a new rational number:
```@example name ```@example name
z = x + y z = x + y
```</code></pre><p>We note that lines starting with <code>#&#39;</code> is printed as regular markdown, and the code lines have been wrapped in <code>@example</code> blocks.</p><p>Some of the output rendering can be controlled with keyword arguments to <a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>:</p><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Literate.markdown" href="#Literate.markdown"><code>Literate.markdown</code></a><span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">Literate.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><p><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, and to replace <code>@__NAME__</code>. Defaults to the filename of <code>inputfile</code>.</p></li><li><p><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>.</p></li><li><p><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>.</p></li><li><p><code>codefence</code>: A <code>Pair</code> of opening and closing code fence. Defaults to</p><pre><code class="language-none">&quot;```@example $(name)&quot; =&gt; &quot;```&quot;</code></pre><p>if <code>documenter = true</code> and</p><pre><code class="language-none">&quot;```julia&quot; =&gt; &quot;```&quot;</code></pre><p>if <code>documenter = false</code>.</p></li></ul></div><a class="source-link" target="_blank" href="https://github.com/fredrikekre/Literate.jl/blob/b3e9d92aa84ec6bfa35e173293df7613c660b064/src/Literate.jl#L270-L295">source</a></section><h2><a class="nav-anchor" id="Notebook-Output-1" href="#Notebook-Output-1"><strong>4.2.</strong> Notebook Output</a></h2><p>The (default) notebook output of the source snippet above is as follows</p><pre><code class="language-none"> │ # Rational numbers ```</code></pre><p>We note that lines starting with <code>#'</code> is printed as regular markdown, and the code lines have been wrapped in <code>@example</code> blocks.</p><p>Some of the output rendering can be controlled with keyword arguments to <a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>:</p><section class="docstring"><div class="docstring-header"><a class="docstring-binding" href="#Literate.markdown" id="Literate.markdown"><code>Literate.markdown</code></a><span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">Literate.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><p><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, and to replace <code>@__NAME__</code>. Defaults to the filename of <code>inputfile</code>.</p></li><li><p><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>.</p></li><li><p><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>.</p></li><li><p><code>codefence</code>: A <code>Pair</code> of opening and closing code fence. Defaults to</p><pre><code class="language-none">"```@example $(name)" =&gt; "```"</code></pre><p>if <code>documenter = true</code> and</p><pre><code class="language-none">"```julia" =&gt; "```"</code></pre><p>if <code>documenter = false</code>.</p></li></ul></div><a class="source-link" href="https://github.com/fredrikekre/Literate.jl/blob/b3e9d92aa84ec6bfa35e173293df7613c660b064/src/Literate.jl#L270-L295" target="_blank">source</a></section><h2><a class="nav-anchor" href="#Notebook-Output-1" id="Notebook-Output-1"><strong>4.2.</strong> Notebook Output</a></h2><p>The (default) notebook output of the source snippet above is as follows</p><pre><code class="language-none"> │ # Rational numbers
│ In julia rational numbers can be constructed with the `//` operator. │ In julia rational numbers can be constructed with the `//` operator.
│ Lets define two rational numbers, `x` and `y`: │ Lets define two rational numbers, `x` and `y`:
@ -41,8 +82,8 @@ Out[2]: │ 2//5
│ When adding `x` and `y` together we obtain a new rational number: │ When adding `x` and `y` together we obtain a new rational number:
In[3]: │ z = x + y In[3]: │ z = x + y
Out[3]: │ 11/15</code></pre><p>We note that lines starting with <code>#&#39;</code> is put in markdown cells, and the code lines have been put in code cells. By default the notebook is also executed and output cells populated. The current working directory is set to the specified output directory the notebook is executed. Some of the output rendering can be controlled with keyword arguments to <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a>:</p><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Literate.notebook" href="#Literate.notebook"><code>Literate.notebook</code></a><span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">Literate.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><p><code>name</code>: name of the output file, excluding <code>.ipynb</code>. <code>name</code> is also used to replace <code>@__NAME__</code>. Defaults to the filename of <code>inputfile</code>.</p></li><li><p><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>.</p></li><li><p><code>execute</code>: a boolean deciding if the generated notebook should also be executed or not. Defaults to <code>true</code>. The current working directory is set to <code>outputdir</code> when executing the notebook.</p></li><li><p><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>.</p></li></ul></div><a class="source-link" target="_blank" href="https://github.com/fredrikekre/Literate.jl/blob/b3e9d92aa84ec6bfa35e173293df7613c660b064/src/Literate.jl#L366-L383">source</a></section><h2><a class="nav-anchor" id="Script-Output-1" href="#Script-Output-1"><strong>4.3.</strong> Script Output</a></h2><p>The (default) script output of the source snippet above is as follows</p><pre><code class="language-julia">x = 1//3 Out[3]: │ 11/15</code></pre><p>We note that lines starting with <code>#'</code> is put in markdown cells, and the code lines have been put in code cells. By default the notebook is also executed and output cells populated. The current working directory is set to the specified output directory the notebook is executed. Some of the output rendering can be controlled with keyword arguments to <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a>:</p><section class="docstring"><div class="docstring-header"><a class="docstring-binding" href="#Literate.notebook" id="Literate.notebook"><code>Literate.notebook</code></a><span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">Literate.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><p><code>name</code>: name of the output file, excluding <code>.ipynb</code>. <code>name</code> is also used to replace <code>@__NAME__</code>. Defaults to the filename of <code>inputfile</code>.</p></li><li><p><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>.</p></li><li><p><code>execute</code>: a boolean deciding if the generated notebook should also be executed or not. Defaults to <code>true</code>. The current working directory is set to <code>outputdir</code> when executing the notebook.</p></li><li><p><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>.</p></li></ul></div><a class="source-link" href="https://github.com/fredrikekre/Literate.jl/blob/b3e9d92aa84ec6bfa35e173293df7613c660b064/src/Literate.jl#L366-L383" target="_blank">source</a></section><h2><a class="nav-anchor" href="#Script-Output-1" id="Script-Output-1"><strong>4.3.</strong> Script Output</a></h2><p>The (default) script output of the source snippet above is as follows</p><pre><code class="language-julia">x = 1//3
y = 2//5 y = 2//5
z = x + y</code></pre><p>We note that lines starting with <code>#&#39;</code> are removed and only the code lines have been kept. Some of the output rendering can be controlled with keyword arguments to <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>:</p><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Literate.script" href="#Literate.script"><code>Literate.script</code></a><span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">Literate.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><p><code>name</code>: name of the output file, excluding <code>.jl</code>. <code>name</code> is also used to replace <code>@__NAME__</code>. Defaults to the filename of <code>inputfile</code>.</p></li><li><p><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>.</p></li><li><p><code>documenter</code>: boolean that says if the source contains Documenter.jl specific things to filter out during script generation. Defaults to <code>true</code>. See the the manual section on <a href="documenter.html#Interaction-with-Documenter-1">Interaction with Documenter</a>.</p></li><li><p><code>keep_comments</code>: boolean that, if set to <code>true</code>, keeps markdown lines (<code>#&#39;</code>) as comments in the output script. Defaults to <code>false</code>.</p></li></ul></div><a class="source-link" target="_blank" href="https://github.com/fredrikekre/Literate.jl/blob/b3e9d92aa84ec6bfa35e173293df7613c660b064/src/Literate.jl#L206-L222">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> z = x + y</code></pre><p>We note that lines starting with <code>#'</code> are removed and only the code lines have been kept. Some of the output rendering can be controlled with keyword arguments to <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>:</p><section class="docstring"><div class="docstring-header"><a class="docstring-binding" href="#Literate.script" id="Literate.script"><code>Literate.script</code></a><span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">Literate.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><p><code>name</code>: name of the output file, excluding <code>.jl</code>. <code>name</code> is also used to replace <code>@__NAME__</code>. Defaults to the filename of <code>inputfile</code>.</p></li><li><p><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>.</p></li><li><p><code>documenter</code>: boolean that says if the source contains Documenter.jl specific things to filter out during script generation. Defaults to <code>true</code>. See the the manual section on <a href="documenter.html#Interaction-with-Documenter-1">Interaction with Documenter</a>.</p></li><li><p><code>keep_comments</code>: boolean that, if set to <code>true</code>, keeps markdown lines (<code>#'</code>) as comments in the output script. Defaults to <code>false</code>.</p></li></ul></div><a class="source-link" href="https://github.com/fredrikekre/Literate.jl/blob/b3e9d92aa84ec6bfa35e173293df7613c660b064/src/Literate.jl#L206-L222" target="_blank">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>

69
v0.1.0/pipeline.html

File diff suppressed because one or more lines are too long

45
v0.1.0/search.html

@ -1,2 +1,43 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>Search · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Search · Literate.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>Literate.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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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><header><nav><ul><li>Search</li></ul></nav><hr/><div id="topbar"><span>Search</span><a class="fa fa-bars" href="#"></a></div></header><h1>Search</h1><p id="search-info">Number of results: <span id="search-results-number">loading...</span></p><ul id="search-results"></ul></article></body><script src="search_index.js"></script><script src="assets/search.js"></script></html> const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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><header><nav><ul><li>Search</li></ul></nav><hr/><div id="topbar"><span>Search</span><a class="fa fa-bars" href="#"></a></div></header><h1>Search</h1><p id="search-info">Number of results: <span id="search-results-number">loading...</span></p><ul id="search-results"></ul></article><script src="search_index.js"></script><script src="assets/search.js"></script></body></HTML>

49
v0.2.0/customprocessing.html

@ -1,8 +1,49 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>5. Custom pre- and post-processing · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>5. Custom pre- and post-processing · Literate.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>Literate.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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li class="current"><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a><ul class="internal"></ul></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="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/customprocessing.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>5. Custom pre- and post-processing</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Custom-pre-and-post-processing-1" href="#Custom-pre-and-post-processing-1"><strong>5.</strong> Custom pre- and post-processing</a></h1><p>Since all packages are different, and may have different demands on how to create a nice example for the documentation it is important that the package maintainer does not feel limited by the by default provided syntax that this package offers. While you can generally come a long way by utilizing <a href="fileformat.html#Filtering-Lines-1">line filtering</a> there might be situations where you need to manually hook into the generation and change things. In Literate this is done by letting the user supply custom pre- and post-processing functions that may do transformation of the content.</p><p>All of the generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) accepts <code>preprocess</code> and <code>postprocess</code> keyword arguments. The default &quot;transformation&quot; is the <code>identity</code> function. The input to the transformation functions is a <code>String</code>, and the output should be the transformed <code>String</code>.</p><p><code>preprocess</code> is sent the raw input that is read from the source file (<a href="pipeline.html#Pre-processing-1">modulo the default line ending transformation</a>). <code>postprocess</code> is given different things depending on the output: For markdown and script output <code>postprocess</code> is given the content <code>String</code> just before writing it to the output file, but for notebook output <code>postprocess</code> is given the dictionary representing the notebook, since, in general, this is more useful.</p><p>As an example, lets say we want to splice the date of generation into the output. We could of course update our source file before generating the docs, but we could instead use a <code>preprocess</code> function that splices the date into the source for us. Consider the following source file:</p><pre><code class="language-julia"># # Example const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li class="current"><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a><ul class="internal"></ul></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="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/customprocessing.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>5. Custom pre- and post-processing</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#Custom-pre-and-post-processing-1" id="Custom-pre-and-post-processing-1"><strong>5.</strong> Custom pre- and post-processing</a></h1><p>Since all packages are different, and may have different demands on how to create a nice example for the documentation it is important that the package maintainer does not feel limited by the by default provided syntax that this package offers. While you can generally come a long way by utilizing <a href="fileformat.html#Filtering-Lines-1">line filtering</a> there might be situations where you need to manually hook into the generation and change things. In Literate this is done by letting the user supply custom pre- and post-processing functions that may do transformation of the content.</p><p>All of the generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) accepts <code>preprocess</code> and <code>postprocess</code> keyword arguments. The default "transformation" is the <code>identity</code> function. The input to the transformation functions is a <code>String</code>, and the output should be the transformed <code>String</code>.</p><p><code>preprocess</code> is sent the raw input that is read from the source file (<a href="pipeline.html#Pre-processing-1">modulo the default line ending transformation</a>). <code>postprocess</code> is given different things depending on the output: For markdown and script output <code>postprocess</code> is given the content <code>String</code> just before writing it to the output file, but for notebook output <code>postprocess</code> is given the dictionary representing the notebook, since, in general, this is more useful.</p><p>As an example, lets say we want to splice the date of generation into the output. We could of course update our source file before generating the docs, but we could instead use a <code>preprocess</code> function that splices the date into the source for us. Consider the following source file:</p><pre><code class="language-julia"># # Example
# This example was generated DATEOFTODAY # This example was generated DATEOFTODAY
x = 1 // 3</code></pre><p>where <code>DATEOFTODAY</code> is a placeholder, to make it easier for our <code>preprocess</code> function to find the location. Now, lets define the <code>preprocess</code> function, for example</p><pre><code class="language-julia">function update_date(content) x = 1 // 3</code></pre><p>where <code>DATEOFTODAY</code> is a placeholder, to make it easier for our <code>preprocess</code> function to find the location. Now, lets define the <code>preprocess</code> function, for example</p><pre><code class="language-julia">function update_date(content)
content = replace(content, &quot;DATEOFTODAY&quot; =&gt; Date(now())) content = replace(content, "DATEOFTODAY" =&gt; Date(now()))
return content return content
end</code></pre><p>which would replace every occurrence of <code>&quot;DATEOFTODAY&quot;</code> with the current date. We would now simply give this function to the generator, for example:</p><pre><code class="language-julia">Literate.markdown(&quot;input.jl&quot;, &quot;outputdir&quot;; preprocess = update_date)</code></pre><footer><hr/><a class="previous" href="outputformats.html"><span class="direction">Previous</span><span class="title"><strong>4.</strong> Output Formats</span></a><a class="next" href="documenter.html"><span class="direction">Next</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></html> end</code></pre><p>which would replace every occurrence of <code>"DATEOFTODAY"</code> with the current date. We would now simply give this function to the generator, for example:</p><pre><code class="language-julia">Literate.markdown("input.jl", "outputdir"; preprocess = update_date)</code></pre><footer><hr/><a class="previous" href="outputformats.html"><span class="direction">Previous</span><span class="title"><strong>4.</strong> Output Formats</span></a><a class="next" href="documenter.html"><span class="direction">Next</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></HTML>

53
v0.2.0/documenter.html

@ -1,12 +1,53 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>6. Interaction with Documenter.jl · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>6. Interaction with Documenter.jl · Literate.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>Literate.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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li><li class="current"><a class="toctext" href="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a><ul class="internal"></ul></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="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/documenter.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>6. Interaction with Documenter.jl</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Interaction-with-Documenter-1" href="#Interaction-with-Documenter-1"><strong>6.</strong> Interaction with Documenter.jl</a></h1><p>Literate can be used for any purpose, it spits out regular markdown files, and notebooks. Typically, though, these files will be used to render documentation for your package. The generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) supports a keyword argument <code>documenter</code> that lets the generator perform some extra things, keeping in mind that the source code have been written with Documenter.jl in mind. So lets take a look at what will happen if we set <code>documenter = true</code>:</p><h3><a class="nav-anchor" id="[Literate.markdown](@ref):-1" href="#[Literate.markdown](@ref):-1"><a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>:</a></h3><ul><li><p>The default code fence will change from</p><pre><code class="language-none">```julia const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li><li class="current"><a class="toctext" href="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a><ul class="internal"></ul></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="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/documenter.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>6. Interaction with Documenter.jl</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#Interaction-with-Documenter-1" id="Interaction-with-Documenter-1"><strong>6.</strong> Interaction with Documenter.jl</a></h1><p>Literate can be used for any purpose, it spits out regular markdown files, and notebooks. Typically, though, these files will be used to render documentation for your package. The generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) supports a keyword argument <code>documenter</code> that lets the generator perform some extra things, keeping in mind that the source code have been written with Documenter.jl in mind. So lets take a look at what will happen if we set <code>documenter = true</code>:</p><h3><a class="nav-anchor" href="#[Literate.markdown](@ref):-1" id="[Literate.markdown](@ref):-1"></a><a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>:</h3><ul><li><p>The default code fence will change from</p><pre><code class="language-none">```julia
# code # code
```</code></pre><p>to Documenters <code>@example</code> blocks:</p><pre><code class="language-none">```@examples $(name) ```</code></pre><p>to Documenters <code>@example</code> blocks:</p><pre><code class="language-none">```@examples $(name)
# code # code
```</code></pre></li><li><p>The following <code>@meta</code> block will be added to the top of the markdown page, which redirects the &quot;Edit on GitHub&quot; link on the top of the page to the <em>source file</em> rather than the generated <code>.md</code> file:</p><pre><code class="language-none">```@meta ```</code></pre></li><li><p>The following <code>@meta</code> block will be added to the top of the markdown page, which redirects the "Edit on GitHub" link on the top of the page to the <em>source file</em> rather than the generated <code>.md</code> file:</p><pre><code class="language-none">```@meta
EditURL = &quot;$(relpath(inputfile, outputdir))&quot; EditURL = "$(relpath(inputfile, outputdir))"
```</code></pre></li></ul><h3><a class="nav-anchor" id="[Literate.notebook](@ref):-1" href="#[Literate.notebook](@ref):-1"><a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a>:</a></h3><ul><li><p>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 notebook.</p></li><li><p>Documenter style markdown math</p><pre><code class="language-none">```math ```</code></pre></li></ul><h3><a class="nav-anchor" href="#[Literate.notebook](@ref):-1" id="[Literate.notebook](@ref):-1"></a><a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a>:</h3><ul><li><p>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 notebook.</p></li><li><p>Documenter style markdown math</p><pre><code class="language-none">```math
\int f dx \int f dx
```</code></pre><p>is replaced with notebook compatible</p><pre><code class="language-none">\begin{equation} ```</code></pre><p>is replaced with notebook compatible</p><pre><code class="language-none">\begin{equation}
\int f dx \int f dx
\end{equation}</code></pre></li></ul><h3><a class="nav-anchor" id="[Literate.script](@ref):-1" href="#[Literate.script](@ref):-1"><a href="outputformats.html#Literate.script"><code>Literate.script</code></a>:</a></h3><ul><li><p>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.</p></li></ul><footer><hr/><a class="previous" href="customprocessing.html"><span class="direction">Previous</span><span class="title"><strong>5.</strong> Custom pre- and post-processing</span></a><a class="next" href="generated/example.html"><span class="direction">Next</span><span class="title"><strong>7.</strong> Example</span></a></footer></article></body></html> \end{equation}</code></pre></li></ul><h3><a class="nav-anchor" href="#[Literate.script](@ref):-1" id="[Literate.script](@ref):-1"></a><a href="outputformats.html#Literate.script"><code>Literate.script</code></a>:</h3><ul><li><p>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.</p></li></ul><footer><hr/><a class="previous" href="customprocessing.html"><span class="direction">Previous</span><span class="title"><strong>5.</strong> Custom pre- and post-processing</span></a><a class="next" href="generated/example.html"><span class="direction">Next</span><span class="title"><strong>7.</strong> Example</span></a></footer></article></body></HTML>

49
v0.2.0/fileformat.html

@ -1,5 +1,46 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>2. File Format · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>2. File Format · Literate.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>Literate.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 class="current"><a class="toctext" href="fileformat.html"><strong>2.</strong> File Format</a><ul class="internal"><li><a class="toctext" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></li><li><a class="toctext" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</a></li><li><a class="toctext" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></li></ul></li><li><a class="toctext" href="pipeline.html"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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="fileformat.html"><strong>2.</strong> File Format</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/fileformat.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>2. File Format</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="**2.**-File-Format-1" href="#**2.**-File-Format-1"><strong>2.</strong> File Format</a></h1><p>The source file format for Literate is a regular, commented, julia (<code>.jl</code>) scripts. The idea is that the scripts also serve as documentation on their own and it is also simple to include them in the test-suite, with e.g. <code>include</code>, to make sure the examples stay up do date with other changes in your package.</p><h2><a class="nav-anchor" id="Syntax-1" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></h2><p>The basic syntax is simple:</p><ul><li><p>lines starting with <code>#</code> are treated as markdown,</p></li><li><p>all other lines are treated as julia code.</p></li></ul><p>Leading whitespace is allowed before <code>#</code>, but it will be removed when generating the output. Since <code>#</code>-lines is treated as markdown we can not use that for regular julia comments, for this you can instead use <code>##</code>, which will render as <code>#</code> in the output.</p><p>Lets look at a simple example:</p><pre><code class="language-julia"># # Rational numbers const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="index.html"><strong>1.</strong> Introduction</a></li><li class="current"><a class="toctext" href="fileformat.html"><strong>2.</strong> File Format</a><ul class="internal"><li><a class="toctext" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></li><li><a class="toctext" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</a></li><li><a class="toctext" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></li></ul></li><li><a class="toctext" href="pipeline.html"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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="fileformat.html"><strong>2.</strong> File Format</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/fileformat.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>2. File Format</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#**2.**-File-Format-1" id="**2.**-File-Format-1"><strong>2.</strong> File Format</a></h1><p>The source file format for Literate is a regular, commented, julia (<code>.jl</code>) scripts. The idea is that the scripts also serve as documentation on their own and it is also simple to include them in the test-suite, with e.g. <code>include</code>, to make sure the examples stay up do date with other changes in your package.</p><h2><a class="nav-anchor" href="#Syntax-1" id="Syntax-1"><strong>2.1.</strong> Syntax</a></h2><p>The basic syntax is simple:</p><ul><li><p>lines starting with <code>#</code> are treated as markdown,</p></li><li><p>all other lines are treated as julia code.</p></li></ul><p>Leading whitespace is allowed before <code>#</code>, but it will be removed when generating the output. Since <code>#</code>-lines is treated as markdown we can not use that for regular julia comments, for this you can instead use <code>##</code>, which will render as <code>#</code> in the output.</p><p>Lets look at a simple example:</p><pre><code class="language-julia"># # Rational numbers
# #
# In julia rational numbers can be constructed with the `//` operator. # In julia rational numbers can be constructed with the `//` operator.
# Lets define two rational numbers, `x` and `y`: # Lets define two rational numbers, `x` and `y`:
@ -9,9 +50,9 @@ y = 2//5
# When adding `x` and `y` together we obtain a new rational number: # When adding `x` and `y` together we obtain a new rational number:
z = x + y</code></pre><p>In the lines starting with <code>#</code> we can use regular markdown syntax, for example the <code>#</code> used for the heading and the backticks for formatting code. The other lines are regular julia code. We note a couple of things:</p><ul><li><p>The script is valid julia, which means that we can <code>include</code> it and the example will run (for example in the <code>test/runtests.jl</code> script, to include the example in the test suite).</p></li><li><p>The script is &quot;self-explanatory&quot;, i.e. the markdown lines works as comments and thus serve as good documentation on its own.</p></li></ul><p>For simple use this is all you need to know. The following additional special syntax can also be used:</p><ul><li><p><code>#md</code>, <code>#nb</code>, <code>#jl</code>, <code>#src</code>: tags to filter lines, see <a href="fileformat.html#Filtering-Lines-1">Filtering Lines</a>,</p></li><li><p><code>#-</code>: tag to manually control chunk-splits, see <a href="pipeline.html#Custom-control-over-chunk-splits-1">Custom control over chunk splits</a>.</p></li></ul><p>There is also some default convenience replacements that will always be performed, see <a href="fileformat.html#Default-Replacements-1">Default Replacements</a>.</p><h2><a class="nav-anchor" id="Filtering-Lines-1" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</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 &quot;tokens&quot; that can be used to mark the purpose of certain lines:</p><ul><li><p><code>#md</code>: line exclusive to markdown output,</p></li><li><p><code>#nb</code>: line exclusive to notebook output,</p></li><li><p><code>#jl</code>: line exclusive to script output,</p></li><li><p><code>#src</code>: line exclusive to the source code and thus filtered out unconditionally.</p></li></ul><p>Lines <em>starting</em> with one of these tokens are filtered out in the <a href="pipeline.html#Pre-processing-1">preprocessing step</a>.</p><p>Suppose, for example, that we want to include a docstring within a <code>@docs</code> block using Documenter. Obviously we don&#39;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><code class="language-julia">#md # ```@docs z = x + y</code></pre><p>In the lines starting with <code>#</code> we can use regular markdown syntax, for example the <code>#</code> used for the heading and the backticks for formatting code. The other lines are regular julia code. We note a couple of things:</p><ul><li><p>The script is valid julia, which means that we can <code>include</code> it and the example will run (for example in the <code>test/runtests.jl</code> script, to include the example in the test suite).</p></li><li><p>The script is "self-explanatory", i.e. the markdown lines works as comments and thus serve as good documentation on its own.</p></li></ul><p>For simple use this is all you need to know. The following additional special syntax can also be used:</p><ul><li><p><code>#md</code>, <code>#nb</code>, <code>#jl</code>, <code>#src</code>: tags to filter lines, see <a href="fileformat.html#Filtering-Lines-1">Filtering Lines</a>,</p></li><li><p><code>#-</code>: tag to manually control chunk-splits, see <a href="pipeline.html#Custom-control-over-chunk-splits-1">Custom control over chunk splits</a>.</p></li></ul><p>There is also some default convenience replacements that will always be performed, see <a href="fileformat.html#Default-Replacements-1">Default Replacements</a>.</p><h2><a class="nav-anchor" href="#Filtering-Lines-1" id="Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</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><p><code>#md</code>: line exclusive to markdown output,</p></li><li><p><code>#nb</code>: line exclusive to notebook output,</p></li><li><p><code>#jl</code>: line exclusive to script output,</p></li><li><p><code>#src</code>: line exclusive to the source code and thus filtered out unconditionally.</p></li></ul><p>Lines <em>starting</em> with one of these tokens are filtered out in the <a href="pipeline.html#Pre-processing-1">preprocessing step</a>.</p><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><code class="language-julia">#md # ```@docs
#md # Literate.markdown #md # Literate.markdown
#md # Literate.notebook #md # Literate.notebook
#md # Literate.markdown #md # Literate.markdown
#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 simple 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><code class="language-julia">using Test #src #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 simple 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><code class="language-julia">using Test #src
@test result == expected_result #src</code></pre><h2><a class="nav-anchor" id="Default-Replacements-1" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></h2><p>The following convenience &quot;macros&quot; are always expanded:</p><ul><li><p><code>@__NAME__</code></p><p>expands to the <code>name</code> keyword argument to <a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#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>expands to <code>https://github.com/$(ENV[&quot;TRAVIS_REPO_SLUG&quot;])/blob/master/</code> and is a convenient way to use when you want to link to files outside the doc-build directory. For example <code>@__REPO__ROOT_URL__src/Literate.jl</code> would link to the source of the Literate module.</p></li><li><p><code>@__NBVIEWER_ROOT_URL__</code></p><p>expands to <code>https://nbviewer.jupyter.org/github/$(ENV[&quot;TRAVIS_REPO_SLUG&quot;])/blob/gh-pages/$(folder)/</code> where <code>folder</code> is the folder that <code>Documenter.deploydocs</code> deploys too. This can be used if you want a link that opens the generated notebook in <a href="http://nbviewer.jupyter.org/">http://nbviewer.jupyter.org/</a>.</p></li></ul><footer><hr/><a class="previous" href="index.html"><span class="direction">Previous</span><span class="title"><strong>1.</strong> Introduction</span></a><a class="next" href="pipeline.html"><span class="direction">Next</span><span class="title"><strong>3.</strong> Processing pipeline</span></a></footer></article></body></html> @test result == expected_result #src</code></pre><h2><a class="nav-anchor" href="#Default-Replacements-1" id="Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></h2><p>The following convenience "macros" are always expanded:</p><ul><li><p><code>@__NAME__</code></p><p>expands to the <code>name</code> keyword argument to <a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#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>expands to <code>https://github.com/$(ENV["TRAVIS_REPO_SLUG"])/blob/master/</code> and is a convenient way to use when you want to link to files outside the doc-build directory. For example <code>@__REPO__ROOT_URL__src/Literate.jl</code> would link to the source of the Literate module.</p></li><li><p><code>@__NBVIEWER_ROOT_URL__</code></p><p>expands to <code>https://nbviewer.jupyter.org/github/$(ENV["TRAVIS_REPO_SLUG"])/blob/gh-pages/$(folder)/</code> where <code>folder</code> is the folder that <code>Documenter.deploydocs</code> deploys too. This can be used if you want a link that opens the generated notebook in <a href="http://nbviewer.jupyter.org/">http://nbviewer.jupyter.org/</a>.</p></li></ul><footer><hr/><a class="previous" href="index.html"><span class="direction">Previous</span><span class="title"><strong>1.</strong> Introduction</span></a><a class="next" href="pipeline.html"><span class="direction">Next</span><span class="title"><strong>3.</strong> Processing pipeline</span></a></footer></article></body></HTML>

51
v0.2.0/generated/example.html

@ -1,7 +1,48 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>7. Example · Literate.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 data-main="../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>7. Example · Literate.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>Literate.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><a class="toctext" href="../outputformats.html"><strong>4.</strong> Output Formats</a></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 class="current"><a class="toctext" href="example.html"><strong>7.</strong> Example</a><ul class="internal"></ul></li></ul></nav><article id="docs"><header><nav><ul><li><a href="example.html"><strong>7.</strong> Example</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>7. Example</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="**7.**-Example-1" href="#**7.**-Example-1"><strong>7.</strong> Example</a></h1><p>This is an example generated with Literate based on this source file: <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><code>example.jl</code></a>. You are seeing the html-output which Documenter have generated based on a markdown file generated with Literate. The corresponding notebook can be found here: <a href="https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v0.2.0/generated/example.ipynb"><code>example.ipynb</code></a>, and the plain script output can be found here: <a href="example.jl"><code>example.jl</code></a>.</p><p>It is recommended to have the <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl">source file</a> available when reading this, to better understand how the syntax in the source file corresponds to the output you are seeing.</p><h3><a class="nav-anchor" id="Basic-syntax-1" href="#Basic-syntax-1">Basic syntax</a></h3><p>The basic syntax for Literate is simple, lines starting with <code>#</code> is interpreted as markdown, and all the other lines are interpreted as code. Here is some code:</p><div><pre><code class="language-julia">x = 1//3 const head = document.getElementsByTagName('head')[0];
y = 2//5</code></pre><pre><code class="language-none">2//5</code></pre></div><p>In markdown sections we can use markdown syntax. For example, we can write <em>text in italic font</em>, <strong>text in bold font</strong> and use <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">links</a>.</p><p>It is possible to filter out lines depending on the output using the <code>#md</code>, <code>#nb</code>, <code>#jl</code> and <code>#src</code> tags (see <a href="../fileformat.html#Filtering-Lines-1">Filtering Lines</a>):</p><ul><li><p>This line starts with <code>#md</code> and is thus only visible in the markdown output.</p></li></ul><p>The source file is parsed in chunks of markdown and code. Starting a line with <code>#-</code> manually inserts a chunk break. For example, if we want to display the output of the following operations we may insert <code>#-</code> in between. These two code blocks will now end up in different <code>@example</code>-blocks in the markdown output, and two different notebook cells in the notebook output.</p><div><pre><code class="language-julia">x + y</code></pre><pre><code class="language-none">11//15</code></pre></div><div><pre><code class="language-julia">x * y</code></pre><pre><code class="language-none">2//15</code></pre></div><h3><a class="nav-anchor" id="Output-Capturing-1" href="#Output-Capturing-1">Output Capturing</a></h3><p>Code chunks are by default placed in Documenter <code>@example</code> blocks in the generated markdown. This means that the output will be captured in a block when Documenter is building the docs. In notebooks the output is captured in output cells, if the <code>execute</code> keyword argument is set to true. Output to <code>stdout</code>/<code>stderr</code> is also captured.</p><div><pre><code class="language-julia">function foo()
println(&quot;This string is printed to stdout.&quot;) // Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="../search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="../outputformats.html"><strong>4.</strong> Output Formats</a></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 class="current"><a class="toctext" href="example.html"><strong>7.</strong> Example</a><ul class="internal"></ul></li></ul></nav><article id="docs"><header><nav><ul><li><a href="example.html"><strong>7.</strong> Example</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>7. Example</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#**7.**-Example-1" id="**7.**-Example-1"><strong>7.</strong> Example</a></h1><p>This is an example generated with Literate based on this source file: <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><code>example.jl</code></a>. You are seeing the html-output which Documenter have generated based on a markdown file generated with Literate. The corresponding notebook can be found here: <a href="https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v0.2.0/generated/example.ipynb"><code>example.ipynb</code></a>, and the plain script output can be found here: <a href="example.jl"><code>example.jl</code></a>.</p><p>It is recommended to have the <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl">source file</a> available when reading this, to better understand how the syntax in the source file corresponds to the output you are seeing.</p><h3><a class="nav-anchor" href="#Basic-syntax-1" id="Basic-syntax-1">Basic syntax</a></h3><p>The basic syntax for Literate is simple, lines starting with <code>#</code> is interpreted as markdown, and all the other lines are interpreted as code. Here is some code:</p><div><pre><code class="language-julia">x = 1//3
y = 2//5</code></pre><pre><code class="language-none">2//5</code></pre></div><p>In markdown sections we can use markdown syntax. For example, we can write <em>text in italic font</em>, <strong>text in bold font</strong> and use <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">links</a>.</p><p>It is possible to filter out lines depending on the output using the <code>#md</code>, <code>#nb</code>, <code>#jl</code> and <code>#src</code> tags (see <a href="../fileformat.html#Filtering-Lines-1">Filtering Lines</a>):</p><ul><li><p>This line starts with <code>#md</code> and is thus only visible in the markdown output.</p></li></ul><p>The source file is parsed in chunks of markdown and code. Starting a line with <code>#-</code> manually inserts a chunk break. For example, if we want to display the output of the following operations we may insert <code>#-</code> in between. These two code blocks will now end up in different <code>@example</code>-blocks in the markdown output, and two different notebook cells in the notebook output.</p><div><pre><code class="language-julia">x + y</code></pre><pre><code class="language-none">11//15</code></pre></div><div><pre><code class="language-julia">x * y</code></pre><pre><code class="language-none">2//15</code></pre></div><h3><a class="nav-anchor" href="#Output-Capturing-1" id="Output-Capturing-1">Output Capturing</a></h3><p>Code chunks are by default placed in Documenter <code>@example</code> blocks in the generated markdown. This means that the output will be captured in a block when Documenter is building the docs. In notebooks the output is captured in output cells, if the <code>execute</code> keyword argument is set to true. Output to <code>stdout</code>/<code>stderr</code> is also captured.</p><div><pre><code class="language-julia">function foo()
println("This string is printed to stdout.")
return [1, 2, 3, 4] return [1, 2, 3, 4]
end end
@ -10,4 +51,4 @@ foo()</code></pre><pre><code class="language-none">This string is printed to std
1 1
2 2
3 3
4</code></pre></div><h3><a class="nav-anchor" id="Custom-processing-1" href="#Custom-processing-1">Custom processing</a></h3><p>It is possible to give Literate custom pre- and post-processing functions. For example, here we insert two placeholders, which we will replace with something else at time of generation. We have here replaced our placeholders with <code>z</code> and <code>1.0 + 2.0im</code>:</p><div><pre><code class="language-julia">z = 1.0 + 2.0im</code></pre><pre><code class="language-none">1.0 + 2.0im</code></pre></div><h3><a class="nav-anchor" id="documenter-interaction-1" href="#documenter-interaction-1">Documenter.jl interaction</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, <a href="example.html#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><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p><footer><hr/><a class="previous" href="../documenter.html"><span class="direction">Previous</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></html> 4</code></pre></div><h3><a class="nav-anchor" href="#Custom-processing-1" id="Custom-processing-1">Custom processing</a></h3><p>It is possible to give Literate custom pre- and post-processing functions. For example, here we insert two placeholders, which we will replace with something else at time of generation. We have here replaced our placeholders with <code>z</code> and <code>1.0 + 2.0im</code>:</p><div><pre><code class="language-julia">z = 1.0 + 2.0im</code></pre><pre><code class="language-none">1.0 + 2.0im</code></pre></div><h3><a class="nav-anchor" href="#documenter-interaction-1" id="documenter-interaction-1">Documenter.jl interaction</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, <a href="example.html#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><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p><footer><hr/><a class="previous" href="../documenter.html"><span class="direction">Previous</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></HTML>

45
v0.2.0/index.html

File diff suppressed because one or more lines are too long

53
v0.2.0/outputformats.html

File diff suppressed because one or more lines are too long

51
v0.2.0/pipeline.html

File diff suppressed because one or more lines are too long

45
v0.2.0/search.html

@ -1,2 +1,43 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>Search · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Search · Literate.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>Literate.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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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><header><nav><ul><li>Search</li></ul></nav><hr/><div id="topbar"><span>Search</span><a class="fa fa-bars" href="#"></a></div></header><h1>Search</h1><p id="search-info">Number of results: <span id="search-results-number">loading...</span></p><ul id="search-results"></ul></article></body><script src="search_index.js"></script><script src="assets/search.js"></script></html> const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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><header><nav><ul><li>Search</li></ul></nav><hr/><div id="topbar"><span>Search</span><a class="fa fa-bars" href="#"></a></div></header><h1>Search</h1><p id="search-info">Number of results: <span id="search-results-number">loading...</span></p><ul id="search-results"></ul></article><script src="search_index.js"></script><script src="assets/search.js"></script></body></HTML>

49
v0.2.1/customprocessing.html

@ -1,8 +1,49 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>5. Custom pre- and post-processing · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>5. Custom pre- and post-processing · Literate.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>Literate.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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li class="current"><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a><ul class="internal"></ul></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="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/customprocessing.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>5. Custom pre- and post-processing</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Custom-pre-and-post-processing-1" href="#Custom-pre-and-post-processing-1"><strong>5.</strong> Custom pre- and post-processing</a></h1><p>Since all packages are different, and may have different demands on how to create a nice example for the documentation it is important that the package maintainer does not feel limited by the by default provided syntax that this package offers. While you can generally come a long way by utilizing <a href="fileformat.html#Filtering-Lines-1">line filtering</a> there might be situations where you need to manually hook into the generation and change things. In Literate this is done by letting the user supply custom pre- and post-processing functions that may do transformation of the content.</p><p>All of the generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) accepts <code>preprocess</code> and <code>postprocess</code> keyword arguments. The default &quot;transformation&quot; is the <code>identity</code> function. The input to the transformation functions is a <code>String</code>, and the output should be the transformed <code>String</code>.</p><p><code>preprocess</code> is sent the raw input that is read from the source file (<a href="pipeline.html#Pre-processing-1">modulo the default line ending transformation</a>). <code>postprocess</code> is given different things depending on the output: For markdown and script output <code>postprocess</code> is given the content <code>String</code> just before writing it to the output file, but for notebook output <code>postprocess</code> is given the dictionary representing the notebook, since, in general, this is more useful.</p><p>As an example, lets say we want to splice the date of generation into the output. We could of course update our source file before generating the docs, but we could instead use a <code>preprocess</code> function that splices the date into the source for us. Consider the following source file:</p><pre><code class="language-julia"># # Example const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li class="current"><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a><ul class="internal"></ul></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="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/customprocessing.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>5. Custom pre- and post-processing</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#Custom-pre-and-post-processing-1" id="Custom-pre-and-post-processing-1"><strong>5.</strong> Custom pre- and post-processing</a></h1><p>Since all packages are different, and may have different demands on how to create a nice example for the documentation it is important that the package maintainer does not feel limited by the by default provided syntax that this package offers. While you can generally come a long way by utilizing <a href="fileformat.html#Filtering-Lines-1">line filtering</a> there might be situations where you need to manually hook into the generation and change things. In Literate this is done by letting the user supply custom pre- and post-processing functions that may do transformation of the content.</p><p>All of the generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) accepts <code>preprocess</code> and <code>postprocess</code> keyword arguments. The default "transformation" is the <code>identity</code> function. The input to the transformation functions is a <code>String</code>, and the output should be the transformed <code>String</code>.</p><p><code>preprocess</code> is sent the raw input that is read from the source file (<a href="pipeline.html#Pre-processing-1">modulo the default line ending transformation</a>). <code>postprocess</code> is given different things depending on the output: For markdown and script output <code>postprocess</code> is given the content <code>String</code> just before writing it to the output file, but for notebook output <code>postprocess</code> is given the dictionary representing the notebook, since, in general, this is more useful.</p><p>As an example, lets say we want to splice the date of generation into the output. We could of course update our source file before generating the docs, but we could instead use a <code>preprocess</code> function that splices the date into the source for us. Consider the following source file:</p><pre><code class="language-julia"># # Example
# This example was generated DATEOFTODAY # This example was generated DATEOFTODAY
x = 1 // 3</code></pre><p>where <code>DATEOFTODAY</code> is a placeholder, to make it easier for our <code>preprocess</code> function to find the location. Now, lets define the <code>preprocess</code> function, for example</p><pre><code class="language-julia">function update_date(content) x = 1 // 3</code></pre><p>where <code>DATEOFTODAY</code> is a placeholder, to make it easier for our <code>preprocess</code> function to find the location. Now, lets define the <code>preprocess</code> function, for example</p><pre><code class="language-julia">function update_date(content)
content = replace(content, &quot;DATEOFTODAY&quot; =&gt; Date(now())) content = replace(content, "DATEOFTODAY" =&gt; Date(now()))
return content return content
end</code></pre><p>which would replace every occurrence of <code>&quot;DATEOFTODAY&quot;</code> with the current date. We would now simply give this function to the generator, for example:</p><pre><code class="language-julia">Literate.markdown(&quot;input.jl&quot;, &quot;outputdir&quot;; preprocess = update_date)</code></pre><footer><hr/><a class="previous" href="outputformats.html"><span class="direction">Previous</span><span class="title"><strong>4.</strong> Output Formats</span></a><a class="next" href="documenter.html"><span class="direction">Next</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></html> end</code></pre><p>which would replace every occurrence of <code>"DATEOFTODAY"</code> with the current date. We would now simply give this function to the generator, for example:</p><pre><code class="language-julia">Literate.markdown("input.jl", "outputdir"; preprocess = update_date)</code></pre><footer><hr/><a class="previous" href="outputformats.html"><span class="direction">Previous</span><span class="title"><strong>4.</strong> Output Formats</span></a><a class="next" href="documenter.html"><span class="direction">Next</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></HTML>

53
v0.2.1/documenter.html

@ -1,12 +1,53 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>6. Interaction with Documenter.jl · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>6. Interaction with Documenter.jl · Literate.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>Literate.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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li><li class="current"><a class="toctext" href="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a><ul class="internal"></ul></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="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/documenter.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>6. Interaction with Documenter.jl</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Interaction-with-Documenter-1" href="#Interaction-with-Documenter-1"><strong>6.</strong> Interaction with Documenter.jl</a></h1><p>Literate can be used for any purpose, it spits out regular markdown files, and notebooks. Typically, though, these files will be used to render documentation for your package. The generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) supports a keyword argument <code>documenter</code> that lets the generator perform some extra things, keeping in mind that the source code have been written with Documenter.jl in mind. So lets take a look at what will happen if we set <code>documenter = true</code>:</p><h3><a class="nav-anchor" id="[Literate.markdown](@ref):-1" href="#[Literate.markdown](@ref):-1"><a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>:</a></h3><ul><li><p>The default code fence will change from</p><pre><code class="language-none">```julia const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li><li class="current"><a class="toctext" href="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a><ul class="internal"></ul></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="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/documenter.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>6. Interaction with Documenter.jl</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#Interaction-with-Documenter-1" id="Interaction-with-Documenter-1"><strong>6.</strong> Interaction with Documenter.jl</a></h1><p>Literate can be used for any purpose, it spits out regular markdown files, and notebooks. Typically, though, these files will be used to render documentation for your package. The generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) supports a keyword argument <code>documenter</code> that lets the generator perform some extra things, keeping in mind that the source code have been written with Documenter.jl in mind. So lets take a look at what will happen if we set <code>documenter = true</code>:</p><h3><a class="nav-anchor" href="#[Literate.markdown](@ref):-1" id="[Literate.markdown](@ref):-1"></a><a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>:</h3><ul><li><p>The default code fence will change from</p><pre><code class="language-none">```julia
# code # code
```</code></pre><p>to Documenters <code>@example</code> blocks:</p><pre><code class="language-none">```@examples $(name) ```</code></pre><p>to Documenters <code>@example</code> blocks:</p><pre><code class="language-none">```@examples $(name)
# code # code
```</code></pre></li><li><p>The following <code>@meta</code> block will be added to the top of the markdown page, which redirects the &quot;Edit on GitHub&quot; link on the top of the page to the <em>source file</em> rather than the generated <code>.md</code> file:</p><pre><code class="language-none">```@meta ```</code></pre></li><li><p>The following <code>@meta</code> block will be added to the top of the markdown page, which redirects the "Edit on GitHub" link on the top of the page to the <em>source file</em> rather than the generated <code>.md</code> file:</p><pre><code class="language-none">```@meta
EditURL = &quot;$(relpath(inputfile, outputdir))&quot; EditURL = "$(relpath(inputfile, outputdir))"
```</code></pre></li></ul><h3><a class="nav-anchor" id="[Literate.notebook](@ref):-1" href="#[Literate.notebook](@ref):-1"><a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a>:</a></h3><ul><li><p>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 notebook.</p></li><li><p>Documenter style markdown math</p><pre><code class="language-none">```math ```</code></pre></li></ul><h3><a class="nav-anchor" href="#[Literate.notebook](@ref):-1" id="[Literate.notebook](@ref):-1"></a><a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a>:</h3><ul><li><p>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 notebook.</p></li><li><p>Documenter style markdown math</p><pre><code class="language-none">```math
\int f dx \int f dx
```</code></pre><p>is replaced with notebook compatible</p><pre><code class="language-none">\begin{equation} ```</code></pre><p>is replaced with notebook compatible</p><pre><code class="language-none">\begin{equation}
\int f dx \int f dx
\end{equation}</code></pre></li></ul><h3><a class="nav-anchor" id="[Literate.script](@ref):-1" href="#[Literate.script](@ref):-1"><a href="outputformats.html#Literate.script"><code>Literate.script</code></a>:</a></h3><ul><li><p>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.</p></li></ul><footer><hr/><a class="previous" href="customprocessing.html"><span class="direction">Previous</span><span class="title"><strong>5.</strong> Custom pre- and post-processing</span></a><a class="next" href="generated/example.html"><span class="direction">Next</span><span class="title"><strong>7.</strong> Example</span></a></footer></article></body></html> \end{equation}</code></pre></li></ul><h3><a class="nav-anchor" href="#[Literate.script](@ref):-1" id="[Literate.script](@ref):-1"></a><a href="outputformats.html#Literate.script"><code>Literate.script</code></a>:</h3><ul><li><p>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.</p></li></ul><footer><hr/><a class="previous" href="customprocessing.html"><span class="direction">Previous</span><span class="title"><strong>5.</strong> Custom pre- and post-processing</span></a><a class="next" href="generated/example.html"><span class="direction">Next</span><span class="title"><strong>7.</strong> Example</span></a></footer></article></body></HTML>

49
v0.2.1/fileformat.html

@ -1,5 +1,46 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>2. File Format · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>2. File Format · Literate.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>Literate.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 class="current"><a class="toctext" href="fileformat.html"><strong>2.</strong> File Format</a><ul class="internal"><li><a class="toctext" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></li><li><a class="toctext" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</a></li><li><a class="toctext" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></li></ul></li><li><a class="toctext" href="pipeline.html"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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="fileformat.html"><strong>2.</strong> File Format</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/fileformat.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>2. File Format</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="**2.**-File-Format-1" href="#**2.**-File-Format-1"><strong>2.</strong> File Format</a></h1><p>The source file format for Literate is a regular, commented, julia (<code>.jl</code>) scripts. The idea is that the scripts also serve as documentation on their own and it is also simple to include them in the test-suite, with e.g. <code>include</code>, to make sure the examples stay up do date with other changes in your package.</p><h2><a class="nav-anchor" id="Syntax-1" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></h2><p>The basic syntax is simple:</p><ul><li><p>lines starting with <code>#</code> are treated as markdown,</p></li><li><p>all other lines are treated as julia code.</p></li></ul><p>Leading whitespace is allowed before <code>#</code>, but it will be removed when generating the output. Since <code>#</code>-lines is treated as markdown we can not use that for regular julia comments, for this you can instead use <code>##</code>, which will render as <code>#</code> in the output.</p><p>Lets look at a simple example:</p><pre><code class="language-julia"># # Rational numbers const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="index.html"><strong>1.</strong> Introduction</a></li><li class="current"><a class="toctext" href="fileformat.html"><strong>2.</strong> File Format</a><ul class="internal"><li><a class="toctext" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></li><li><a class="toctext" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</a></li><li><a class="toctext" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></li></ul></li><li><a class="toctext" href="pipeline.html"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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="fileformat.html"><strong>2.</strong> File Format</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/fileformat.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>2. File Format</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#**2.**-File-Format-1" id="**2.**-File-Format-1"><strong>2.</strong> File Format</a></h1><p>The source file format for Literate is a regular, commented, julia (<code>.jl</code>) scripts. The idea is that the scripts also serve as documentation on their own and it is also simple to include them in the test-suite, with e.g. <code>include</code>, to make sure the examples stay up do date with other changes in your package.</p><h2><a class="nav-anchor" href="#Syntax-1" id="Syntax-1"><strong>2.1.</strong> Syntax</a></h2><p>The basic syntax is simple:</p><ul><li><p>lines starting with <code>#</code> are treated as markdown,</p></li><li><p>all other lines are treated as julia code.</p></li></ul><p>Leading whitespace is allowed before <code>#</code>, but it will be removed when generating the output. Since <code>#</code>-lines is treated as markdown we can not use that for regular julia comments, for this you can instead use <code>##</code>, which will render as <code>#</code> in the output.</p><p>Lets look at a simple example:</p><pre><code class="language-julia"># # Rational numbers
# #
# In julia rational numbers can be constructed with the `//` operator. # In julia rational numbers can be constructed with the `//` operator.
# Lets define two rational numbers, `x` and `y`: # Lets define two rational numbers, `x` and `y`:
@ -9,9 +50,9 @@ y = 2//5
# When adding `x` and `y` together we obtain a new rational number: # When adding `x` and `y` together we obtain a new rational number:
z = x + y</code></pre><p>In the lines starting with <code>#</code> we can use regular markdown syntax, for example the <code>#</code> used for the heading and the backticks for formatting code. The other lines are regular julia code. We note a couple of things:</p><ul><li><p>The script is valid julia, which means that we can <code>include</code> it and the example will run (for example in the <code>test/runtests.jl</code> script, to include the example in the test suite).</p></li><li><p>The script is &quot;self-explanatory&quot;, i.e. the markdown lines works as comments and thus serve as good documentation on its own.</p></li></ul><p>For simple use this is all you need to know. The following additional special syntax can also be used:</p><ul><li><p><code>#md</code>, <code>#nb</code>, <code>#jl</code>, <code>#src</code>: tags to filter lines, see <a href="fileformat.html#Filtering-Lines-1">Filtering Lines</a>,</p></li><li><p><code>#-</code>: tag to manually control chunk-splits, see <a href="pipeline.html#Custom-control-over-chunk-splits-1">Custom control over chunk splits</a>.</p></li></ul><p>There is also some default convenience replacements that will always be performed, see <a href="fileformat.html#Default-Replacements-1">Default Replacements</a>.</p><h2><a class="nav-anchor" id="Filtering-Lines-1" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</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 &quot;tokens&quot; that can be used to mark the purpose of certain lines:</p><ul><li><p><code>#md</code>: line exclusive to markdown output,</p></li><li><p><code>#nb</code>: line exclusive to notebook output,</p></li><li><p><code>#jl</code>: line exclusive to script output,</p></li><li><p><code>#src</code>: line exclusive to the source code and thus filtered out unconditionally.</p></li></ul><p>Lines <em>starting</em> with one of these tokens are filtered out in the <a href="pipeline.html#Pre-processing-1">preprocessing step</a>.</p><p>Suppose, for example, that we want to include a docstring within a <code>@docs</code> block using Documenter. Obviously we don&#39;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><code class="language-julia">#md # ```@docs z = x + y</code></pre><p>In the lines starting with <code>#</code> we can use regular markdown syntax, for example the <code>#</code> used for the heading and the backticks for formatting code. The other lines are regular julia code. We note a couple of things:</p><ul><li><p>The script is valid julia, which means that we can <code>include</code> it and the example will run (for example in the <code>test/runtests.jl</code> script, to include the example in the test suite).</p></li><li><p>The script is "self-explanatory", i.e. the markdown lines works as comments and thus serve as good documentation on its own.</p></li></ul><p>For simple use this is all you need to know. The following additional special syntax can also be used:</p><ul><li><p><code>#md</code>, <code>#nb</code>, <code>#jl</code>, <code>#src</code>: tags to filter lines, see <a href="fileformat.html#Filtering-Lines-1">Filtering Lines</a>,</p></li><li><p><code>#-</code>: tag to manually control chunk-splits, see <a href="pipeline.html#Custom-control-over-chunk-splits-1">Custom control over chunk splits</a>.</p></li></ul><p>There is also some default convenience replacements that will always be performed, see <a href="fileformat.html#Default-Replacements-1">Default Replacements</a>.</p><h2><a class="nav-anchor" href="#Filtering-Lines-1" id="Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</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><p><code>#md</code>: line exclusive to markdown output,</p></li><li><p><code>#nb</code>: line exclusive to notebook output,</p></li><li><p><code>#jl</code>: line exclusive to script output,</p></li><li><p><code>#src</code>: line exclusive to the source code and thus filtered out unconditionally.</p></li></ul><p>Lines <em>starting</em> with one of these tokens are filtered out in the <a href="pipeline.html#Pre-processing-1">preprocessing step</a>.</p><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><code class="language-julia">#md # ```@docs
#md # Literate.markdown #md # Literate.markdown
#md # Literate.notebook #md # Literate.notebook
#md # Literate.markdown #md # Literate.markdown
#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 simple 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><code class="language-julia">using Test #src #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 simple 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><code class="language-julia">using Test #src
@test result == expected_result #src</code></pre><h2><a class="nav-anchor" id="Default-Replacements-1" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></h2><p>The following convenience &quot;macros&quot; are always expanded:</p><ul><li><p><code>@__NAME__</code></p><p>expands to the <code>name</code> keyword argument to <a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#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>expands to <code>https://github.com/$(ENV[&quot;TRAVIS_REPO_SLUG&quot;])/blob/master/</code> and is a convenient way to use when you want to link to files outside the doc-build directory. For example <code>@__REPO__ROOT_URL__src/Literate.jl</code> would link to the source of the Literate module.</p></li><li><p><code>@__NBVIEWER_ROOT_URL__</code></p><p>expands to <code>https://nbviewer.jupyter.org/github/$(ENV[&quot;TRAVIS_REPO_SLUG&quot;])/blob/gh-pages/$(folder)/</code> where <code>folder</code> is the folder that <code>Documenter.deploydocs</code> deploys too. This can be used if you want a link that opens the generated notebook in <a href="http://nbviewer.jupyter.org/">http://nbviewer.jupyter.org/</a>.</p></li></ul><footer><hr/><a class="previous" href="index.html"><span class="direction">Previous</span><span class="title"><strong>1.</strong> Introduction</span></a><a class="next" href="pipeline.html"><span class="direction">Next</span><span class="title"><strong>3.</strong> Processing pipeline</span></a></footer></article></body></html> @test result == expected_result #src</code></pre><h2><a class="nav-anchor" href="#Default-Replacements-1" id="Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></h2><p>The following convenience "macros" are always expanded:</p><ul><li><p><code>@__NAME__</code></p><p>expands to the <code>name</code> keyword argument to <a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#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>expands to <code>https://github.com/$(ENV["TRAVIS_REPO_SLUG"])/blob/master/</code> and is a convenient way to use when you want to link to files outside the doc-build directory. For example <code>@__REPO__ROOT_URL__src/Literate.jl</code> would link to the source of the Literate module.</p></li><li><p><code>@__NBVIEWER_ROOT_URL__</code></p><p>expands to <code>https://nbviewer.jupyter.org/github/$(ENV["TRAVIS_REPO_SLUG"])/blob/gh-pages/$(folder)/</code> where <code>folder</code> is the folder that <code>Documenter.deploydocs</code> deploys too. This can be used if you want a link that opens the generated notebook in <a href="http://nbviewer.jupyter.org/">http://nbviewer.jupyter.org/</a>.</p></li></ul><footer><hr/><a class="previous" href="index.html"><span class="direction">Previous</span><span class="title"><strong>1.</strong> Introduction</span></a><a class="next" href="pipeline.html"><span class="direction">Next</span><span class="title"><strong>3.</strong> Processing pipeline</span></a></footer></article></body></HTML>

51
v0.2.1/generated/example.html

@ -1,7 +1,48 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>7. Example · Literate.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 data-main="../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>7. Example · Literate.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>Literate.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><a class="toctext" href="../outputformats.html"><strong>4.</strong> Output Formats</a></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 class="current"><a class="toctext" href="example.html"><strong>7.</strong> Example</a><ul class="internal"></ul></li></ul></nav><article id="docs"><header><nav><ul><li><a href="example.html"><strong>7.</strong> Example</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>7. Example</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="**7.**-Example-1" href="#**7.**-Example-1"><strong>7.</strong> Example</a></h1><p>This is an example generated with Literate based on this source file: <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><code>example.jl</code></a>. You are seeing the html-output which Documenter have generated based on a markdown file generated with Literate. The corresponding notebook can be found here: <a href="https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v0.2.1/generated/example.ipynb"><code>example.ipynb</code></a>, and the plain script output can be found here: <a href="example.jl"><code>example.jl</code></a>.</p><p>It is recommended to have the <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl">source file</a> available when reading this, to better understand how the syntax in the source file corresponds to the output you are seeing.</p><h3><a class="nav-anchor" id="Basic-syntax-1" href="#Basic-syntax-1">Basic syntax</a></h3><p>The basic syntax for Literate is simple, lines starting with <code>#</code> is interpreted as markdown, and all the other lines are interpreted as code. Here is some code:</p><div><pre><code class="language-julia">x = 1//3 const head = document.getElementsByTagName('head')[0];
y = 2//5</code></pre><pre><code class="language-none">2//5</code></pre></div><p>In markdown sections we can use markdown syntax. For example, we can write <em>text in italic font</em>, <strong>text in bold font</strong> and use <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">links</a>.</p><p>It is possible to filter out lines depending on the output using the <code>#md</code>, <code>#nb</code>, <code>#jl</code> and <code>#src</code> tags (see <a href="../fileformat.html#Filtering-Lines-1">Filtering Lines</a>):</p><ul><li><p>This line starts with <code>#md</code> and is thus only visible in the markdown output.</p></li></ul><p>The source file is parsed in chunks of markdown and code. Starting a line with <code>#-</code> manually inserts a chunk break. For example, if we want to display the output of the following operations we may insert <code>#-</code> in between. These two code blocks will now end up in different <code>@example</code>-blocks in the markdown output, and two different notebook cells in the notebook output.</p><div><pre><code class="language-julia">x + y</code></pre><pre><code class="language-none">11//15</code></pre></div><div><pre><code class="language-julia">x * y</code></pre><pre><code class="language-none">2//15</code></pre></div><h3><a class="nav-anchor" id="Output-Capturing-1" href="#Output-Capturing-1">Output Capturing</a></h3><p>Code chunks are by default placed in Documenter <code>@example</code> blocks in the generated markdown. This means that the output will be captured in a block when Documenter is building the docs. In notebooks the output is captured in output cells, if the <code>execute</code> keyword argument is set to true. Output to <code>stdout</code>/<code>stderr</code> is also captured.</p><div><pre><code class="language-julia">function foo()
println(&quot;This string is printed to stdout.&quot;) // Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="../search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="../outputformats.html"><strong>4.</strong> Output Formats</a></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 class="current"><a class="toctext" href="example.html"><strong>7.</strong> Example</a><ul class="internal"></ul></li></ul></nav><article id="docs"><header><nav><ul><li><a href="example.html"><strong>7.</strong> Example</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>7. Example</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#**7.**-Example-1" id="**7.**-Example-1"><strong>7.</strong> Example</a></h1><p>This is an example generated with Literate based on this source file: <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><code>example.jl</code></a>. You are seeing the html-output which Documenter have generated based on a markdown file generated with Literate. The corresponding notebook can be found here: <a href="https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v0.2.1/generated/example.ipynb"><code>example.ipynb</code></a>, and the plain script output can be found here: <a href="example.jl"><code>example.jl</code></a>.</p><p>It is recommended to have the <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl">source file</a> available when reading this, to better understand how the syntax in the source file corresponds to the output you are seeing.</p><h3><a class="nav-anchor" href="#Basic-syntax-1" id="Basic-syntax-1">Basic syntax</a></h3><p>The basic syntax for Literate is simple, lines starting with <code>#</code> is interpreted as markdown, and all the other lines are interpreted as code. Here is some code:</p><div><pre><code class="language-julia">x = 1//3
y = 2//5</code></pre><pre><code class="language-none">2//5</code></pre></div><p>In markdown sections we can use markdown syntax. For example, we can write <em>text in italic font</em>, <strong>text in bold font</strong> and use <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">links</a>.</p><p>It is possible to filter out lines depending on the output using the <code>#md</code>, <code>#nb</code>, <code>#jl</code> and <code>#src</code> tags (see <a href="../fileformat.html#Filtering-Lines-1">Filtering Lines</a>):</p><ul><li><p>This line starts with <code>#md</code> and is thus only visible in the markdown output.</p></li></ul><p>The source file is parsed in chunks of markdown and code. Starting a line with <code>#-</code> manually inserts a chunk break. For example, if we want to display the output of the following operations we may insert <code>#-</code> in between. These two code blocks will now end up in different <code>@example</code>-blocks in the markdown output, and two different notebook cells in the notebook output.</p><div><pre><code class="language-julia">x + y</code></pre><pre><code class="language-none">11//15</code></pre></div><div><pre><code class="language-julia">x * y</code></pre><pre><code class="language-none">2//15</code></pre></div><h3><a class="nav-anchor" href="#Output-Capturing-1" id="Output-Capturing-1">Output Capturing</a></h3><p>Code chunks are by default placed in Documenter <code>@example</code> blocks in the generated markdown. This means that the output will be captured in a block when Documenter is building the docs. In notebooks the output is captured in output cells, if the <code>execute</code> keyword argument is set to true. Output to <code>stdout</code>/<code>stderr</code> is also captured.</p><div><pre><code class="language-julia">function foo()
println("This string is printed to stdout.")
return [1, 2, 3, 4] return [1, 2, 3, 4]
end end
@ -10,4 +51,4 @@ foo()</code></pre><pre><code class="language-none">This string is printed to std
1 1
2 2
3 3
4</code></pre></div><h3><a class="nav-anchor" id="Custom-processing-1" href="#Custom-processing-1">Custom processing</a></h3><p>It is possible to give Literate custom pre- and post-processing functions. For example, here we insert two placeholders, which we will replace with something else at time of generation. We have here replaced our placeholders with <code>z</code> and <code>1.0 + 2.0im</code>:</p><div><pre><code class="language-julia">z = 1.0 + 2.0im</code></pre><pre><code class="language-none">1.0 + 2.0im</code></pre></div><h3><a class="nav-anchor" id="documenter-interaction-1" href="#documenter-interaction-1">Documenter.jl interaction</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, <a href="example.html#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><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p><footer><hr/><a class="previous" href="../documenter.html"><span class="direction">Previous</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></html> 4</code></pre></div><h3><a class="nav-anchor" href="#Custom-processing-1" id="Custom-processing-1">Custom processing</a></h3><p>It is possible to give Literate custom pre- and post-processing functions. For example, here we insert two placeholders, which we will replace with something else at time of generation. We have here replaced our placeholders with <code>z</code> and <code>1.0 + 2.0im</code>:</p><div><pre><code class="language-julia">z = 1.0 + 2.0im</code></pre><pre><code class="language-none">1.0 + 2.0im</code></pre></div><h3><a class="nav-anchor" href="#documenter-interaction-1" id="documenter-interaction-1">Documenter.jl interaction</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, <a href="example.html#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><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p><footer><hr/><a class="previous" href="../documenter.html"><span class="direction">Previous</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></HTML>

45
v0.2.1/index.html

File diff suppressed because one or more lines are too long

53
v0.2.1/outputformats.html

File diff suppressed because one or more lines are too long

51
v0.2.1/pipeline.html

File diff suppressed because one or more lines are too long

45
v0.2.1/search.html

@ -1,2 +1,43 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>Search · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Search · Literate.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>Literate.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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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><header><nav><ul><li>Search</li></ul></nav><hr/><div id="topbar"><span>Search</span><a class="fa fa-bars" href="#"></a></div></header><h1>Search</h1><p id="search-info">Number of results: <span id="search-results-number">loading...</span></p><ul id="search-results"></ul></article></body><script src="search_index.js"></script><script src="assets/search.js"></script></html> const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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><header><nav><ul><li>Search</li></ul></nav><hr/><div id="topbar"><span>Search</span><a class="fa fa-bars" href="#"></a></div></header><h1>Search</h1><p id="search-info">Number of results: <span id="search-results-number">loading...</span></p><ul id="search-results"></ul></article><script src="search_index.js"></script><script src="assets/search.js"></script></body></HTML>

49
v0.2.2/customprocessing.html

@ -1,8 +1,49 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>5. Custom pre- and post-processing · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>5. Custom pre- and post-processing · Literate.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>Literate.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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li class="current"><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a><ul class="internal"></ul></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="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/customprocessing.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>5. Custom pre- and post-processing</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Custom-pre-and-post-processing-1" href="#Custom-pre-and-post-processing-1"><strong>5.</strong> Custom pre- and post-processing</a></h1><p>Since all packages are different, and may have different demands on how to create a nice example for the documentation it is important that the package maintainer does not feel limited by the by default provided syntax that this package offers. While you can generally come a long way by utilizing <a href="fileformat.html#Filtering-Lines-1">line filtering</a> there might be situations where you need to manually hook into the generation and change things. In Literate this is done by letting the user supply custom pre- and post-processing functions that may do transformation of the content.</p><p>All of the generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) accepts <code>preprocess</code> and <code>postprocess</code> keyword arguments. The default &quot;transformation&quot; is the <code>identity</code> function. The input to the transformation functions is a <code>String</code>, and the output should be the transformed <code>String</code>.</p><p><code>preprocess</code> is sent the raw input that is read from the source file (<a href="pipeline.html#Pre-processing-1">modulo the default line ending transformation</a>). <code>postprocess</code> is given different things depending on the output: For markdown and script output <code>postprocess</code> is given the content <code>String</code> just before writing it to the output file, but for notebook output <code>postprocess</code> is given the dictionary representing the notebook, since, in general, this is more useful.</p><p>As an example, lets say we want to splice the date of generation into the output. We could of course update our source file before generating the docs, but we could instead use a <code>preprocess</code> function that splices the date into the source for us. Consider the following source file:</p><pre><code class="language-julia"># # Example const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li class="current"><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a><ul class="internal"></ul></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="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/customprocessing.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>5. Custom pre- and post-processing</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#Custom-pre-and-post-processing-1" id="Custom-pre-and-post-processing-1"><strong>5.</strong> Custom pre- and post-processing</a></h1><p>Since all packages are different, and may have different demands on how to create a nice example for the documentation it is important that the package maintainer does not feel limited by the by default provided syntax that this package offers. While you can generally come a long way by utilizing <a href="fileformat.html#Filtering-Lines-1">line filtering</a> there might be situations where you need to manually hook into the generation and change things. In Literate this is done by letting the user supply custom pre- and post-processing functions that may do transformation of the content.</p><p>All of the generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) accepts <code>preprocess</code> and <code>postprocess</code> keyword arguments. The default "transformation" is the <code>identity</code> function. The input to the transformation functions is a <code>String</code>, and the output should be the transformed <code>String</code>.</p><p><code>preprocess</code> is sent the raw input that is read from the source file (<a href="pipeline.html#Pre-processing-1">modulo the default line ending transformation</a>). <code>postprocess</code> is given different things depending on the output: For markdown and script output <code>postprocess</code> is given the content <code>String</code> just before writing it to the output file, but for notebook output <code>postprocess</code> is given the dictionary representing the notebook, since, in general, this is more useful.</p><p>As an example, lets say we want to splice the date of generation into the output. We could of course update our source file before generating the docs, but we could instead use a <code>preprocess</code> function that splices the date into the source for us. Consider the following source file:</p><pre><code class="language-julia"># # Example
# This example was generated DATEOFTODAY # This example was generated DATEOFTODAY
x = 1 // 3</code></pre><p>where <code>DATEOFTODAY</code> is a placeholder, to make it easier for our <code>preprocess</code> function to find the location. Now, lets define the <code>preprocess</code> function, for example</p><pre><code class="language-julia">function update_date(content) x = 1 // 3</code></pre><p>where <code>DATEOFTODAY</code> is a placeholder, to make it easier for our <code>preprocess</code> function to find the location. Now, lets define the <code>preprocess</code> function, for example</p><pre><code class="language-julia">function update_date(content)
content = replace(content, &quot;DATEOFTODAY&quot; =&gt; Date(now())) content = replace(content, "DATEOFTODAY" =&gt; Date(now()))
return content return content
end</code></pre><p>which would replace every occurrence of <code>&quot;DATEOFTODAY&quot;</code> with the current date. We would now simply give this function to the generator, for example:</p><pre><code class="language-julia">Literate.markdown(&quot;input.jl&quot;, &quot;outputdir&quot;; preprocess = update_date)</code></pre><footer><hr/><a class="previous" href="outputformats.html"><span class="direction">Previous</span><span class="title"><strong>4.</strong> Output Formats</span></a><a class="next" href="documenter.html"><span class="direction">Next</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></html> end</code></pre><p>which would replace every occurrence of <code>"DATEOFTODAY"</code> with the current date. We would now simply give this function to the generator, for example:</p><pre><code class="language-julia">Literate.markdown("input.jl", "outputdir"; preprocess = update_date)</code></pre><footer><hr/><a class="previous" href="outputformats.html"><span class="direction">Previous</span><span class="title"><strong>4.</strong> Output Formats</span></a><a class="next" href="documenter.html"><span class="direction">Next</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></HTML>

53
v0.2.2/documenter.html

@ -1,12 +1,53 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>6. Interaction with Documenter.jl · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>6. Interaction with Documenter.jl · Literate.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>Literate.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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li><li class="current"><a class="toctext" href="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a><ul class="internal"></ul></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="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/documenter.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>6. Interaction with Documenter.jl</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Interaction-with-Documenter-1" href="#Interaction-with-Documenter-1"><strong>6.</strong> Interaction with Documenter.jl</a></h1><p>Literate can be used for any purpose, it spits out regular markdown files, and notebooks. Typically, though, these files will be used to render documentation for your package. The generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) supports a keyword argument <code>documenter</code> that lets the generator perform some extra things, keeping in mind that the source code have been written with Documenter.jl in mind. So lets take a look at what will happen if we set <code>documenter = true</code>:</p><h3><a class="nav-anchor" id="[Literate.markdown](@ref):-1" href="#[Literate.markdown](@ref):-1"><a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>:</a></h3><ul><li><p>The default code fence will change from</p><pre><code class="language-none">```julia const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li><li class="current"><a class="toctext" href="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a><ul class="internal"></ul></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="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/documenter.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>6. Interaction with Documenter.jl</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#Interaction-with-Documenter-1" id="Interaction-with-Documenter-1"><strong>6.</strong> Interaction with Documenter.jl</a></h1><p>Literate can be used for any purpose, it spits out regular markdown files, and notebooks. Typically, though, these files will be used to render documentation for your package. The generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) supports a keyword argument <code>documenter</code> that lets the generator perform some extra things, keeping in mind that the source code have been written with Documenter.jl in mind. So lets take a look at what will happen if we set <code>documenter = true</code>:</p><h3><a class="nav-anchor" href="#[Literate.markdown](@ref):-1" id="[Literate.markdown](@ref):-1"></a><a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>:</h3><ul><li><p>The default code fence will change from</p><pre><code class="language-none">```julia
# code # code
```</code></pre><p>to Documenters <code>@example</code> blocks:</p><pre><code class="language-none">```@examples $(name) ```</code></pre><p>to Documenters <code>@example</code> blocks:</p><pre><code class="language-none">```@examples $(name)
# code # code
```</code></pre></li><li><p>The following <code>@meta</code> block will be added to the top of the markdown page, which redirects the &quot;Edit on GitHub&quot; link on the top of the page to the <em>source file</em> rather than the generated <code>.md</code> file:</p><pre><code class="language-none">```@meta ```</code></pre></li><li><p>The following <code>@meta</code> block will be added to the top of the markdown page, which redirects the "Edit on GitHub" link on the top of the page to the <em>source file</em> rather than the generated <code>.md</code> file:</p><pre><code class="language-none">```@meta
EditURL = &quot;$(relpath(inputfile, outputdir))&quot; EditURL = "$(relpath(inputfile, outputdir))"
```</code></pre></li></ul><h3><a class="nav-anchor" id="[Literate.notebook](@ref):-1" href="#[Literate.notebook](@ref):-1"><a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a>:</a></h3><ul><li><p>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 notebook.</p></li><li><p>Documenter style markdown math</p><pre><code class="language-none">```math ```</code></pre></li></ul><h3><a class="nav-anchor" href="#[Literate.notebook](@ref):-1" id="[Literate.notebook](@ref):-1"></a><a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a>:</h3><ul><li><p>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 notebook.</p></li><li><p>Documenter style markdown math</p><pre><code class="language-none">```math
\int f dx \int f dx
```</code></pre><p>is replaced with notebook compatible</p><pre><code class="language-none">\begin{equation} ```</code></pre><p>is replaced with notebook compatible</p><pre><code class="language-none">\begin{equation}
\int f dx \int f dx
\end{equation}</code></pre></li></ul><h3><a class="nav-anchor" id="[Literate.script](@ref):-1" href="#[Literate.script](@ref):-1"><a href="outputformats.html#Literate.script"><code>Literate.script</code></a>:</a></h3><ul><li><p>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.</p></li></ul><footer><hr/><a class="previous" href="customprocessing.html"><span class="direction">Previous</span><span class="title"><strong>5.</strong> Custom pre- and post-processing</span></a><a class="next" href="generated/example.html"><span class="direction">Next</span><span class="title"><strong>7.</strong> Example</span></a></footer></article></body></html> \end{equation}</code></pre></li></ul><h3><a class="nav-anchor" href="#[Literate.script](@ref):-1" id="[Literate.script](@ref):-1"></a><a href="outputformats.html#Literate.script"><code>Literate.script</code></a>:</h3><ul><li><p>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.</p></li></ul><footer><hr/><a class="previous" href="customprocessing.html"><span class="direction">Previous</span><span class="title"><strong>5.</strong> Custom pre- and post-processing</span></a><a class="next" href="generated/example.html"><span class="direction">Next</span><span class="title"><strong>7.</strong> Example</span></a></footer></article></body></HTML>

49
v0.2.2/fileformat.html

@ -1,5 +1,46 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>2. File Format · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>2. File Format · Literate.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>Literate.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 class="current"><a class="toctext" href="fileformat.html"><strong>2.</strong> File Format</a><ul class="internal"><li><a class="toctext" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></li><li><a class="toctext" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</a></li><li><a class="toctext" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></li></ul></li><li><a class="toctext" href="pipeline.html"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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="fileformat.html"><strong>2.</strong> File Format</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/fileformat.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>2. File Format</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="**2.**-File-Format-1" href="#**2.**-File-Format-1"><strong>2.</strong> File Format</a></h1><p>The source file format for Literate is a regular, commented, julia (<code>.jl</code>) scripts. The idea is that the scripts also serve as documentation on their own and it is also simple to include them in the test-suite, with e.g. <code>include</code>, to make sure the examples stay up do date with other changes in your package.</p><h2><a class="nav-anchor" id="Syntax-1" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></h2><p>The basic syntax is simple:</p><ul><li><p>lines starting with <code>#</code> are treated as markdown,</p></li><li><p>all other lines are treated as julia code.</p></li></ul><p>Leading whitespace is allowed before <code>#</code>, but it will be removed when generating the output. Since <code>#</code>-lines is treated as markdown we can not use that for regular julia comments, for this you can instead use <code>##</code>, which will render as <code>#</code> in the output.</p><p>Lets look at a simple example:</p><pre><code class="language-julia"># # Rational numbers const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="index.html"><strong>1.</strong> Introduction</a></li><li class="current"><a class="toctext" href="fileformat.html"><strong>2.</strong> File Format</a><ul class="internal"><li><a class="toctext" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></li><li><a class="toctext" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</a></li><li><a class="toctext" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></li></ul></li><li><a class="toctext" href="pipeline.html"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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="fileformat.html"><strong>2.</strong> File Format</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/fileformat.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>2. File Format</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#**2.**-File-Format-1" id="**2.**-File-Format-1"><strong>2.</strong> File Format</a></h1><p>The source file format for Literate is a regular, commented, julia (<code>.jl</code>) scripts. The idea is that the scripts also serve as documentation on their own and it is also simple to include them in the test-suite, with e.g. <code>include</code>, to make sure the examples stay up do date with other changes in your package.</p><h2><a class="nav-anchor" href="#Syntax-1" id="Syntax-1"><strong>2.1.</strong> Syntax</a></h2><p>The basic syntax is simple:</p><ul><li><p>lines starting with <code>#</code> are treated as markdown,</p></li><li><p>all other lines are treated as julia code.</p></li></ul><p>Leading whitespace is allowed before <code>#</code>, but it will be removed when generating the output. Since <code>#</code>-lines is treated as markdown we can not use that for regular julia comments, for this you can instead use <code>##</code>, which will render as <code>#</code> in the output.</p><p>Lets look at a simple example:</p><pre><code class="language-julia"># # Rational numbers
# #
# In julia rational numbers can be constructed with the `//` operator. # In julia rational numbers can be constructed with the `//` operator.
# Lets define two rational numbers, `x` and `y`: # Lets define two rational numbers, `x` and `y`:
@ -9,9 +50,9 @@ y = 2//5
# When adding `x` and `y` together we obtain a new rational number: # When adding `x` and `y` together we obtain a new rational number:
z = x + y</code></pre><p>In the lines starting with <code>#</code> we can use regular markdown syntax, for example the <code>#</code> used for the heading and the backticks for formatting code. The other lines are regular julia code. We note a couple of things:</p><ul><li><p>The script is valid julia, which means that we can <code>include</code> it and the example will run (for example in the <code>test/runtests.jl</code> script, to include the example in the test suite).</p></li><li><p>The script is &quot;self-explanatory&quot;, i.e. the markdown lines works as comments and thus serve as good documentation on its own.</p></li></ul><p>For simple use this is all you need to know. The following additional special syntax can also be used:</p><ul><li><p><code>#md</code>, <code>#nb</code>, <code>#jl</code>, <code>#src</code>: tags to filter lines, see <a href="fileformat.html#Filtering-Lines-1">Filtering Lines</a>,</p></li><li><p><code>#-</code>: tag to manually control chunk-splits, see <a href="pipeline.html#Custom-control-over-chunk-splits-1">Custom control over chunk splits</a>.</p></li></ul><p>There is also some default convenience replacements that will always be performed, see <a href="fileformat.html#Default-Replacements-1">Default Replacements</a>.</p><h2><a class="nav-anchor" id="Filtering-Lines-1" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</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 &quot;tokens&quot; that can be used to mark the purpose of certain lines:</p><ul><li><p><code>#md</code>: line exclusive to markdown output,</p></li><li><p><code>#nb</code>: line exclusive to notebook output,</p></li><li><p><code>#jl</code>: line exclusive to script output,</p></li><li><p><code>#src</code>: line exclusive to the source code and thus filtered out unconditionally.</p></li></ul><p>Lines <em>starting</em> with one of these tokens are filtered out in the <a href="pipeline.html#Pre-processing-1">preprocessing step</a>.</p><p>Suppose, for example, that we want to include a docstring within a <code>@docs</code> block using Documenter. Obviously we don&#39;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><code class="language-julia">#md # ```@docs z = x + y</code></pre><p>In the lines starting with <code>#</code> we can use regular markdown syntax, for example the <code>#</code> used for the heading and the backticks for formatting code. The other lines are regular julia code. We note a couple of things:</p><ul><li><p>The script is valid julia, which means that we can <code>include</code> it and the example will run (for example in the <code>test/runtests.jl</code> script, to include the example in the test suite).</p></li><li><p>The script is "self-explanatory", i.e. the markdown lines works as comments and thus serve as good documentation on its own.</p></li></ul><p>For simple use this is all you need to know. The following additional special syntax can also be used:</p><ul><li><p><code>#md</code>, <code>#nb</code>, <code>#jl</code>, <code>#src</code>: tags to filter lines, see <a href="fileformat.html#Filtering-Lines-1">Filtering Lines</a>,</p></li><li><p><code>#-</code>: tag to manually control chunk-splits, see <a href="pipeline.html#Custom-control-over-chunk-splits-1">Custom control over chunk splits</a>.</p></li></ul><p>There is also some default convenience replacements that will always be performed, see <a href="fileformat.html#Default-Replacements-1">Default Replacements</a>.</p><h2><a class="nav-anchor" href="#Filtering-Lines-1" id="Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</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><p><code>#md</code>: line exclusive to markdown output,</p></li><li><p><code>#nb</code>: line exclusive to notebook output,</p></li><li><p><code>#jl</code>: line exclusive to script output,</p></li><li><p><code>#src</code>: line exclusive to the source code and thus filtered out unconditionally.</p></li></ul><p>Lines <em>starting</em> with one of these tokens are filtered out in the <a href="pipeline.html#Pre-processing-1">preprocessing step</a>.</p><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><code class="language-julia">#md # ```@docs
#md # Literate.markdown #md # Literate.markdown
#md # Literate.notebook #md # Literate.notebook
#md # Literate.markdown #md # Literate.markdown
#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 simple 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><code class="language-julia">using Test #src #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 simple 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><code class="language-julia">using Test #src
@test result == expected_result #src</code></pre><h2><a class="nav-anchor" id="Default-Replacements-1" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></h2><p>The following convenience &quot;macros&quot; are always expanded:</p><ul><li><p><code>@__NAME__</code></p><p>expands to the <code>name</code> keyword argument to <a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#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>expands to <code>https://github.com/$(ENV[&quot;TRAVIS_REPO_SLUG&quot;])/blob/master/</code> and is a convenient way to use when you want to link to files outside the doc-build directory. For example <code>@__REPO__ROOT_URL__src/Literate.jl</code> would link to the source of the Literate module.</p></li><li><p><code>@__NBVIEWER_ROOT_URL__</code></p><p>expands to <code>https://nbviewer.jupyter.org/github/$(ENV[&quot;TRAVIS_REPO_SLUG&quot;])/blob/gh-pages/$(folder)/</code> where <code>folder</code> is the folder that <code>Documenter.deploydocs</code> deploys too. This can be used if you want a link that opens the generated notebook in <a href="http://nbviewer.jupyter.org/">http://nbviewer.jupyter.org/</a>.</p></li></ul><footer><hr/><a class="previous" href="index.html"><span class="direction">Previous</span><span class="title"><strong>1.</strong> Introduction</span></a><a class="next" href="pipeline.html"><span class="direction">Next</span><span class="title"><strong>3.</strong> Processing pipeline</span></a></footer></article></body></html> @test result == expected_result #src</code></pre><h2><a class="nav-anchor" href="#Default-Replacements-1" id="Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></h2><p>The following convenience "macros" are always expanded:</p><ul><li><p><code>@__NAME__</code></p><p>expands to the <code>name</code> keyword argument to <a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#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>expands to <code>https://github.com/$(ENV["TRAVIS_REPO_SLUG"])/blob/master/</code> and is a convenient way to use when you want to link to files outside the doc-build directory. For example <code>@__REPO__ROOT_URL__src/Literate.jl</code> would link to the source of the Literate module.</p></li><li><p><code>@__NBVIEWER_ROOT_URL__</code></p><p>expands to <code>https://nbviewer.jupyter.org/github/$(ENV["TRAVIS_REPO_SLUG"])/blob/gh-pages/$(folder)/</code> where <code>folder</code> is the folder that <code>Documenter.deploydocs</code> deploys too. This can be used if you want a link that opens the generated notebook in <a href="http://nbviewer.jupyter.org/">http://nbviewer.jupyter.org/</a>.</p></li></ul><footer><hr/><a class="previous" href="index.html"><span class="direction">Previous</span><span class="title"><strong>1.</strong> Introduction</span></a><a class="next" href="pipeline.html"><span class="direction">Next</span><span class="title"><strong>3.</strong> Processing pipeline</span></a></footer></article></body></HTML>

188
v0.2.2/generated/example.html

@ -1,7 +1,48 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>7. Example · Literate.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 data-main="../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>7. Example · Literate.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>Literate.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><a class="toctext" href="../outputformats.html"><strong>4.</strong> Output Formats</a></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 class="current"><a class="toctext" href="example.html"><strong>7.</strong> Example</a><ul class="internal"></ul></li></ul></nav><article id="docs"><header><nav><ul><li><a href="example.html"><strong>7.</strong> Example</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>7. Example</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="**7.**-Example-1" href="#**7.**-Example-1"><strong>7.</strong> Example</a></h1><p>This is an example generated with Literate based on this source file: <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><code>example.jl</code></a>. You are seeing the html-output which Documenter have generated based on a markdown file generated with Literate. The corresponding notebook can be found here: <a href="https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v0.2.2/generated/example.ipynb"><code>example.ipynb</code></a>, and the plain script output can be found here: <a href="example.jl"><code>example.jl</code></a>.</p><p>It is recommended to have the <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl">source file</a> available when reading this, to better understand how the syntax in the source file corresponds to the output you are seeing.</p><h3><a class="nav-anchor" id="Basic-syntax-1" href="#Basic-syntax-1">Basic syntax</a></h3><p>The basic syntax for Literate is simple, lines starting with <code>#</code> is interpreted as markdown, and all the other lines are interpreted as code. Here is some code:</p><div><pre><code class="language-julia">x = 1//3 const head = document.getElementsByTagName('head')[0];
y = 2//5</code></pre><pre><code class="language-none">2//5</code></pre></div><p>In markdown sections we can use markdown syntax. For example, we can write <em>text in italic font</em>, <strong>text in bold font</strong> and use <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">links</a>.</p><p>It is possible to filter out lines depending on the output using the <code>#md</code>, <code>#nb</code>, <code>#jl</code> and <code>#src</code> tags (see <a href="../fileformat.html#Filtering-Lines-1">Filtering Lines</a>):</p><ul><li><p>This line starts with <code>#md</code> and is thus only visible in the markdown output.</p></li></ul><p>The source file is parsed in chunks of markdown and code. Starting a line with <code>#-</code> manually inserts a chunk break. For example, if we want to display the output of the following operations we may insert <code>#-</code> in between. These two code blocks will now end up in different <code>@example</code>-blocks in the markdown output, and two different notebook cells in the notebook output.</p><div><pre><code class="language-julia">x + y</code></pre><pre><code class="language-none">11//15</code></pre></div><div><pre><code class="language-julia">x * y</code></pre><pre><code class="language-none">2//15</code></pre></div><h3><a class="nav-anchor" id="Output-Capturing-1" href="#Output-Capturing-1">Output Capturing</a></h3><p>Code chunks are by default placed in Documenter <code>@example</code> blocks in the generated markdown. This means that the output will be captured in a block when Documenter is building the docs. In notebooks the output is captured in output cells, if the <code>execute</code> keyword argument is set to true. Output to <code>stdout</code>/<code>stderr</code> is also captured.</p><div><pre><code class="language-julia">function foo()
println(&quot;This string is printed to stdout.&quot;) // Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="../search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="../outputformats.html"><strong>4.</strong> Output Formats</a></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 class="current"><a class="toctext" href="example.html"><strong>7.</strong> Example</a><ul class="internal"></ul></li></ul></nav><article id="docs"><header><nav><ul><li><a href="example.html"><strong>7.</strong> Example</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>7. Example</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#**7.**-Example-1" id="**7.**-Example-1"><strong>7.</strong> Example</a></h1><p>This is an example generated with Literate based on this source file: <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><code>example.jl</code></a>. You are seeing the html-output which Documenter have generated based on a markdown file generated with Literate. The corresponding notebook can be found here: <a href="https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v0.2.2/generated/example.ipynb"><code>example.ipynb</code></a>, and the plain script output can be found here: <a href="example.jl"><code>example.jl</code></a>.</p><p>It is recommended to have the <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl">source file</a> available when reading this, to better understand how the syntax in the source file corresponds to the output you are seeing.</p><h3><a class="nav-anchor" href="#Basic-syntax-1" id="Basic-syntax-1">Basic syntax</a></h3><p>The basic syntax for Literate is simple, lines starting with <code>#</code> is interpreted as markdown, and all the other lines are interpreted as code. Here is some code:</p><div><pre><code class="language-julia">x = 1//3
y = 2//5</code></pre><pre><code class="language-none">2//5</code></pre></div><p>In markdown sections we can use markdown syntax. For example, we can write <em>text in italic font</em>, <strong>text in bold font</strong> and use <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">links</a>.</p><p>It is possible to filter out lines depending on the output using the <code>#md</code>, <code>#nb</code>, <code>#jl</code> and <code>#src</code> tags (see <a href="../fileformat.html#Filtering-Lines-1">Filtering Lines</a>):</p><ul><li><p>This line starts with <code>#md</code> and is thus only visible in the markdown output.</p></li></ul><p>The source file is parsed in chunks of markdown and code. Starting a line with <code>#-</code> manually inserts a chunk break. For example, if we want to display the output of the following operations we may insert <code>#-</code> in between. These two code blocks will now end up in different <code>@example</code>-blocks in the markdown output, and two different notebook cells in the notebook output.</p><div><pre><code class="language-julia">x + y</code></pre><pre><code class="language-none">11//15</code></pre></div><div><pre><code class="language-julia">x * y</code></pre><pre><code class="language-none">2//15</code></pre></div><h3><a class="nav-anchor" href="#Output-Capturing-1" id="Output-Capturing-1">Output Capturing</a></h3><p>Code chunks are by default placed in Documenter <code>@example</code> blocks in the generated markdown. This means that the output will be captured in a block when Documenter is building the docs. In notebooks the output is captured in output cells, if the <code>execute</code> keyword argument is set to true. Output to <code>stdout</code>/<code>stderr</code> is also captured.</p><div><pre><code class="language-julia">function foo()
println("This string is printed to stdout.")
return [1, 2, 3, 4] return [1, 2, 3, 4]
end end
@ -10,121 +51,55 @@ foo()</code></pre><pre><code class="language-none">This string is printed to std
1 1
2 2
3 3
4</code></pre></div><p>Both Documenter&#39;s <code>@example</code> block and notebooks can display images. Here is an example where we generate a simple plot using the <a href="https://github.com/JuliaPlots/Plots.jl">Plots.jl</a> package</p><div><pre><code class="language-julia">using Plots 4</code></pre></div><p>Both Documenter's <code>@example</code> block and notebooks can display images. Here is an example where we generate a simple plot using the <a href="https://github.com/JuliaPlots/Plots.jl">Plots.jl</a> package</p><div><pre><code class="language-julia">using Plots
x = linspace(0, 6π, 1000) x = linspace(0, 6π, 1000)
y1 = sin.(x) y1 = sin.(x)
y2 = cos.(x) y2 = cos.(x)
plot(x, [y1, y2])</code></pre><?xml version="1.0" encoding="utf-8"?> plot(x, [y1, y2])</code></pre><svg height="400" viewBox="0 0 600 400" width="600" xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"><defs><clipPath id="clip0100"><rect height="400" width="600" x="0" y="0"></rect></clipPath></defs><polygon clip-path="url(#clip0100)" fill="#ffffff" fill-opacity="1" points="
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="600" height="400" viewBox="0 0 600 400">
<defs>
<clipPath id="clip0100">
<rect x="0" y="0" width="600" height="400"/>
</clipPath>
</defs>
<polygon clip-path="url(#clip0100)" points="
0,400 600,400 600,0 0,0 0,400 600,400 600,0 0,0
" fill="#ffffff" fill-opacity="1"/> "></polygon><defs><clipPath id="clip0101"><rect height="400" width="421" x="120" y="0"></rect></clipPath></defs><polygon clip-path="url(#clip0100)" fill="#ffffff" fill-opacity="1" points="
<defs>
<clipPath id="clip0101">
<rect x="120" y="0" width="421" height="400"/>
</clipPath>
</defs>
<polygon clip-path="url(#clip0100)" points="
23.622,384.252 580.315,384.252 580.315,11.811 23.622,11.811 23.622,384.252 580.315,384.252 580.315,11.811 23.622,11.811
" fill="#ffffff" fill-opacity="1"/> "></polygon><defs><clipPath id="clip0102"><rect height="373" width="558" x="23" y="11"></rect></clipPath></defs><polyline clip-path="url(#clip0102)" points="
<defs>
<clipPath id="clip0102">
<rect x="23" y="11" width="558" height="373"/>
</clipPath>
</defs>
<polyline clip-path="url(#clip0102)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
39.3775,384.252 39.3775,11.811 39.3775,384.252 39.3775,11.811
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip0102)" points="
<polyline clip-path="url(#clip0102)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
178.686,384.252 178.686,11.811 178.686,384.252 178.686,11.811
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip0102)" points="
<polyline clip-path="url(#clip0102)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
317.995,384.252 317.995,11.811 317.995,384.252 317.995,11.811
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip0102)" points="
<polyline clip-path="url(#clip0102)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
457.304,384.252 457.304,11.811 457.304,384.252 457.304,11.811
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip0102)" points="
<polyline clip-path="url(#clip0102)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
23.622,373.713 580.315,373.713 23.622,373.713 580.315,373.713
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip0102)" points="
<polyline clip-path="url(#clip0102)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
23.622,285.873 580.315,285.873 23.622,285.873 580.315,285.873
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip0102)" points="
<polyline clip-path="url(#clip0102)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
23.622,198.032 580.315,198.032 23.622,198.032 580.315,198.032
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip0102)" points="
<polyline clip-path="url(#clip0102)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
23.622,110.192 580.315,110.192 23.622,110.192 580.315,110.192
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip0102)" points="
<polyline clip-path="url(#clip0102)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
23.622,22.3518 580.315,22.3518 23.622,22.3518 580.315,22.3518
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip0100)" points="
<polyline clip-path="url(#clip0100)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,384.252 580.315,384.252 23.622,384.252 580.315,384.252
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip0100)" points="
<polyline clip-path="url(#clip0100)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,384.252 23.622,11.811 23.622,384.252 23.622,11.811
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip0100)" points="
<polyline clip-path="url(#clip0100)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
39.3775,384.252 39.3775,378.665 39.3775,384.252 39.3775,378.665
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip0100)" points="
<polyline clip-path="url(#clip0100)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
178.686,384.252 178.686,378.665 178.686,384.252 178.686,378.665
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip0100)" points="
<polyline clip-path="url(#clip0100)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
317.995,384.252 317.995,378.665 317.995,384.252 317.995,378.665
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip0100)" points="
<polyline clip-path="url(#clip0100)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
457.304,384.252 457.304,378.665 457.304,384.252 457.304,378.665
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip0100)" points="
<polyline clip-path="url(#clip0100)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,373.713 31.9724,373.713 23.622,373.713 31.9724,373.713
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip0100)" points="
<polyline clip-path="url(#clip0100)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,285.873 31.9724,285.873 23.622,285.873 31.9724,285.873
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip0100)" points="
<polyline clip-path="url(#clip0100)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,198.032 31.9724,198.032 23.622,198.032 31.9724,198.032
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip0100)" points="
<polyline clip-path="url(#clip0100)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,110.192 31.9724,110.192 23.622,110.192 31.9724,110.192
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip0100)" points="
<polyline clip-path="url(#clip0100)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,22.3518 31.9724,22.3518 23.622,22.3518 31.9724,22.3518
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><g clip-path="url(#clip0100)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 39.3775, 398.052)" x="39.3775" y="398.052">0</text></g><g clip-path="url(#clip0100)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 178.686, 398.052)" x="178.686" y="398.052">5</text></g><g clip-path="url(#clip0100)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 317.995, 398.052)" x="317.995" y="398.052">10</text></g><g clip-path="url(#clip0100)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 457.304, 398.052)" x="457.304" y="398.052">15</text></g><g clip-path="url(#clip0100)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 378.213)" x="17.622" y="378.213">-1.0</text></g><g clip-path="url(#clip0100)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 290.373)" x="17.622" y="290.373">-0.5</text></g><g clip-path="url(#clip0100)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 202.532)" x="17.622" y="202.532">0.0</text></g><g clip-path="url(#clip0100)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 114.692)" x="17.622" y="114.692">0.5</text></g><g clip-path="url(#clip0100)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 26.8518)" x="17.622" y="26.8518">1.0</text></g><polyline clip-path="url(#clip0102)" points="
<g clip-path="url(#clip0100)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 39.3775, 398.052)" x="39.3775" y="398.052">0</text>
</g>
<g clip-path="url(#clip0100)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 178.686, 398.052)" x="178.686" y="398.052">5</text>
</g>
<g clip-path="url(#clip0100)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 317.995, 398.052)" x="317.995" y="398.052">10</text>
</g>
<g clip-path="url(#clip0100)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 457.304, 398.052)" x="457.304" y="398.052">15</text>
</g>
<g clip-path="url(#clip0100)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 378.213)" x="17.622" y="378.213">-1.0</text>
</g>
<g clip-path="url(#clip0100)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 290.373)" x="17.622" y="290.373">-0.5</text>
</g>
<g clip-path="url(#clip0100)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 202.532)" x="17.622" y="202.532">0.0</text>
</g>
<g clip-path="url(#clip0100)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 114.692)" x="17.622" y="114.692">0.5</text>
</g>
<g clip-path="url(#clip0100)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 26.8518)" x="17.622" y="26.8518">1.0</text>
</g>
<polyline clip-path="url(#clip0102)" style="stroke:#009af9; stroke-width:1; stroke-opacity:1; fill:none" points="
39.3775,198.032 39.9032,194.718 40.4289,191.404 40.9546,188.093 41.4803,184.786 42.006,181.483 42.5318,178.186 43.0575,174.896 43.5832,171.615 44.1089,168.342 39.3775,198.032 39.9032,194.718 40.4289,191.404 40.9546,188.093 41.4803,184.786 42.006,181.483 42.5318,178.186 43.0575,174.896 43.5832,171.615 44.1089,168.342
44.6346,165.081 45.1603,161.831 45.686,158.594 46.2117,155.371 46.7374,152.163 47.2631,148.971 47.7888,145.797 48.3145,142.642 48.8402,139.506 49.366,136.391 44.6346,165.081 45.1603,161.831 45.686,158.594 46.2117,155.371 46.7374,152.163 47.2631,148.971 47.7888,145.797 48.3145,142.642 48.8402,139.506 49.366,136.391
49.8917,133.298 50.4174,130.229 50.9431,127.183 51.4688,124.162 51.9945,121.168 52.5202,118.201 53.0459,115.263 53.5716,112.354 54.0973,109.475 54.623,106.629 49.8917,133.298 50.4174,130.229 50.9431,127.183 51.4688,124.162 51.9945,121.168 52.5202,118.201 53.0459,115.263 53.5716,112.354 54.0973,109.475 54.623,106.629
@ -226,8 +201,7 @@ plot(x, [y1, y2])</code></pre><?xml version="1.0" encoding="utf-8"?>
554.571,259.674 555.097,256.559 555.622,253.423 556.148,250.268 556.674,247.094 557.2,243.902 557.725,240.694 558.251,237.471 558.777,234.234 559.302,230.984 554.571,259.674 555.097,256.559 555.622,253.423 556.148,250.268 556.674,247.094 557.2,243.902 557.725,240.694 558.251,237.471 558.777,234.234 559.302,230.984
559.828,227.723 560.354,224.45 560.88,221.169 561.405,217.879 561.931,214.582 562.457,211.279 562.982,207.972 563.508,204.661 564.034,201.347 564.56,198.032 559.828,227.723 560.354,224.45 560.88,221.169 561.405,217.879 561.931,214.582 562.457,211.279 562.982,207.972 563.508,204.661 564.034,201.347 564.56,198.032
"/> " style="stroke:#009af9; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip0102)" points="
<polyline clip-path="url(#clip0102)" style="stroke:#e26f46; stroke-width:1; stroke-opacity:1; fill:none" points="
39.3775,22.3518 39.9032,22.3831 40.4289,22.4769 40.9546,22.6332 41.4803,22.8519 42.006,23.133 42.5318,23.4764 43.0575,23.8819 43.5832,24.3495 44.1089,24.8788 39.3775,22.3518 39.9032,22.3831 40.4289,22.4769 40.9546,22.6332 41.4803,22.8519 42.006,23.133 42.5318,23.4764 43.0575,23.8819 43.5832,24.3495 44.1089,24.8788
44.6346,25.4698 45.1603,26.1222 45.686,26.8359 46.2117,27.6104 46.7374,28.4457 47.2631,29.3413 47.7888,30.297 48.3145,31.3124 48.8402,32.3871 49.366,33.5209 44.6346,25.4698 45.1603,26.1222 45.686,26.8359 46.2117,27.6104 46.7374,28.4457 47.2631,29.3413 47.7888,30.297 48.3145,31.3124 48.8402,32.3871 49.366,33.5209
49.8917,34.7131 50.4174,35.9636 50.9431,37.2717 51.4688,38.637 51.9945,40.0591 52.5202,41.5375 53.0459,43.0715 53.5716,44.6608 54.0973,46.3046 54.623,48.0024 49.8917,34.7131 50.4174,35.9636 50.9431,37.2717 51.4688,38.637 51.9945,40.0591 52.5202,41.5375 53.0459,43.0715 53.5716,44.6608 54.0973,46.3046 54.623,48.0024
@ -329,24 +303,12 @@ plot(x, [y1, y2])</code></pre><?xml version="1.0" encoding="utf-8"?>
554.571,33.5209 555.097,32.3871 555.622,31.3124 556.148,30.297 556.674,29.3413 557.2,28.4457 557.725,27.6104 558.251,26.8359 558.777,26.1222 559.302,25.4698 554.571,33.5209 555.097,32.3871 555.622,31.3124 556.148,30.297 556.674,29.3413 557.2,28.4457 557.725,27.6104 558.251,26.8359 558.777,26.1222 559.302,25.4698
559.828,24.8788 560.354,24.3495 560.88,23.8819 561.405,23.4764 561.931,23.133 562.457,22.8519 562.982,22.6332 563.508,22.4769 564.034,22.3831 564.56,22.3518 559.828,24.8788 560.354,24.3495 560.88,23.8819 561.405,23.4764 561.931,23.133 562.457,22.8519 562.982,22.6332 563.508,22.4769 564.034,22.3831 564.56,22.3518
"/> " style="stroke:#e26f46; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polygon clip-path="url(#clip0100)" fill="#ffffff" fill-opacity="1" points="
<polygon clip-path="url(#clip0100)" points="
489.608,78.051 562.315,78.051 562.315,32.691 489.608,32.691 489.608,78.051 562.315,78.051 562.315,32.691 489.608,32.691
" fill="#ffffff" fill-opacity="1"/> "></polygon><polyline clip-path="url(#clip0100)" points="
<polyline clip-path="url(#clip0100)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
489.608,78.051 562.315,78.051 562.315,32.691 489.608,32.691 489.608,78.051 489.608,78.051 562.315,78.051 562.315,32.691 489.608,32.691 489.608,78.051
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip0100)" points="
<polyline clip-path="url(#clip0100)" style="stroke:#009af9; stroke-width:1; stroke-opacity:1; fill:none" points="
495.608,47.811 531.608,47.811 495.608,47.811 531.608,47.811
"/> " style="stroke:#009af9; stroke-width:1; stroke-opacity:1; fill:none"></polyline><g clip-path="url(#clip0100)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:start;" transform="rotate(0, 537.608, 52.311)" x="537.608" y="52.311">y1</text></g><polyline clip-path="url(#clip0100)" points="
<g clip-path="url(#clip0100)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:start;" transform="rotate(0, 537.608, 52.311)" x="537.608" y="52.311">y1</text>
</g>
<polyline clip-path="url(#clip0100)" style="stroke:#e26f46; stroke-width:1; stroke-opacity:1; fill:none" points="
495.608,62.931 531.608,62.931 495.608,62.931 531.608,62.931
"/> " style="stroke:#e26f46; stroke-width:1; stroke-opacity:1; fill:none"></polyline><g clip-path="url(#clip0100)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:start;" transform="rotate(0, 537.608, 67.431)" x="537.608" y="67.431">y2</text></g></svg></div><h3><a class="nav-anchor" href="#Custom-processing-1" id="Custom-processing-1">Custom processing</a></h3><p>It is possible to give Literate custom pre- and post-processing functions. For example, here we insert two placeholders, which we will replace with something else at time of generation. We have here replaced our placeholders with <code>z</code> and <code>1.0 + 2.0im</code>:</p><div><pre><code class="language-julia">z = 1.0 + 2.0im</code></pre><pre><code class="language-none">1.0 + 2.0im</code></pre></div><h3><a class="nav-anchor" href="#documenter-interaction-1" id="documenter-interaction-1">Documenter.jl interaction</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, <a href="example.html#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><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p><footer><hr/><a class="previous" href="../documenter.html"><span class="direction">Previous</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></HTML>
<g clip-path="url(#clip0100)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:start;" transform="rotate(0, 537.608, 67.431)" x="537.608" y="67.431">y2</text>
</g>
</svg>
</div><h3><a class="nav-anchor" id="Custom-processing-1" href="#Custom-processing-1">Custom processing</a></h3><p>It is possible to give Literate custom pre- and post-processing functions. For example, here we insert two placeholders, which we will replace with something else at time of generation. We have here replaced our placeholders with <code>z</code> and <code>1.0 + 2.0im</code>:</p><div><pre><code class="language-julia">z = 1.0 + 2.0im</code></pre><pre><code class="language-none">1.0 + 2.0im</code></pre></div><h3><a class="nav-anchor" id="documenter-interaction-1" href="#documenter-interaction-1">Documenter.jl interaction</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, <a href="example.html#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><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p><footer><hr/><a class="previous" href="../documenter.html"><span class="direction">Previous</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></html>

45
v0.2.2/index.html

File diff suppressed because one or more lines are too long

53
v0.2.2/outputformats.html

File diff suppressed because one or more lines are too long

51
v0.2.2/pipeline.html

File diff suppressed because one or more lines are too long

45
v0.2.2/search.html

@ -1,2 +1,43 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>Search · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Search · Literate.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>Literate.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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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><header><nav><ul><li>Search</li></ul></nav><hr/><div id="topbar"><span>Search</span><a class="fa fa-bars" href="#"></a></div></header><h1>Search</h1><p id="search-info">Number of results: <span id="search-results-number">loading...</span></p><ul id="search-results"></ul></article></body><script src="search_index.js"></script><script src="assets/search.js"></script></html> const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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><header><nav><ul><li>Search</li></ul></nav><hr/><div id="topbar"><span>Search</span><a class="fa fa-bars" href="#"></a></div></header><h1>Search</h1><p id="search-info">Number of results: <span id="search-results-number">loading...</span></p><ul id="search-results"></ul></article><script src="search_index.js"></script><script src="assets/search.js"></script></body></HTML>

49
v0.3.0/customprocessing.html

@ -1,8 +1,49 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>5. Custom pre- and post-processing · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>5. Custom pre- and post-processing · Literate.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>Literate.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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li class="current"><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a><ul class="internal"></ul></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="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/customprocessing.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>5. Custom pre- and post-processing</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Custom-pre-and-post-processing-1" href="#Custom-pre-and-post-processing-1"><strong>5.</strong> Custom pre- and post-processing</a></h1><p>Since all packages are different, and may have different demands on how to create a nice example for the documentation it is important that the package maintainer does not feel limited by the by default provided syntax that this package offers. While you can generally come a long way by utilizing <a href="fileformat.html#Filtering-Lines-1">line filtering</a> there might be situations where you need to manually hook into the generation and change things. In Literate this is done by letting the user supply custom pre- and post-processing functions that may do transformation of the content.</p><p>All of the generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) accepts <code>preprocess</code> and <code>postprocess</code> keyword arguments. The default &quot;transformation&quot; is the <code>identity</code> function. The input to the transformation functions is a <code>String</code>, and the output should be the transformed <code>String</code>.</p><p><code>preprocess</code> is sent the raw input that is read from the source file (<a href="pipeline.html#Pre-processing-1">modulo the default line ending transformation</a>). <code>postprocess</code> is given different things depending on the output: For markdown and script output <code>postprocess</code> is given the content <code>String</code> just before writing it to the output file, but for notebook output <code>postprocess</code> is given the dictionary representing the notebook, since, in general, this is more useful.</p><p>As an example, lets say we want to splice the date of generation into the output. We could of course update our source file before generating the docs, but we could instead use a <code>preprocess</code> function that splices the date into the source for us. Consider the following source file:</p><pre><code class="language-julia"># # Example const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li class="current"><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a><ul class="internal"></ul></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="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/customprocessing.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>5. Custom pre- and post-processing</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#Custom-pre-and-post-processing-1" id="Custom-pre-and-post-processing-1"><strong>5.</strong> Custom pre- and post-processing</a></h1><p>Since all packages are different, and may have different demands on how to create a nice example for the documentation it is important that the package maintainer does not feel limited by the by default provided syntax that this package offers. While you can generally come a long way by utilizing <a href="fileformat.html#Filtering-Lines-1">line filtering</a> there might be situations where you need to manually hook into the generation and change things. In Literate this is done by letting the user supply custom pre- and post-processing functions that may do transformation of the content.</p><p>All of the generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) accepts <code>preprocess</code> and <code>postprocess</code> keyword arguments. The default "transformation" is the <code>identity</code> function. The input to the transformation functions is a <code>String</code>, and the output should be the transformed <code>String</code>.</p><p><code>preprocess</code> is sent the raw input that is read from the source file (<a href="pipeline.html#Pre-processing-1">modulo the default line ending transformation</a>). <code>postprocess</code> is given different things depending on the output: For markdown and script output <code>postprocess</code> is given the content <code>String</code> just before writing it to the output file, but for notebook output <code>postprocess</code> is given the dictionary representing the notebook, since, in general, this is more useful.</p><p>As an example, lets say we want to splice the date of generation into the output. We could of course update our source file before generating the docs, but we could instead use a <code>preprocess</code> function that splices the date into the source for us. Consider the following source file:</p><pre><code class="language-julia"># # Example
# This example was generated DATEOFTODAY # This example was generated DATEOFTODAY
x = 1 // 3</code></pre><p>where <code>DATEOFTODAY</code> is a placeholder, to make it easier for our <code>preprocess</code> function to find the location. Now, lets define the <code>preprocess</code> function, for example</p><pre><code class="language-julia">function update_date(content) x = 1 // 3</code></pre><p>where <code>DATEOFTODAY</code> is a placeholder, to make it easier for our <code>preprocess</code> function to find the location. Now, lets define the <code>preprocess</code> function, for example</p><pre><code class="language-julia">function update_date(content)
content = replace(content, &quot;DATEOFTODAY&quot; =&gt; Date(now())) content = replace(content, "DATEOFTODAY" =&gt; Date(now()))
return content return content
end</code></pre><p>which would replace every occurrence of <code>&quot;DATEOFTODAY&quot;</code> with the current date. We would now simply give this function to the generator, for example:</p><pre><code class="language-julia">Literate.markdown(&quot;input.jl&quot;, &quot;outputdir&quot;; preprocess = update_date)</code></pre><footer><hr/><a class="previous" href="outputformats.html"><span class="direction">Previous</span><span class="title"><strong>4.</strong> Output Formats</span></a><a class="next" href="documenter.html"><span class="direction">Next</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></html> end</code></pre><p>which would replace every occurrence of <code>"DATEOFTODAY"</code> with the current date. We would now simply give this function to the generator, for example:</p><pre><code class="language-julia">Literate.markdown("input.jl", "outputdir"; preprocess = update_date)</code></pre><footer><hr/><a class="previous" href="outputformats.html"><span class="direction">Previous</span><span class="title"><strong>4.</strong> Output Formats</span></a><a class="next" href="documenter.html"><span class="direction">Next</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></HTML>

53
v0.3.0/documenter.html

@ -1,12 +1,53 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>6. Interaction with Documenter.jl · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>6. Interaction with Documenter.jl · Literate.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>Literate.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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li><li class="current"><a class="toctext" href="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a><ul class="internal"></ul></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="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/documenter.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>6. Interaction with Documenter.jl</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Interaction-with-Documenter-1" href="#Interaction-with-Documenter-1"><strong>6.</strong> Interaction with Documenter.jl</a></h1><p>Literate can be used for any purpose, it spits out regular markdown files, and notebooks. Typically, though, these files will be used to render documentation for your package. The generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) supports a keyword argument <code>documenter</code> that lets the generator perform some extra things, keeping in mind that the source code have been written with Documenter.jl in mind. So lets take a look at what will happen if we set <code>documenter = true</code>:</p><h3><a class="nav-anchor" id="[Literate.markdown](@ref):-1" href="#[Literate.markdown](@ref):-1"><a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>:</a></h3><ul><li>The default code fence will change from<pre><code class="language-none">```julia const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li><li class="current"><a class="toctext" href="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a><ul class="internal"></ul></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="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/documenter.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>6. Interaction with Documenter.jl</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#Interaction-with-Documenter-1" id="Interaction-with-Documenter-1"><strong>6.</strong> Interaction with Documenter.jl</a></h1><p>Literate can be used for any purpose, it spits out regular markdown files, and notebooks. Typically, though, these files will be used to render documentation for your package. The generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) supports a keyword argument <code>documenter</code> that lets the generator perform some extra things, keeping in mind that the source code have been written with Documenter.jl in mind. So lets take a look at what will happen if we set <code>documenter = true</code>:</p><h3><a class="nav-anchor" href="#[Literate.markdown](@ref):-1" id="[Literate.markdown](@ref):-1"></a><a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>:</h3><ul><li>The default code fence will change from<pre><code class="language-none">```julia
# code # code
```</code></pre>to Documenters <code>@example</code> blocks:<pre><code class="language-none">```@examples $(name) ```</code></pre>to Documenters <code>@example</code> blocks:<pre><code class="language-none">```@examples $(name)
# code # code
```</code></pre></li><li>The following <code>@meta</code> block will be added to the top of the markdown page, which redirects the &quot;Edit on GitHub&quot; link on the top of the page to the <em>source file</em> rather than the generated <code>.md</code> file:<pre><code class="language-none">```@meta ```</code></pre></li><li>The following <code>@meta</code> block will be added to the top of the markdown page, which redirects the "Edit on GitHub" link on the top of the page to the <em>source file</em> rather than the generated <code>.md</code> file:<pre><code class="language-none">```@meta
EditURL = &quot;$(relpath(inputfile, outputdir))&quot; EditURL = "$(relpath(inputfile, outputdir))"
```</code></pre></li></ul><h3><a class="nav-anchor" id="[Literate.notebook](@ref):-1" href="#[Literate.notebook](@ref):-1"><a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a>:</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 notebook.</li><li>Documenter style markdown math<pre><code class="language-none">```math ```</code></pre></li></ul><h3><a class="nav-anchor" href="#[Literate.notebook](@ref):-1" id="[Literate.notebook](@ref):-1"></a><a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></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 notebook.</li><li>Documenter style markdown math<pre><code class="language-none">```math
\int f dx \int f dx
```</code></pre>is replaced with notebook compatible<pre><code class="language-none">\begin{equation} ```</code></pre>is replaced with notebook compatible<pre><code class="language-none">\begin{equation}
\int f dx \int f dx
\end{equation}</code></pre></li></ul><h3><a class="nav-anchor" id="[Literate.script](@ref):-1" href="#[Literate.script](@ref):-1"><a href="outputformats.html#Literate.script"><code>Literate.script</code></a>:</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><footer><hr/><a class="previous" href="customprocessing.html"><span class="direction">Previous</span><span class="title"><strong>5.</strong> Custom pre- and post-processing</span></a><a class="next" href="generated/example.html"><span class="direction">Next</span><span class="title"><strong>7.</strong> Example</span></a></footer></article></body></html> \end{equation}</code></pre></li></ul><h3><a class="nav-anchor" href="#[Literate.script](@ref):-1" id="[Literate.script](@ref):-1"></a><a href="outputformats.html#Literate.script"><code>Literate.script</code></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><footer><hr/><a class="previous" href="customprocessing.html"><span class="direction">Previous</span><span class="title"><strong>5.</strong> Custom pre- and post-processing</span></a><a class="next" href="generated/example.html"><span class="direction">Next</span><span class="title"><strong>7.</strong> Example</span></a></footer></article></body></HTML>

49
v0.3.0/fileformat.html

@ -1,5 +1,46 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>2. File Format · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>2. File Format · Literate.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>Literate.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 class="current"><a class="toctext" href="fileformat.html"><strong>2.</strong> File Format</a><ul class="internal"><li><a class="toctext" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></li><li><a class="toctext" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</a></li><li><a class="toctext" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></li></ul></li><li><a class="toctext" href="pipeline.html"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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="fileformat.html"><strong>2.</strong> File Format</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/fileformat.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>2. File Format</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="**2.**-File-Format-1" href="#**2.**-File-Format-1"><strong>2.</strong> File Format</a></h1><p>The source file format for Literate is a regular, commented, julia (<code>.jl</code>) scripts. The idea is that the scripts also serve as documentation on their own and it is also simple to include them in the test-suite, with e.g. <code>include</code>, to make sure the examples stay up do date with other changes in your package.</p><h2><a class="nav-anchor" id="Syntax-1" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></h2><p>The basic syntax is simple:</p><ul><li>lines starting with <code>#</code> are treated as markdown,</li><li>all other lines are treated as julia code.</li></ul><p>Leading whitespace is allowed before <code>#</code>, but it will be removed when generating the output. Since <code>#</code>-lines is treated as markdown we can not use that for regular julia comments, for this you can instead use <code>##</code>, which will render as <code>#</code> in the output.</p><p>Lets look at a simple example:</p><pre><code class="language-julia"># # Rational numbers const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="index.html"><strong>1.</strong> Introduction</a></li><li class="current"><a class="toctext" href="fileformat.html"><strong>2.</strong> File Format</a><ul class="internal"><li><a class="toctext" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></li><li><a class="toctext" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</a></li><li><a class="toctext" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></li></ul></li><li><a class="toctext" href="pipeline.html"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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="fileformat.html"><strong>2.</strong> File Format</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/fileformat.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>2. File Format</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#**2.**-File-Format-1" id="**2.**-File-Format-1"><strong>2.</strong> File Format</a></h1><p>The source file format for Literate is a regular, commented, julia (<code>.jl</code>) scripts. The idea is that the scripts also serve as documentation on their own and it is also simple to include them in the test-suite, with e.g. <code>include</code>, to make sure the examples stay up do date with other changes in your package.</p><h2><a class="nav-anchor" href="#Syntax-1" id="Syntax-1"><strong>2.1.</strong> Syntax</a></h2><p>The basic syntax is simple:</p><ul><li>lines starting with <code>#</code> are treated as markdown,</li><li>all other lines are treated as julia code.</li></ul><p>Leading whitespace is allowed before <code>#</code>, but it will be removed when generating the output. Since <code>#</code>-lines is treated as markdown we can not use that for regular julia comments, for this you can instead use <code>##</code>, which will render as <code>#</code> in the output.</p><p>Lets look at a simple example:</p><pre><code class="language-julia"># # Rational numbers
# #
# In julia rational numbers can be constructed with the `//` operator. # In julia rational numbers can be constructed with the `//` operator.
# Lets define two rational numbers, `x` and `y`: # Lets define two rational numbers, `x` and `y`:
@ -9,9 +50,9 @@ y = 2//5
# When adding `x` and `y` together we obtain a new rational number: # When adding `x` and `y` together we obtain a new rational number:
z = x + y</code></pre><p>In the lines starting with <code>#</code> we can use regular markdown syntax, for example the <code>#</code> used for the heading and the backticks for formatting code. The other lines are regular julia code. We note a couple of things:</p><ul><li>The script is valid julia, which means that we can <code>include</code> it and the example will run (for example in the <code>test/runtests.jl</code> script, to include the example in the test suite).</li><li>The script is &quot;self-explanatory&quot;, i.e. the markdown lines works as comments and thus serve as good documentation on its own.</li></ul><p>For simple use this is all you need to know. The following additional special syntax can also be used:</p><ul><li><code>#md</code>, <code>#nb</code>, <code>#jl</code>, <code>#src</code>: tags to filter lines, see <a href="fileformat.html#Filtering-Lines-1">Filtering Lines</a>,</li><li><code>#-</code>: tag to manually control chunk-splits, see <a href="pipeline.html#Custom-control-over-chunk-splits-1">Custom control over chunk splits</a>.</li></ul><p>There is also some default convenience replacements that will always be performed, see <a href="fileformat.html#Default-Replacements-1">Default Replacements</a>.</p><h2><a class="nav-anchor" id="Filtering-Lines-1" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</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 &quot;tokens&quot; 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> with one of these tokens are filtered out in the <a href="pipeline.html#Pre-processing-1">preprocessing step</a>.</p><p>Suppose, for example, that we want to include a docstring within a <code>@docs</code> block using Documenter. Obviously we don&#39;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><code class="language-julia">#md # ```@docs z = x + y</code></pre><p>In the lines starting with <code>#</code> we can use regular markdown syntax, for example the <code>#</code> used for the heading and the backticks for formatting code. The other lines are regular julia code. We note a couple of things:</p><ul><li>The script is valid julia, which means that we can <code>include</code> it and the example will run (for example in the <code>test/runtests.jl</code> script, to include the example in the test suite).</li><li>The script is "self-explanatory", i.e. the markdown lines works as comments and thus serve as good documentation on its own.</li></ul><p>For simple use this is all you need to know. The following additional special syntax can also be used:</p><ul><li><code>#md</code>, <code>#nb</code>, <code>#jl</code>, <code>#src</code>: tags to filter lines, see <a href="fileformat.html#Filtering-Lines-1">Filtering Lines</a>,</li><li><code>#-</code>: tag to manually control chunk-splits, see <a href="pipeline.html#Custom-control-over-chunk-splits-1">Custom control over chunk splits</a>.</li></ul><p>There is also some default convenience replacements that will always be performed, see <a href="fileformat.html#Default-Replacements-1">Default Replacements</a>.</p><h2><a class="nav-anchor" href="#Filtering-Lines-1" id="Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</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> with one of these tokens are filtered out in the <a href="pipeline.html#Pre-processing-1">preprocessing step</a>.</p><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><code class="language-julia">#md # ```@docs
#md # Literate.markdown #md # Literate.markdown
#md # Literate.notebook #md # Literate.notebook
#md # Literate.markdown #md # Literate.markdown
#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 simple 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><code class="language-julia">using Test #src #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 simple 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><code class="language-julia">using Test #src
@test result == expected_result #src</code></pre><h2><a class="nav-anchor" id="Default-Replacements-1" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></h2><p>The following convenience &quot;macros&quot; are always expanded:</p><ul><li><p><code>@__NAME__</code></p><p>expands to the <code>name</code> keyword argument to <a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#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>expands to <code>https://github.com/$(ENV[&quot;TRAVIS_REPO_SLUG&quot;])/blob/master/</code> and is a convenient way to use when you want to link to files outside the doc-build directory. For example <code>@__REPO__ROOT_URL__src/Literate.jl</code> would link to the source of the Literate module.</p></li><li><p><code>@__NBVIEWER_ROOT_URL__</code></p><p>expands to <code>https://nbviewer.jupyter.org/github/$(ENV[&quot;TRAVIS_REPO_SLUG&quot;])/blob/gh-pages/$(folder)/</code> where <code>folder</code> is the folder that <code>Documenter.deploydocs</code> deploys too. This can be used if you want a link that opens the generated notebook in <a href="http://nbviewer.jupyter.org/">http://nbviewer.jupyter.org/</a>.</p></li></ul><footer><hr/><a class="previous" href="index.html"><span class="direction">Previous</span><span class="title"><strong>1.</strong> Introduction</span></a><a class="next" href="pipeline.html"><span class="direction">Next</span><span class="title"><strong>3.</strong> Processing pipeline</span></a></footer></article></body></html> @test result == expected_result #src</code></pre><h2><a class="nav-anchor" href="#Default-Replacements-1" id="Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></h2><p>The following convenience "macros" are always expanded:</p><ul><li><p><code>@__NAME__</code></p><p>expands to the <code>name</code> keyword argument to <a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#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>expands to <code>https://github.com/$(ENV["TRAVIS_REPO_SLUG"])/blob/master/</code> and is a convenient way to use when you want to link to files outside the doc-build directory. For example <code>@__REPO__ROOT_URL__src/Literate.jl</code> would link to the source of the Literate module.</p></li><li><p><code>@__NBVIEWER_ROOT_URL__</code></p><p>expands to <code>https://nbviewer.jupyter.org/github/$(ENV["TRAVIS_REPO_SLUG"])/blob/gh-pages/$(folder)/</code> where <code>folder</code> is the folder that <code>Documenter.deploydocs</code> deploys too. This can be used if you want a link that opens the generated notebook in <a href="http://nbviewer.jupyter.org/">http://nbviewer.jupyter.org/</a>.</p></li></ul><footer><hr/><a class="previous" href="index.html"><span class="direction">Previous</span><span class="title"><strong>1.</strong> Introduction</span></a><a class="next" href="pipeline.html"><span class="direction">Next</span><span class="title"><strong>3.</strong> Processing pipeline</span></a></footer></article></body></HTML>

188
v0.3.0/generated/example.html

@ -1,7 +1,48 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>7. Example · Literate.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 data-main="../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>7. Example · Literate.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>Literate.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><a class="toctext" href="../outputformats.html"><strong>4.</strong> Output Formats</a></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 class="current"><a class="toctext" href="example.html"><strong>7.</strong> Example</a><ul class="internal"></ul></li></ul></nav><article id="docs"><header><nav><ul><li><a href="example.html"><strong>7.</strong> Example</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>7. Example</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="**7.**-Example-1" href="#**7.**-Example-1"><strong>7.</strong> Example</a></h1><p>This is an example generated with Literate based on this source file: <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><code>example.jl</code></a>. You are seeing the html-output which Documenter have generated based on a markdown file generated with Literate. The corresponding notebook can be found here: <a href="https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v0.3.0/generated/example.ipynb"><code>example.ipynb</code></a>, and the plain script output can be found here: <a href="example.jl"><code>example.jl</code></a>.</p><p>It is recommended to have the <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl">source file</a> available when reading this, to better understand how the syntax in the source file corresponds to the output you are seeing.</p><h3><a class="nav-anchor" id="Basic-syntax-1" href="#Basic-syntax-1">Basic syntax</a></h3><p>The basic syntax for Literate is simple, lines starting with <code>#</code> is interpreted as markdown, and all the other lines are interpreted as code. Here is some code:</p><div><pre><code class="language-julia">x = 1//3 const head = document.getElementsByTagName('head')[0];
y = 2//5</code></pre><pre><code class="language-none">2//5</code></pre></div><p>In markdown sections we can use markdown syntax. For example, we can write <em>text in italic font</em>, <strong>text in bold font</strong> and use <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">links</a>.</p><p>It is possible to filter out lines depending on the output using the <code>#md</code>, <code>#nb</code>, <code>#jl</code> and <code>#src</code> tags (see <a href="../fileformat.html#Filtering-Lines-1">Filtering Lines</a>):</p><ul><li>This line starts with <code>#md</code> and is thus only visible in the markdown output.</li></ul><p>The source file is parsed in chunks of markdown and code. Starting a line with <code>#-</code> manually inserts a chunk break. For example, if we want to display the output of the following operations we may insert <code>#-</code> in between. These two code blocks will now end up in different <code>@example</code>-blocks in the markdown output, and two different notebook cells in the notebook output.</p><div><pre><code class="language-julia">x + y</code></pre><pre><code class="language-none">11//15</code></pre></div><div><pre><code class="language-julia">x * y</code></pre><pre><code class="language-none">2//15</code></pre></div><h3><a class="nav-anchor" id="Output-Capturing-1" href="#Output-Capturing-1">Output Capturing</a></h3><p>Code chunks are by default placed in Documenter <code>@example</code> blocks in the generated markdown. This means that the output will be captured in a block when Documenter is building the docs. In notebooks the output is captured in output cells, if the <code>execute</code> keyword argument is set to true. Output to <code>stdout</code>/<code>stderr</code> is also captured.</p><div><pre><code class="language-julia">function foo()
println(&quot;This string is printed to stdout.&quot;) // Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="../search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="../outputformats.html"><strong>4.</strong> Output Formats</a></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 class="current"><a class="toctext" href="example.html"><strong>7.</strong> Example</a><ul class="internal"></ul></li></ul></nav><article id="docs"><header><nav><ul><li><a href="example.html"><strong>7.</strong> Example</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>7. Example</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#**7.**-Example-1" id="**7.**-Example-1"><strong>7.</strong> Example</a></h1><p>This is an example generated with Literate based on this source file: <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><code>example.jl</code></a>. You are seeing the html-output which Documenter have generated based on a markdown file generated with Literate. The corresponding notebook can be found here: <a href="https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v0.3.0/generated/example.ipynb"><code>example.ipynb</code></a>, and the plain script output can be found here: <a href="example.jl"><code>example.jl</code></a>.</p><p>It is recommended to have the <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl">source file</a> available when reading this, to better understand how the syntax in the source file corresponds to the output you are seeing.</p><h3><a class="nav-anchor" href="#Basic-syntax-1" id="Basic-syntax-1">Basic syntax</a></h3><p>The basic syntax for Literate is simple, lines starting with <code>#</code> is interpreted as markdown, and all the other lines are interpreted as code. Here is some code:</p><div><pre><code class="language-julia">x = 1//3
y = 2//5</code></pre><pre><code class="language-none">2//5</code></pre></div><p>In markdown sections we can use markdown syntax. For example, we can write <em>text in italic font</em>, <strong>text in bold font</strong> and use <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">links</a>.</p><p>It is possible to filter out lines depending on the output using the <code>#md</code>, <code>#nb</code>, <code>#jl</code> and <code>#src</code> tags (see <a href="../fileformat.html#Filtering-Lines-1">Filtering Lines</a>):</p><ul><li>This line starts with <code>#md</code> and is thus only visible in the markdown output.</li></ul><p>The source file is parsed in chunks of markdown and code. Starting a line with <code>#-</code> manually inserts a chunk break. For example, if we want to display the output of the following operations we may insert <code>#-</code> in between. These two code blocks will now end up in different <code>@example</code>-blocks in the markdown output, and two different notebook cells in the notebook output.</p><div><pre><code class="language-julia">x + y</code></pre><pre><code class="language-none">11//15</code></pre></div><div><pre><code class="language-julia">x * y</code></pre><pre><code class="language-none">2//15</code></pre></div><h3><a class="nav-anchor" href="#Output-Capturing-1" id="Output-Capturing-1">Output Capturing</a></h3><p>Code chunks are by default placed in Documenter <code>@example</code> blocks in the generated markdown. This means that the output will be captured in a block when Documenter is building the docs. In notebooks the output is captured in output cells, if the <code>execute</code> keyword argument is set to true. Output to <code>stdout</code>/<code>stderr</code> is also captured.</p><div><pre><code class="language-julia">function foo()
println("This string is printed to stdout.")
return [1, 2, 3, 4] return [1, 2, 3, 4]
end end
@ -10,121 +51,55 @@ foo()</code></pre><pre><code class="language-none">This string is printed to std
1 1
2 2
3 3
4</code></pre></div><p>Both Documenter&#39;s <code>@example</code> block and notebooks can display images. Here is an example where we generate a simple plot using the <a href="https://github.com/JuliaPlots/Plots.jl">Plots.jl</a> package</p><div><pre><code class="language-julia">using Plots 4</code></pre></div><p>Both Documenter's <code>@example</code> block and notebooks can display images. Here is an example where we generate a simple plot using the <a href="https://github.com/JuliaPlots/Plots.jl">Plots.jl</a> package</p><div><pre><code class="language-julia">using Plots
x = range(0, stop=6π, length=1000) x = range(0, stop=6π, length=1000)
y1 = sin.(x) y1 = sin.(x)
y2 = cos.(x) y2 = cos.(x)
plot(x, [y1, y2])</code></pre><?xml version="1.0" encoding="utf-8"?> plot(x, [y1, y2])</code></pre><svg height="400" viewBox="0 0 600 400" width="600" xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"><defs><clipPath id="clip2000"><rect height="400" width="600" x="0" y="0"></rect></clipPath></defs><polygon clip-path="url(#clip2000)" fill="#ffffff" fill-opacity="1" points="
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="600" height="400" viewBox="0 0 600 400">
<defs>
<clipPath id="clip2000">
<rect x="0" y="0" width="600" height="400"/>
</clipPath>
</defs>
<polygon clip-path="url(#clip2000)" points="
0,400 600,400 600,0 0,0 0,400 600,400 600,0 0,0
" fill="#ffffff" fill-opacity="1"/> "></polygon><defs><clipPath id="clip2001"><rect height="400" width="421" x="120" y="0"></rect></clipPath></defs><polygon clip-path="url(#clip2000)" fill="#ffffff" fill-opacity="1" points="
<defs>
<clipPath id="clip2001">
<rect x="120" y="0" width="421" height="400"/>
</clipPath>
</defs>
<polygon clip-path="url(#clip2000)" points="
23.622,384.252 580.315,384.252 580.315,11.811 23.622,11.811 23.622,384.252 580.315,384.252 580.315,11.811 23.622,11.811
" fill="#ffffff" fill-opacity="1"/> "></polygon><defs><clipPath id="clip2002"><rect height="373" width="558" x="23" y="11"></rect></clipPath></defs><polyline clip-path="url(#clip2002)" points="
<defs>
<clipPath id="clip2002">
<rect x="23" y="11" width="558" height="373"/>
</clipPath>
</defs>
<polyline clip-path="url(#clip2002)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
39.3775,384.252 39.3775,11.811 39.3775,384.252 39.3775,11.811
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip2002)" points="
<polyline clip-path="url(#clip2002)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
178.686,384.252 178.686,11.811 178.686,384.252 178.686,11.811
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip2002)" points="
<polyline clip-path="url(#clip2002)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
317.995,384.252 317.995,11.811 317.995,384.252 317.995,11.811
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip2002)" points="
<polyline clip-path="url(#clip2002)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
457.304,384.252 457.304,11.811 457.304,384.252 457.304,11.811
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip2002)" points="
<polyline clip-path="url(#clip2002)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
23.622,373.713 580.315,373.713 23.622,373.713 580.315,373.713
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip2002)" points="
<polyline clip-path="url(#clip2002)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
23.622,285.873 580.315,285.873 23.622,285.873 580.315,285.873
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip2002)" points="
<polyline clip-path="url(#clip2002)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
23.622,198.032 580.315,198.032 23.622,198.032 580.315,198.032
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip2002)" points="
<polyline clip-path="url(#clip2002)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
23.622,110.192 580.315,110.192 23.622,110.192 580.315,110.192
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip2002)" points="
<polyline clip-path="url(#clip2002)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
23.622,22.3518 580.315,22.3518 23.622,22.3518 580.315,22.3518
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip2000)" points="
<polyline clip-path="url(#clip2000)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,384.252 580.315,384.252 23.622,384.252 580.315,384.252
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip2000)" points="
<polyline clip-path="url(#clip2000)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,384.252 23.622,11.811 23.622,384.252 23.622,11.811
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip2000)" points="
<polyline clip-path="url(#clip2000)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
39.3775,384.252 39.3775,378.665 39.3775,384.252 39.3775,378.665
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip2000)" points="
<polyline clip-path="url(#clip2000)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
178.686,384.252 178.686,378.665 178.686,384.252 178.686,378.665
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip2000)" points="
<polyline clip-path="url(#clip2000)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
317.995,384.252 317.995,378.665 317.995,384.252 317.995,378.665
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip2000)" points="
<polyline clip-path="url(#clip2000)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
457.304,384.252 457.304,378.665 457.304,384.252 457.304,378.665
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip2000)" points="
<polyline clip-path="url(#clip2000)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,373.713 31.9724,373.713 23.622,373.713 31.9724,373.713
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip2000)" points="
<polyline clip-path="url(#clip2000)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,285.873 31.9724,285.873 23.622,285.873 31.9724,285.873
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip2000)" points="
<polyline clip-path="url(#clip2000)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,198.032 31.9724,198.032 23.622,198.032 31.9724,198.032
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip2000)" points="
<polyline clip-path="url(#clip2000)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,110.192 31.9724,110.192 23.622,110.192 31.9724,110.192
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip2000)" points="
<polyline clip-path="url(#clip2000)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,22.3518 31.9724,22.3518 23.622,22.3518 31.9724,22.3518
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><g clip-path="url(#clip2000)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 39.3775, 398.052)" x="39.3775" y="398.052">0</text></g><g clip-path="url(#clip2000)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 178.686, 398.052)" x="178.686" y="398.052">5</text></g><g clip-path="url(#clip2000)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 317.995, 398.052)" x="317.995" y="398.052">10</text></g><g clip-path="url(#clip2000)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 457.304, 398.052)" x="457.304" y="398.052">15</text></g><g clip-path="url(#clip2000)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 378.213)" x="17.622" y="378.213">-1.0</text></g><g clip-path="url(#clip2000)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 290.373)" x="17.622" y="290.373">-0.5</text></g><g clip-path="url(#clip2000)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 202.532)" x="17.622" y="202.532">0.0</text></g><g clip-path="url(#clip2000)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 114.692)" x="17.622" y="114.692">0.5</text></g><g clip-path="url(#clip2000)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 26.8518)" x="17.622" y="26.8518">1.0</text></g><polyline clip-path="url(#clip2002)" points="
<g clip-path="url(#clip2000)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 39.3775, 398.052)" x="39.3775" y="398.052">0</text>
</g>
<g clip-path="url(#clip2000)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 178.686, 398.052)" x="178.686" y="398.052">5</text>
</g>
<g clip-path="url(#clip2000)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 317.995, 398.052)" x="317.995" y="398.052">10</text>
</g>
<g clip-path="url(#clip2000)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 457.304, 398.052)" x="457.304" y="398.052">15</text>
</g>
<g clip-path="url(#clip2000)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 378.213)" x="17.622" y="378.213">-1.0</text>
</g>
<g clip-path="url(#clip2000)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 290.373)" x="17.622" y="290.373">-0.5</text>
</g>
<g clip-path="url(#clip2000)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 202.532)" x="17.622" y="202.532">0.0</text>
</g>
<g clip-path="url(#clip2000)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 114.692)" x="17.622" y="114.692">0.5</text>
</g>
<g clip-path="url(#clip2000)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 26.8518)" x="17.622" y="26.8518">1.0</text>
</g>
<polyline clip-path="url(#clip2002)" style="stroke:#009af9; stroke-width:1; stroke-opacity:1; fill:none" points="
39.3775,198.032 39.9032,194.718 40.4289,191.404 40.9546,188.093 41.4803,184.786 42.006,181.483 42.5318,178.186 43.0575,174.896 43.5832,171.615 44.1089,168.342 39.3775,198.032 39.9032,194.718 40.4289,191.404 40.9546,188.093 41.4803,184.786 42.006,181.483 42.5318,178.186 43.0575,174.896 43.5832,171.615 44.1089,168.342
44.6346,165.081 45.1603,161.831 45.686,158.594 46.2117,155.371 46.7374,152.163 47.2631,148.971 47.7888,145.797 48.3145,142.642 48.8402,139.506 49.366,136.391 44.6346,165.081 45.1603,161.831 45.686,158.594 46.2117,155.371 46.7374,152.163 47.2631,148.971 47.7888,145.797 48.3145,142.642 48.8402,139.506 49.366,136.391
49.8917,133.298 50.4174,130.229 50.9431,127.183 51.4688,124.162 51.9945,121.168 52.5202,118.201 53.0459,115.263 53.5716,112.354 54.0973,109.475 54.623,106.629 49.8917,133.298 50.4174,130.229 50.9431,127.183 51.4688,124.162 51.9945,121.168 52.5202,118.201 53.0459,115.263 53.5716,112.354 54.0973,109.475 54.623,106.629
@ -226,8 +201,7 @@ plot(x, [y1, y2])</code></pre><?xml version="1.0" encoding="utf-8"?>
554.571,259.674 555.097,256.559 555.622,253.423 556.148,250.268 556.674,247.094 557.2,243.902 557.725,240.694 558.251,237.471 558.777,234.234 559.302,230.984 554.571,259.674 555.097,256.559 555.622,253.423 556.148,250.268 556.674,247.094 557.2,243.902 557.725,240.694 558.251,237.471 558.777,234.234 559.302,230.984
559.828,227.723 560.354,224.45 560.88,221.169 561.405,217.879 561.931,214.582 562.457,211.279 562.982,207.972 563.508,204.661 564.034,201.347 564.56,198.032 559.828,227.723 560.354,224.45 560.88,221.169 561.405,217.879 561.931,214.582 562.457,211.279 562.982,207.972 563.508,204.661 564.034,201.347 564.56,198.032
"/> " style="stroke:#009af9; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip2002)" points="
<polyline clip-path="url(#clip2002)" style="stroke:#e26f46; stroke-width:1; stroke-opacity:1; fill:none" points="
39.3775,22.3518 39.9032,22.3831 40.4289,22.4769 40.9546,22.6332 41.4803,22.8519 42.006,23.133 42.5318,23.4764 43.0575,23.8819 43.5832,24.3495 44.1089,24.8788 39.3775,22.3518 39.9032,22.3831 40.4289,22.4769 40.9546,22.6332 41.4803,22.8519 42.006,23.133 42.5318,23.4764 43.0575,23.8819 43.5832,24.3495 44.1089,24.8788
44.6346,25.4698 45.1603,26.1222 45.686,26.8359 46.2117,27.6104 46.7374,28.4457 47.2631,29.3413 47.7888,30.297 48.3145,31.3124 48.8402,32.3871 49.366,33.5209 44.6346,25.4698 45.1603,26.1222 45.686,26.8359 46.2117,27.6104 46.7374,28.4457 47.2631,29.3413 47.7888,30.297 48.3145,31.3124 48.8402,32.3871 49.366,33.5209
49.8917,34.7131 50.4174,35.9636 50.9431,37.2717 51.4688,38.637 51.9945,40.0591 52.5202,41.5375 53.0459,43.0715 53.5716,44.6608 54.0973,46.3046 54.623,48.0024 49.8917,34.7131 50.4174,35.9636 50.9431,37.2717 51.4688,38.637 51.9945,40.0591 52.5202,41.5375 53.0459,43.0715 53.5716,44.6608 54.0973,46.3046 54.623,48.0024
@ -329,24 +303,12 @@ plot(x, [y1, y2])</code></pre><?xml version="1.0" encoding="utf-8"?>
554.571,33.5209 555.097,32.3871 555.622,31.3124 556.148,30.297 556.674,29.3413 557.2,28.4457 557.725,27.6104 558.251,26.8359 558.777,26.1222 559.302,25.4698 554.571,33.5209 555.097,32.3871 555.622,31.3124 556.148,30.297 556.674,29.3413 557.2,28.4457 557.725,27.6104 558.251,26.8359 558.777,26.1222 559.302,25.4698
559.828,24.8788 560.354,24.3495 560.88,23.8819 561.405,23.4764 561.931,23.133 562.457,22.8519 562.982,22.6332 563.508,22.4769 564.034,22.3831 564.56,22.3518 559.828,24.8788 560.354,24.3495 560.88,23.8819 561.405,23.4764 561.931,23.133 562.457,22.8519 562.982,22.6332 563.508,22.4769 564.034,22.3831 564.56,22.3518
"/> " style="stroke:#e26f46; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polygon clip-path="url(#clip2000)" fill="#ffffff" fill-opacity="1" points="
<polygon clip-path="url(#clip2000)" points="
489.608,78.051 562.315,78.051 562.315,32.691 489.608,32.691 489.608,78.051 562.315,78.051 562.315,32.691 489.608,32.691
" fill="#ffffff" fill-opacity="1"/> "></polygon><polyline clip-path="url(#clip2000)" points="
<polyline clip-path="url(#clip2000)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
489.608,78.051 562.315,78.051 562.315,32.691 489.608,32.691 489.608,78.051 489.608,78.051 562.315,78.051 562.315,32.691 489.608,32.691 489.608,78.051
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip2000)" points="
<polyline clip-path="url(#clip2000)" style="stroke:#009af9; stroke-width:1; stroke-opacity:1; fill:none" points="
495.608,47.811 531.608,47.811 495.608,47.811 531.608,47.811
"/> " style="stroke:#009af9; stroke-width:1; stroke-opacity:1; fill:none"></polyline><g clip-path="url(#clip2000)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:start;" transform="rotate(0, 537.608, 52.311)" x="537.608" y="52.311">y1</text></g><polyline clip-path="url(#clip2000)" points="
<g clip-path="url(#clip2000)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:start;" transform="rotate(0, 537.608, 52.311)" x="537.608" y="52.311">y1</text>
</g>
<polyline clip-path="url(#clip2000)" style="stroke:#e26f46; stroke-width:1; stroke-opacity:1; fill:none" points="
495.608,62.931 531.608,62.931 495.608,62.931 531.608,62.931
"/> " style="stroke:#e26f46; stroke-width:1; stroke-opacity:1; fill:none"></polyline><g clip-path="url(#clip2000)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:start;" transform="rotate(0, 537.608, 67.431)" x="537.608" y="67.431">y2</text></g></svg></div><h3><a class="nav-anchor" href="#Custom-processing-1" id="Custom-processing-1">Custom processing</a></h3><p>It is possible to give Literate custom pre- and post-processing functions. For example, here we insert two placeholders, which we will replace with something else at time of generation. We have here replaced our placeholders with <code>z</code> and <code>1.0 + 2.0im</code>:</p><div><pre><code class="language-julia">z = 1.0 + 2.0im</code></pre><pre><code class="language-none">1.0 + 2.0im</code></pre></div><h3><a class="nav-anchor" href="#documenter-interaction-1" id="documenter-interaction-1">Documenter.jl interaction</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, <a href="example.html#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><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p><footer><hr/><a class="previous" href="../documenter.html"><span class="direction">Previous</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></HTML>
<g clip-path="url(#clip2000)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:start;" transform="rotate(0, 537.608, 67.431)" x="537.608" y="67.431">y2</text>
</g>
</svg>
</div><h3><a class="nav-anchor" id="Custom-processing-1" href="#Custom-processing-1">Custom processing</a></h3><p>It is possible to give Literate custom pre- and post-processing functions. For example, here we insert two placeholders, which we will replace with something else at time of generation. We have here replaced our placeholders with <code>z</code> and <code>1.0 + 2.0im</code>:</p><div><pre><code class="language-julia">z = 1.0 + 2.0im</code></pre><pre><code class="language-none">1.0 + 2.0im</code></pre></div><h3><a class="nav-anchor" id="documenter-interaction-1" href="#documenter-interaction-1">Documenter.jl interaction</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, <a href="example.html#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><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p><footer><hr/><a class="previous" href="../documenter.html"><span class="direction">Previous</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></html>

45
v0.3.0/index.html

File diff suppressed because one or more lines are too long

53
v0.3.0/outputformats.html

File diff suppressed because one or more lines are too long

51
v0.3.0/pipeline.html

File diff suppressed because one or more lines are too long

45
v0.3.0/search.html

@ -1,2 +1,43 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>Search · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Search · Literate.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>Literate.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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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><header><nav><ul><li>Search</li></ul></nav><hr/><div id="topbar"><span>Search</span><a class="fa fa-bars" href="#"></a></div></header><h1>Search</h1><p id="search-info">Number of results: <span id="search-results-number">loading...</span></p><ul id="search-results"></ul></article></body><script src="search_index.js"></script><script src="assets/search.js"></script></html> const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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><header><nav><ul><li>Search</li></ul></nav><hr/><div id="topbar"><span>Search</span><a class="fa fa-bars" href="#"></a></div></header><h1>Search</h1><p id="search-info">Number of results: <span id="search-results-number">loading...</span></p><ul id="search-results"></ul></article><script src="search_index.js"></script><script src="assets/search.js"></script></body></HTML>

49
v1.0.0/customprocessing.html

@ -1,8 +1,49 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>5. Custom pre- and post-processing · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>5. Custom pre- and post-processing · Literate.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"><a href="index.html"><img class="logo" src="assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li class="current"><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a><ul class="internal"></ul></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="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/customprocessing.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>5. Custom pre- and post-processing</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Custom-pre-and-post-processing-1" href="#Custom-pre-and-post-processing-1"><strong>5.</strong> Custom pre- and post-processing</a></h1><p>Since all packages are different, and may have different demands on how to create a nice example for the documentation it is important that the package maintainer does not feel limited by the by default provided syntax that this package offers. While you can generally come a long way by utilizing <a href="fileformat.html#Filtering-Lines-1">line filtering</a> there might be situations where you need to manually hook into the generation and change things. In Literate this is done by letting the user supply custom pre- and post-processing functions that may do transformation of the content.</p><p>All of the generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) accepts <code>preprocess</code> and <code>postprocess</code> keyword arguments. The default &quot;transformation&quot; is the <code>identity</code> function. The input to the transformation functions is a <code>String</code>, and the output should be the transformed <code>String</code>.</p><p><code>preprocess</code> is sent the raw input that is read from the source file (<a href="pipeline.html#Pre-processing-1">modulo the default line ending transformation</a>). <code>postprocess</code> is given different things depending on the output: For markdown and script output <code>postprocess</code> is given the content <code>String</code> just before writing it to the output file, but for notebook output <code>postprocess</code> is given the dictionary representing the notebook, since, in general, this is more useful.</p><p>As an example, lets say we want to splice the date of generation into the output. We could of course update our source file before generating the docs, but we could instead use a <code>preprocess</code> function that splices the date into the source for us. Consider the following source file:</p><pre><code class="language-julia"># # Example const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="index.html"><img alt="Literate.jl logo" class="logo" src="assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li class="current"><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a><ul class="internal"></ul></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="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/customprocessing.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>5. Custom pre- and post-processing</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#Custom-pre-and-post-processing-1" id="Custom-pre-and-post-processing-1"><strong>5.</strong> Custom pre- and post-processing</a></h1><p>Since all packages are different, and may have different demands on how to create a nice example for the documentation it is important that the package maintainer does not feel limited by the by default provided syntax that this package offers. While you can generally come a long way by utilizing <a href="fileformat.html#Filtering-Lines-1">line filtering</a> there might be situations where you need to manually hook into the generation and change things. In Literate this is done by letting the user supply custom pre- and post-processing functions that may do transformation of the content.</p><p>All of the generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) accepts <code>preprocess</code> and <code>postprocess</code> keyword arguments. The default "transformation" is the <code>identity</code> function. The input to the transformation functions is a <code>String</code>, and the output should be the transformed <code>String</code>.</p><p><code>preprocess</code> is sent the raw input that is read from the source file (<a href="pipeline.html#Pre-processing-1">modulo the default line ending transformation</a>). <code>postprocess</code> is given different things depending on the output: For markdown and script output <code>postprocess</code> is given the content <code>String</code> just before writing it to the output file, but for notebook output <code>postprocess</code> is given the dictionary representing the notebook, since, in general, this is more useful.</p><p>As an example, lets say we want to splice the date of generation into the output. We could of course update our source file before generating the docs, but we could instead use a <code>preprocess</code> function that splices the date into the source for us. Consider the following source file:</p><pre><code class="language-julia"># # Example
# This example was generated DATEOFTODAY # This example was generated DATEOFTODAY
x = 1 // 3</code></pre><p>where <code>DATEOFTODAY</code> is a placeholder, to make it easier for our <code>preprocess</code> function to find the location. Now, lets define the <code>preprocess</code> function, for example</p><pre><code class="language-julia">function update_date(content) x = 1 // 3</code></pre><p>where <code>DATEOFTODAY</code> is a placeholder, to make it easier for our <code>preprocess</code> function to find the location. Now, lets define the <code>preprocess</code> function, for example</p><pre><code class="language-julia">function update_date(content)
content = replace(content, &quot;DATEOFTODAY&quot; =&gt; Date(now())) content = replace(content, "DATEOFTODAY" =&gt; Date(now()))
return content return content
end</code></pre><p>which would replace every occurrence of <code>&quot;DATEOFTODAY&quot;</code> with the current date. We would now simply give this function to the generator, for example:</p><pre><code class="language-julia">Literate.markdown(&quot;input.jl&quot;, &quot;outputdir&quot;; preprocess = update_date)</code></pre><footer><hr/><a class="previous" href="outputformats.html"><span class="direction">Previous</span><span class="title"><strong>4.</strong> Output Formats</span></a><a class="next" href="documenter.html"><span class="direction">Next</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></html> end</code></pre><p>which would replace every occurrence of <code>"DATEOFTODAY"</code> with the current date. We would now simply give this function to the generator, for example:</p><pre><code class="language-julia">Literate.markdown("input.jl", "outputdir"; preprocess = update_date)</code></pre><footer><hr/><a class="previous" href="outputformats.html"><span class="direction">Previous</span><span class="title"><strong>4.</strong> Output Formats</span></a><a class="next" href="documenter.html"><span class="direction">Next</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></HTML>

53
v1.0.0/documenter.html

@ -1,12 +1,53 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>6. Interaction with Documenter.jl · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>6. Interaction with Documenter.jl · Literate.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"><a href="index.html"><img class="logo" src="assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li><li class="current"><a class="toctext" href="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a><ul class="internal"></ul></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="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/documenter.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>6. Interaction with Documenter.jl</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Interaction-with-Documenter-1" href="#Interaction-with-Documenter-1"><strong>6.</strong> Interaction with Documenter.jl</a></h1><p>Literate can be used for any purpose, it spits out regular markdown files, and notebooks. Typically, though, these files will be used to render documentation for your package. The generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) supports a keyword argument <code>documenter</code> that lets the generator perform some extra things, keeping in mind that the source code have been written with Documenter.jl in mind. So lets take a look at what will happen if we set <code>documenter = true</code>:</p><h3><a class="nav-anchor" id="[Literate.markdown](@ref):-1" href="#[Literate.markdown](@ref):-1"><a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>:</a></h3><ul><li>The default code fence will change from<pre><code class="language-none">```julia const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="index.html"><img alt="Literate.jl logo" class="logo" src="assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li><li class="current"><a class="toctext" href="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a><ul class="internal"></ul></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="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/documenter.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>6. Interaction with Documenter.jl</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#Interaction-with-Documenter-1" id="Interaction-with-Documenter-1"><strong>6.</strong> Interaction with Documenter.jl</a></h1><p>Literate can be used for any purpose, it spits out regular markdown files, and notebooks. Typically, though, these files will be used to render documentation for your package. The generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) supports a keyword argument <code>documenter</code> that lets the generator perform some extra things, keeping in mind that the source code have been written with Documenter.jl in mind. So lets take a look at what will happen if we set <code>documenter = true</code>:</p><h3><a class="nav-anchor" href="#[Literate.markdown](@ref):-1" id="[Literate.markdown](@ref):-1"></a><a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>:</h3><ul><li>The default code fence will change from<pre><code class="language-none">```julia
# code # code
```</code></pre>to Documenters <code>@example</code> blocks:<pre><code class="language-none">```@examples $(name) ```</code></pre>to Documenters <code>@example</code> blocks:<pre><code class="language-none">```@examples $(name)
# code # code
```</code></pre></li><li>The following <code>@meta</code> block will be added to the top of the markdown page, which redirects the &quot;Edit on GitHub&quot; link on the top of the page to the <em>source file</em> rather than the generated <code>.md</code> file:<pre><code class="language-none">```@meta ```</code></pre></li><li>The following <code>@meta</code> block will be added to the top of the markdown page, which redirects the "Edit on GitHub" link on the top of the page to the <em>source file</em> rather than the generated <code>.md</code> file:<pre><code class="language-none">```@meta
EditURL = &quot;$(relpath(inputfile, outputdir))&quot; EditURL = "$(relpath(inputfile, outputdir))"
```</code></pre></li></ul><h3><a class="nav-anchor" id="[Literate.notebook](@ref):-1" href="#[Literate.notebook](@ref):-1"><a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a>:</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 notebook.</li><li>Documenter style markdown math<pre><code class="language-none">```math ```</code></pre></li></ul><h3><a class="nav-anchor" href="#[Literate.notebook](@ref):-1" id="[Literate.notebook](@ref):-1"></a><a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></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 notebook.</li><li>Documenter style markdown math<pre><code class="language-none">```math
\int f dx \int f dx
```</code></pre>is replaced with notebook compatible<pre><code class="language-none">\begin{equation} ```</code></pre>is replaced with notebook compatible<pre><code class="language-none">\begin{equation}
\int f dx \int f dx
\end{equation}</code></pre></li></ul><h3><a class="nav-anchor" id="[Literate.script](@ref):-1" href="#[Literate.script](@ref):-1"><a href="outputformats.html#Literate.script"><code>Literate.script</code></a>:</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><footer><hr/><a class="previous" href="customprocessing.html"><span class="direction">Previous</span><span class="title"><strong>5.</strong> Custom pre- and post-processing</span></a><a class="next" href="generated/example.html"><span class="direction">Next</span><span class="title"><strong>7.</strong> Example</span></a></footer></article></body></html> \end{equation}</code></pre></li></ul><h3><a class="nav-anchor" href="#[Literate.script](@ref):-1" id="[Literate.script](@ref):-1"></a><a href="outputformats.html#Literate.script"><code>Literate.script</code></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><footer><hr/><a class="previous" href="customprocessing.html"><span class="direction">Previous</span><span class="title"><strong>5.</strong> Custom pre- and post-processing</span></a><a class="next" href="generated/example.html"><span class="direction">Next</span><span class="title"><strong>7.</strong> Example</span></a></footer></article></body></HTML>

49
v1.0.0/fileformat.html

@ -1,5 +1,46 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>2. File Format · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>2. File Format · Literate.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"><a href="index.html"><img class="logo" src="assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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 class="current"><a class="toctext" href="fileformat.html"><strong>2.</strong> File Format</a><ul class="internal"><li><a class="toctext" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></li><li><a class="toctext" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</a></li><li><a class="toctext" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></li></ul></li><li><a class="toctext" href="pipeline.html"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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="fileformat.html"><strong>2.</strong> File Format</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/fileformat.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>2. File Format</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="**2.**-File-Format-1" href="#**2.**-File-Format-1"><strong>2.</strong> File Format</a></h1><p>The source file format for Literate is a regular, commented, julia (<code>.jl</code>) scripts. The idea is that the scripts also serve as documentation on their own and it is also simple to include them in the test-suite, with e.g. <code>include</code>, to make sure the examples stay up do date with other changes in your package.</p><h2><a class="nav-anchor" id="Syntax-1" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></h2><p>The basic syntax is simple:</p><ul><li>lines starting with <code>#</code> are treated as markdown,</li><li>all other lines are treated as julia code.</li></ul><p>Leading whitespace is allowed before <code>#</code>, but it will be removed when generating the output. Since <code>#</code>-lines is treated as markdown we can not use that for regular julia comments, for this you can instead use <code>##</code>, which will render as <code>#</code> in the output.</p><p>Lets look at a simple example:</p><pre><code class="language-julia"># # Rational numbers const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="index.html"><img alt="Literate.jl logo" class="logo" src="assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="index.html"><strong>1.</strong> Introduction</a></li><li class="current"><a class="toctext" href="fileformat.html"><strong>2.</strong> File Format</a><ul class="internal"><li><a class="toctext" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></li><li><a class="toctext" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</a></li><li><a class="toctext" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></li></ul></li><li><a class="toctext" href="pipeline.html"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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="fileformat.html"><strong>2.</strong> File Format</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/fileformat.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>2. File Format</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#**2.**-File-Format-1" id="**2.**-File-Format-1"><strong>2.</strong> File Format</a></h1><p>The source file format for Literate is a regular, commented, julia (<code>.jl</code>) scripts. The idea is that the scripts also serve as documentation on their own and it is also simple to include them in the test-suite, with e.g. <code>include</code>, to make sure the examples stay up do date with other changes in your package.</p><h2><a class="nav-anchor" href="#Syntax-1" id="Syntax-1"><strong>2.1.</strong> Syntax</a></h2><p>The basic syntax is simple:</p><ul><li>lines starting with <code>#</code> are treated as markdown,</li><li>all other lines are treated as julia code.</li></ul><p>Leading whitespace is allowed before <code>#</code>, but it will be removed when generating the output. Since <code>#</code>-lines is treated as markdown we can not use that for regular julia comments, for this you can instead use <code>##</code>, which will render as <code>#</code> in the output.</p><p>Lets look at a simple example:</p><pre><code class="language-julia"># # Rational numbers
# #
# In julia rational numbers can be constructed with the `//` operator. # In julia rational numbers can be constructed with the `//` operator.
# Lets define two rational numbers, `x` and `y`: # Lets define two rational numbers, `x` and `y`:
@ -9,9 +50,9 @@ y = 2//5
# When adding `x` and `y` together we obtain a new rational number: # When adding `x` and `y` together we obtain a new rational number:
z = x + y</code></pre><p>In the lines starting with <code>#</code> we can use regular markdown syntax, for example the <code>#</code> used for the heading and the backticks for formatting code. The other lines are regular julia code. We note a couple of things:</p><ul><li>The script is valid julia, which means that we can <code>include</code> it and the example will run (for example in the <code>test/runtests.jl</code> script, to include the example in the test suite).</li><li>The script is &quot;self-explanatory&quot;, i.e. the markdown lines works as comments and thus serve as good documentation on its own.</li></ul><p>For simple use this is all you need to know. The following additional special syntax can also be used:</p><ul><li><code>#md</code>, <code>#nb</code>, <code>#jl</code>, <code>#src</code>: tags to filter lines, see <a href="fileformat.html#Filtering-Lines-1">Filtering Lines</a>,</li><li><code>#-</code>: tag to manually control chunk-splits, see <a href="pipeline.html#Custom-control-over-chunk-splits-1">Custom control over chunk splits</a>.</li></ul><p>There is also some default convenience replacements that will always be performed, see <a href="fileformat.html#Default-Replacements-1">Default Replacements</a>.</p><h2><a class="nav-anchor" id="Filtering-Lines-1" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</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 &quot;tokens&quot; 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> with one of these tokens are filtered out in the <a href="pipeline.html#Pre-processing-1">preprocessing step</a>.</p><p>Suppose, for example, that we want to include a docstring within a <code>@docs</code> block using Documenter. Obviously we don&#39;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><code class="language-julia">#md # ```@docs z = x + y</code></pre><p>In the lines starting with <code>#</code> we can use regular markdown syntax, for example the <code>#</code> used for the heading and the backticks for formatting code. The other lines are regular julia code. We note a couple of things:</p><ul><li>The script is valid julia, which means that we can <code>include</code> it and the example will run (for example in the <code>test/runtests.jl</code> script, to include the example in the test suite).</li><li>The script is "self-explanatory", i.e. the markdown lines works as comments and thus serve as good documentation on its own.</li></ul><p>For simple use this is all you need to know. The following additional special syntax can also be used:</p><ul><li><code>#md</code>, <code>#nb</code>, <code>#jl</code>, <code>#src</code>: tags to filter lines, see <a href="fileformat.html#Filtering-Lines-1">Filtering Lines</a>,</li><li><code>#-</code>: tag to manually control chunk-splits, see <a href="pipeline.html#Custom-control-over-chunk-splits-1">Custom control over chunk splits</a>.</li></ul><p>There is also some default convenience replacements that will always be performed, see <a href="fileformat.html#Default-Replacements-1">Default Replacements</a>.</p><h2><a class="nav-anchor" href="#Filtering-Lines-1" id="Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</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> with one of these tokens are filtered out in the <a href="pipeline.html#Pre-processing-1">preprocessing step</a>.</p><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><code class="language-julia">#md # ```@docs
#md # Literate.markdown #md # Literate.markdown
#md # Literate.notebook #md # Literate.notebook
#md # Literate.markdown #md # Literate.markdown
#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 simple 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><code class="language-julia">using Test #src #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 simple 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><code class="language-julia">using Test #src
@test result == expected_result #src</code></pre><h2><a class="nav-anchor" id="Default-Replacements-1" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></h2><p>The following convenience &quot;macros&quot; are always expanded:</p><ul><li><p><code>@__NAME__</code></p><p>expands to the <code>name</code> keyword argument to <a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#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>expands to <code>https://github.com/$(ENV[&quot;TRAVIS_REPO_SLUG&quot;])/blob/master/</code> and is a convenient way to use when you want to link to files outside the doc-build directory. For example <code>@__REPO__ROOT_URL__src/Literate.jl</code> would link to the source of the Literate module.</p></li><li><p><code>@__NBVIEWER_ROOT_URL__</code></p><p>expands to <code>https://nbviewer.jupyter.org/github/$(ENV[&quot;TRAVIS_REPO_SLUG&quot;])/blob/gh-pages/$(folder)/</code> where <code>folder</code> is the folder that <code>Documenter.deploydocs</code> deploys too. This can be used if you want a link that opens the generated notebook in <a href="http://nbviewer.jupyter.org/">http://nbviewer.jupyter.org/</a>.</p></li></ul><footer><hr/><a class="previous" href="index.html"><span class="direction">Previous</span><span class="title"><strong>1.</strong> Introduction</span></a><a class="next" href="pipeline.html"><span class="direction">Next</span><span class="title"><strong>3.</strong> Processing pipeline</span></a></footer></article></body></html> @test result == expected_result #src</code></pre><h2><a class="nav-anchor" href="#Default-Replacements-1" id="Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></h2><p>The following convenience "macros" are always expanded:</p><ul><li><p><code>@__NAME__</code></p><p>expands to the <code>name</code> keyword argument to <a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#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>expands to <code>https://github.com/$(ENV["TRAVIS_REPO_SLUG"])/blob/master/</code> and is a convenient way to use when you want to link to files outside the doc-build directory. For example <code>@__REPO__ROOT_URL__src/Literate.jl</code> would link to the source of the Literate module.</p></li><li><p><code>@__NBVIEWER_ROOT_URL__</code></p><p>expands to <code>https://nbviewer.jupyter.org/github/$(ENV["TRAVIS_REPO_SLUG"])/blob/gh-pages/$(folder)/</code> where <code>folder</code> is the folder that <code>Documenter.deploydocs</code> deploys too. This can be used if you want a link that opens the generated notebook in <a href="http://nbviewer.jupyter.org/">http://nbviewer.jupyter.org/</a>.</p></li></ul><footer><hr/><a class="previous" href="index.html"><span class="direction">Previous</span><span class="title"><strong>1.</strong> Introduction</span></a><a class="next" href="pipeline.html"><span class="direction">Next</span><span class="title"><strong>3.</strong> Processing pipeline</span></a></footer></article></body></HTML>

188
v1.0.0/generated/example.html

@ -1,7 +1,48 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>7. Example · Literate.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 data-main="../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>7. Example · Literate.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"><a href="../index.html"><img class="logo" src="../assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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><a class="toctext" href="../outputformats.html"><strong>4.</strong> Output Formats</a></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 class="current"><a class="toctext" href="example.html"><strong>7.</strong> Example</a><ul class="internal"></ul></li></ul></nav><article id="docs"><header><nav><ul><li><a href="example.html"><strong>7.</strong> Example</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>7. Example</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="**7.**-Example-1" href="#**7.**-Example-1"><strong>7.</strong> Example</a></h1><p>This is an example generated with Literate based on this source file: <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><code>example.jl</code></a>. You are seeing the html-output which Documenter have generated based on a markdown file generated with Literate. The corresponding notebook can be found here: <a href="https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v1.0.0/generated/example.ipynb"><code>example.ipynb</code></a>, and the plain script output can be found here: <a href="example.jl"><code>example.jl</code></a>.</p><p>It is recommended to have the <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl">source file</a> available when reading this, to better understand how the syntax in the source file corresponds to the output you are seeing.</p><h3><a class="nav-anchor" id="Basic-syntax-1" href="#Basic-syntax-1">Basic syntax</a></h3><p>The basic syntax for Literate is simple, lines starting with <code>#</code> is interpreted as markdown, and all the other lines are interpreted as code. Here is some code:</p><div><pre><code class="language-julia">x = 1//3 const head = document.getElementsByTagName('head')[0];
y = 2//5</code></pre><pre><code class="language-none">2//5</code></pre></div><p>In markdown sections we can use markdown syntax. For example, we can write <em>text in italic font</em>, <strong>text in bold font</strong> and use <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">links</a>.</p><p>It is possible to filter out lines depending on the output using the <code>#md</code>, <code>#nb</code>, <code>#jl</code> and <code>#src</code> tags (see <a href="../fileformat.html#Filtering-Lines-1">Filtering Lines</a>):</p><ul><li>This line starts with <code>#md</code> and is thus only visible in the markdown output.</li></ul><p>The source file is parsed in chunks of markdown and code. Starting a line with <code>#-</code> manually inserts a chunk break. For example, if we want to display the output of the following operations we may insert <code>#-</code> in between. These two code blocks will now end up in different <code>@example</code>-blocks in the markdown output, and two different notebook cells in the notebook output.</p><div><pre><code class="language-julia">x + y</code></pre><pre><code class="language-none">11//15</code></pre></div><div><pre><code class="language-julia">x * y</code></pre><pre><code class="language-none">2//15</code></pre></div><h3><a class="nav-anchor" id="Output-Capturing-1" href="#Output-Capturing-1">Output Capturing</a></h3><p>Code chunks are by default placed in Documenter <code>@example</code> blocks in the generated markdown. This means that the output will be captured in a block when Documenter is building the docs. In notebooks the output is captured in output cells, if the <code>execute</code> keyword argument is set to true. Output to <code>stdout</code>/<code>stderr</code> is also captured.</p><div><pre><code class="language-julia">function foo()
println(&quot;This string is printed to stdout.&quot;) // Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="../index.html"><img alt="Literate.jl logo" class="logo" src="../assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="../search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="../outputformats.html"><strong>4.</strong> Output Formats</a></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 class="current"><a class="toctext" href="example.html"><strong>7.</strong> Example</a><ul class="internal"></ul></li></ul></nav><article id="docs"><header><nav><ul><li><a href="example.html"><strong>7.</strong> Example</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>7. Example</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#**7.**-Example-1" id="**7.**-Example-1"><strong>7.</strong> Example</a></h1><p>This is an example generated with Literate based on this source file: <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><code>example.jl</code></a>. You are seeing the html-output which Documenter have generated based on a markdown file generated with Literate. The corresponding notebook can be found here: <a href="https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v1.0.0/generated/example.ipynb"><code>example.ipynb</code></a>, and the plain script output can be found here: <a href="example.jl"><code>example.jl</code></a>.</p><p>It is recommended to have the <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl">source file</a> available when reading this, to better understand how the syntax in the source file corresponds to the output you are seeing.</p><h3><a class="nav-anchor" href="#Basic-syntax-1" id="Basic-syntax-1">Basic syntax</a></h3><p>The basic syntax for Literate is simple, lines starting with <code>#</code> is interpreted as markdown, and all the other lines are interpreted as code. Here is some code:</p><div><pre><code class="language-julia">x = 1//3
y = 2//5</code></pre><pre><code class="language-none">2//5</code></pre></div><p>In markdown sections we can use markdown syntax. For example, we can write <em>text in italic font</em>, <strong>text in bold font</strong> and use <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">links</a>.</p><p>It is possible to filter out lines depending on the output using the <code>#md</code>, <code>#nb</code>, <code>#jl</code> and <code>#src</code> tags (see <a href="../fileformat.html#Filtering-Lines-1">Filtering Lines</a>):</p><ul><li>This line starts with <code>#md</code> and is thus only visible in the markdown output.</li></ul><p>The source file is parsed in chunks of markdown and code. Starting a line with <code>#-</code> manually inserts a chunk break. For example, if we want to display the output of the following operations we may insert <code>#-</code> in between. These two code blocks will now end up in different <code>@example</code>-blocks in the markdown output, and two different notebook cells in the notebook output.</p><div><pre><code class="language-julia">x + y</code></pre><pre><code class="language-none">11//15</code></pre></div><div><pre><code class="language-julia">x * y</code></pre><pre><code class="language-none">2//15</code></pre></div><h3><a class="nav-anchor" href="#Output-Capturing-1" id="Output-Capturing-1">Output Capturing</a></h3><p>Code chunks are by default placed in Documenter <code>@example</code> blocks in the generated markdown. This means that the output will be captured in a block when Documenter is building the docs. In notebooks the output is captured in output cells, if the <code>execute</code> keyword argument is set to true. Output to <code>stdout</code>/<code>stderr</code> is also captured.</p><div><pre><code class="language-julia">function foo()
println("This string is printed to stdout.")
return [1, 2, 3, 4] return [1, 2, 3, 4]
end end
@ -10,121 +51,55 @@ foo()</code></pre><pre><code class="language-none">This string is printed to std
1 1
2 2
3 3
4</code></pre></div><p>Both Documenter&#39;s <code>@example</code> block and notebooks can display images. Here is an example where we generate a simple plot using the <a href="https://github.com/JuliaPlots/Plots.jl">Plots.jl</a> package</p><div><pre><code class="language-julia">using Plots 4</code></pre></div><p>Both Documenter's <code>@example</code> block and notebooks can display images. Here is an example where we generate a simple plot using the <a href="https://github.com/JuliaPlots/Plots.jl">Plots.jl</a> package</p><div><pre><code class="language-julia">using Plots
x = range(0, stop=6π, length=1000) x = range(0, stop=6π, length=1000)
y1 = sin.(x) y1 = sin.(x)
y2 = cos.(x) y2 = cos.(x)
plot(x, [y1, y2])</code></pre><?xml version="1.0" encoding="utf-8"?> plot(x, [y1, y2])</code></pre><svg height="400" viewBox="0 0 600 400" width="600" xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"><defs><clipPath id="clip7300"><rect height="400" width="600" x="0" y="0"></rect></clipPath></defs><polygon clip-path="url(#clip7300)" fill="#ffffff" fill-opacity="1" points="
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="600" height="400" viewBox="0 0 600 400">
<defs>
<clipPath id="clip7300">
<rect x="0" y="0" width="600" height="400"/>
</clipPath>
</defs>
<polygon clip-path="url(#clip7300)" points="
0,400 600,400 600,0 0,0 0,400 600,400 600,0 0,0
" fill="#ffffff" fill-opacity="1"/> "></polygon><defs><clipPath id="clip7301"><rect height="400" width="421" x="120" y="0"></rect></clipPath></defs><polygon clip-path="url(#clip7300)" fill="#ffffff" fill-opacity="1" points="
<defs>
<clipPath id="clip7301">
<rect x="120" y="0" width="421" height="400"/>
</clipPath>
</defs>
<polygon clip-path="url(#clip7300)" points="
23.622,384.252 580.315,384.252 580.315,11.811 23.622,11.811 23.622,384.252 580.315,384.252 580.315,11.811 23.622,11.811
" fill="#ffffff" fill-opacity="1"/> "></polygon><defs><clipPath id="clip7302"><rect height="373" width="558" x="23" y="11"></rect></clipPath></defs><polyline clip-path="url(#clip7302)" points="
<defs>
<clipPath id="clip7302">
<rect x="23" y="11" width="558" height="373"/>
</clipPath>
</defs>
<polyline clip-path="url(#clip7302)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
39.3775,384.252 39.3775,11.811 39.3775,384.252 39.3775,11.811
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip7302)" points="
<polyline clip-path="url(#clip7302)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
178.686,384.252 178.686,11.811 178.686,384.252 178.686,11.811
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip7302)" points="
<polyline clip-path="url(#clip7302)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
317.995,384.252 317.995,11.811 317.995,384.252 317.995,11.811
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip7302)" points="
<polyline clip-path="url(#clip7302)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
457.304,384.252 457.304,11.811 457.304,384.252 457.304,11.811
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip7302)" points="
<polyline clip-path="url(#clip7302)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
23.622,373.713 580.315,373.713 23.622,373.713 580.315,373.713
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip7302)" points="
<polyline clip-path="url(#clip7302)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
23.622,285.873 580.315,285.873 23.622,285.873 580.315,285.873
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip7302)" points="
<polyline clip-path="url(#clip7302)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
23.622,198.032 580.315,198.032 23.622,198.032 580.315,198.032
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip7302)" points="
<polyline clip-path="url(#clip7302)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
23.622,110.192 580.315,110.192 23.622,110.192 580.315,110.192
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip7302)" points="
<polyline clip-path="url(#clip7302)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
23.622,22.3518 580.315,22.3518 23.622,22.3518 580.315,22.3518
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip7300)" points="
<polyline clip-path="url(#clip7300)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,384.252 580.315,384.252 23.622,384.252 580.315,384.252
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7300)" points="
<polyline clip-path="url(#clip7300)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,384.252 23.622,11.811 23.622,384.252 23.622,11.811
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7300)" points="
<polyline clip-path="url(#clip7300)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
39.3775,384.252 39.3775,378.665 39.3775,384.252 39.3775,378.665
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7300)" points="
<polyline clip-path="url(#clip7300)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
178.686,384.252 178.686,378.665 178.686,384.252 178.686,378.665
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7300)" points="
<polyline clip-path="url(#clip7300)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
317.995,384.252 317.995,378.665 317.995,384.252 317.995,378.665
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7300)" points="
<polyline clip-path="url(#clip7300)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
457.304,384.252 457.304,378.665 457.304,384.252 457.304,378.665
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7300)" points="
<polyline clip-path="url(#clip7300)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,373.713 31.9724,373.713 23.622,373.713 31.9724,373.713
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7300)" points="
<polyline clip-path="url(#clip7300)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,285.873 31.9724,285.873 23.622,285.873 31.9724,285.873
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7300)" points="
<polyline clip-path="url(#clip7300)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,198.032 31.9724,198.032 23.622,198.032 31.9724,198.032
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7300)" points="
<polyline clip-path="url(#clip7300)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,110.192 31.9724,110.192 23.622,110.192 31.9724,110.192
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7300)" points="
<polyline clip-path="url(#clip7300)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,22.3518 31.9724,22.3518 23.622,22.3518 31.9724,22.3518
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><g clip-path="url(#clip7300)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 39.3775, 398.052)" x="39.3775" y="398.052">0</text></g><g clip-path="url(#clip7300)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 178.686, 398.052)" x="178.686" y="398.052">5</text></g><g clip-path="url(#clip7300)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 317.995, 398.052)" x="317.995" y="398.052">10</text></g><g clip-path="url(#clip7300)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 457.304, 398.052)" x="457.304" y="398.052">15</text></g><g clip-path="url(#clip7300)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 378.213)" x="17.622" y="378.213">-1.0</text></g><g clip-path="url(#clip7300)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 290.373)" x="17.622" y="290.373">-0.5</text></g><g clip-path="url(#clip7300)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 202.532)" x="17.622" y="202.532">0.0</text></g><g clip-path="url(#clip7300)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 114.692)" x="17.622" y="114.692">0.5</text></g><g clip-path="url(#clip7300)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 26.8518)" x="17.622" y="26.8518">1.0</text></g><polyline clip-path="url(#clip7302)" points="
<g clip-path="url(#clip7300)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 39.3775, 398.052)" x="39.3775" y="398.052">0</text>
</g>
<g clip-path="url(#clip7300)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 178.686, 398.052)" x="178.686" y="398.052">5</text>
</g>
<g clip-path="url(#clip7300)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 317.995, 398.052)" x="317.995" y="398.052">10</text>
</g>
<g clip-path="url(#clip7300)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 457.304, 398.052)" x="457.304" y="398.052">15</text>
</g>
<g clip-path="url(#clip7300)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 378.213)" x="17.622" y="378.213">-1.0</text>
</g>
<g clip-path="url(#clip7300)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 290.373)" x="17.622" y="290.373">-0.5</text>
</g>
<g clip-path="url(#clip7300)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 202.532)" x="17.622" y="202.532">0.0</text>
</g>
<g clip-path="url(#clip7300)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 114.692)" x="17.622" y="114.692">0.5</text>
</g>
<g clip-path="url(#clip7300)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 26.8518)" x="17.622" y="26.8518">1.0</text>
</g>
<polyline clip-path="url(#clip7302)" style="stroke:#009af9; stroke-width:1; stroke-opacity:1; fill:none" points="
39.3775,198.032 39.9032,194.718 40.4289,191.404 40.9546,188.093 41.4803,184.786 42.006,181.483 42.5318,178.186 43.0575,174.896 43.5832,171.615 44.1089,168.342 39.3775,198.032 39.9032,194.718 40.4289,191.404 40.9546,188.093 41.4803,184.786 42.006,181.483 42.5318,178.186 43.0575,174.896 43.5832,171.615 44.1089,168.342
44.6346,165.081 45.1603,161.831 45.686,158.594 46.2117,155.371 46.7374,152.163 47.2631,148.971 47.7888,145.797 48.3145,142.642 48.8402,139.506 49.366,136.391 44.6346,165.081 45.1603,161.831 45.686,158.594 46.2117,155.371 46.7374,152.163 47.2631,148.971 47.7888,145.797 48.3145,142.642 48.8402,139.506 49.366,136.391
49.8917,133.298 50.4174,130.229 50.9431,127.183 51.4688,124.162 51.9945,121.168 52.5202,118.201 53.0459,115.263 53.5716,112.354 54.0973,109.475 54.623,106.629 49.8917,133.298 50.4174,130.229 50.9431,127.183 51.4688,124.162 51.9945,121.168 52.5202,118.201 53.0459,115.263 53.5716,112.354 54.0973,109.475 54.623,106.629
@ -226,8 +201,7 @@ plot(x, [y1, y2])</code></pre><?xml version="1.0" encoding="utf-8"?>
554.571,259.674 555.097,256.559 555.622,253.423 556.148,250.268 556.674,247.094 557.2,243.902 557.725,240.694 558.251,237.471 558.777,234.234 559.302,230.984 554.571,259.674 555.097,256.559 555.622,253.423 556.148,250.268 556.674,247.094 557.2,243.902 557.725,240.694 558.251,237.471 558.777,234.234 559.302,230.984
559.828,227.723 560.354,224.45 560.88,221.169 561.405,217.879 561.931,214.582 562.457,211.279 562.982,207.972 563.508,204.661 564.034,201.347 564.56,198.032 559.828,227.723 560.354,224.45 560.88,221.169 561.405,217.879 561.931,214.582 562.457,211.279 562.982,207.972 563.508,204.661 564.034,201.347 564.56,198.032
"/> " style="stroke:#009af9; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7302)" points="
<polyline clip-path="url(#clip7302)" style="stroke:#e26f46; stroke-width:1; stroke-opacity:1; fill:none" points="
39.3775,22.3518 39.9032,22.3831 40.4289,22.4769 40.9546,22.6332 41.4803,22.8519 42.006,23.133 42.5318,23.4764 43.0575,23.8819 43.5832,24.3495 44.1089,24.8788 39.3775,22.3518 39.9032,22.3831 40.4289,22.4769 40.9546,22.6332 41.4803,22.8519 42.006,23.133 42.5318,23.4764 43.0575,23.8819 43.5832,24.3495 44.1089,24.8788
44.6346,25.4698 45.1603,26.1222 45.686,26.8359 46.2117,27.6104 46.7374,28.4457 47.2631,29.3413 47.7888,30.297 48.3145,31.3124 48.8402,32.3871 49.366,33.5209 44.6346,25.4698 45.1603,26.1222 45.686,26.8359 46.2117,27.6104 46.7374,28.4457 47.2631,29.3413 47.7888,30.297 48.3145,31.3124 48.8402,32.3871 49.366,33.5209
49.8917,34.7131 50.4174,35.9636 50.9431,37.2717 51.4688,38.637 51.9945,40.0591 52.5202,41.5375 53.0459,43.0715 53.5716,44.6608 54.0973,46.3046 54.623,48.0024 49.8917,34.7131 50.4174,35.9636 50.9431,37.2717 51.4688,38.637 51.9945,40.0591 52.5202,41.5375 53.0459,43.0715 53.5716,44.6608 54.0973,46.3046 54.623,48.0024
@ -329,24 +303,12 @@ plot(x, [y1, y2])</code></pre><?xml version="1.0" encoding="utf-8"?>
554.571,33.5209 555.097,32.3871 555.622,31.3124 556.148,30.297 556.674,29.3413 557.2,28.4457 557.725,27.6104 558.251,26.8359 558.777,26.1222 559.302,25.4698 554.571,33.5209 555.097,32.3871 555.622,31.3124 556.148,30.297 556.674,29.3413 557.2,28.4457 557.725,27.6104 558.251,26.8359 558.777,26.1222 559.302,25.4698
559.828,24.8788 560.354,24.3495 560.88,23.8819 561.405,23.4764 561.931,23.133 562.457,22.8519 562.982,22.6332 563.508,22.4769 564.034,22.3831 564.56,22.3518 559.828,24.8788 560.354,24.3495 560.88,23.8819 561.405,23.4764 561.931,23.133 562.457,22.8519 562.982,22.6332 563.508,22.4769 564.034,22.3831 564.56,22.3518
"/> " style="stroke:#e26f46; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polygon clip-path="url(#clip7300)" fill="#ffffff" fill-opacity="1" points="
<polygon clip-path="url(#clip7300)" points="
489.608,78.051 562.315,78.051 562.315,32.691 489.608,32.691 489.608,78.051 562.315,78.051 562.315,32.691 489.608,32.691
" fill="#ffffff" fill-opacity="1"/> "></polygon><polyline clip-path="url(#clip7300)" points="
<polyline clip-path="url(#clip7300)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
489.608,78.051 562.315,78.051 562.315,32.691 489.608,32.691 489.608,78.051 489.608,78.051 562.315,78.051 562.315,32.691 489.608,32.691 489.608,78.051
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7300)" points="
<polyline clip-path="url(#clip7300)" style="stroke:#009af9; stroke-width:1; stroke-opacity:1; fill:none" points="
495.608,47.811 531.608,47.811 495.608,47.811 531.608,47.811
"/> " style="stroke:#009af9; stroke-width:1; stroke-opacity:1; fill:none"></polyline><g clip-path="url(#clip7300)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:start;" transform="rotate(0, 537.608, 52.311)" x="537.608" y="52.311">y1</text></g><polyline clip-path="url(#clip7300)" points="
<g clip-path="url(#clip7300)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:start;" transform="rotate(0, 537.608, 52.311)" x="537.608" y="52.311">y1</text>
</g>
<polyline clip-path="url(#clip7300)" style="stroke:#e26f46; stroke-width:1; stroke-opacity:1; fill:none" points="
495.608,62.931 531.608,62.931 495.608,62.931 531.608,62.931
"/> " style="stroke:#e26f46; stroke-width:1; stroke-opacity:1; fill:none"></polyline><g clip-path="url(#clip7300)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:start;" transform="rotate(0, 537.608, 67.431)" x="537.608" y="67.431">y2</text></g></svg></div><h3><a class="nav-anchor" href="#Custom-processing-1" id="Custom-processing-1">Custom processing</a></h3><p>It is possible to give Literate custom pre- and post-processing functions. For example, here we insert two placeholders, which we will replace with something else at time of generation. We have here replaced our placeholders with <code>z</code> and <code>1.0 + 2.0im</code>:</p><div><pre><code class="language-julia">z = 1.0 + 2.0im</code></pre><pre><code class="language-none">1.0 + 2.0im</code></pre></div><h3><a class="nav-anchor" href="#documenter-interaction-1" id="documenter-interaction-1">Documenter.jl interaction</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, <a href="example.html#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><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p><footer><hr/><a class="previous" href="../documenter.html"><span class="direction">Previous</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></HTML>
<g clip-path="url(#clip7300)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:start;" transform="rotate(0, 537.608, 67.431)" x="537.608" y="67.431">y2</text>
</g>
</svg>
</div><h3><a class="nav-anchor" id="Custom-processing-1" href="#Custom-processing-1">Custom processing</a></h3><p>It is possible to give Literate custom pre- and post-processing functions. For example, here we insert two placeholders, which we will replace with something else at time of generation. We have here replaced our placeholders with <code>z</code> and <code>1.0 + 2.0im</code>:</p><div><pre><code class="language-julia">z = 1.0 + 2.0im</code></pre><pre><code class="language-none">1.0 + 2.0im</code></pre></div><h3><a class="nav-anchor" id="documenter-interaction-1" href="#documenter-interaction-1">Documenter.jl interaction</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, <a href="example.html#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><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p><footer><hr/><a class="previous" href="../documenter.html"><span class="direction">Previous</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></html>

45
v1.0.0/index.html

File diff suppressed because one or more lines are too long

53
v1.0.0/outputformats.html

File diff suppressed because one or more lines are too long

51
v1.0.0/pipeline.html

File diff suppressed because one or more lines are too long

45
v1.0.0/search.html

@ -1,2 +1,43 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>Search · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Search · Literate.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"><a href="index.html"><img class="logo" src="assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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><header><nav><ul><li>Search</li></ul></nav><hr/><div id="topbar"><span>Search</span><a class="fa fa-bars" href="#"></a></div></header><h1>Search</h1><p id="search-info">Number of results: <span id="search-results-number">loading...</span></p><ul id="search-results"></ul></article></body><script src="search_index.js"></script><script src="assets/search.js"></script></html> const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="index.html"><img alt="Literate.jl logo" class="logo" src="assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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><header><nav><ul><li>Search</li></ul></nav><hr/><div id="topbar"><span>Search</span><a class="fa fa-bars" href="#"></a></div></header><h1>Search</h1><p id="search-info">Number of results: <span id="search-results-number">loading...</span></p><ul id="search-results"></ul></article><script src="search_index.js"></script><script src="assets/search.js"></script></body></HTML>

49
v1.0.1/customprocessing.html

@ -1,8 +1,49 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>5. Custom pre- and post-processing · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>5. Custom pre- and post-processing · Literate.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"><a href="index.html"><img class="logo" src="assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li class="current"><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a><ul class="internal"></ul></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="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/customprocessing.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>5. Custom pre- and post-processing</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Custom-pre-and-post-processing-1" href="#Custom-pre-and-post-processing-1"><strong>5.</strong> Custom pre- and post-processing</a></h1><p>Since all packages are different, and may have different demands on how to create a nice example for the documentation it is important that the package maintainer does not feel limited by the by default provided syntax that this package offers. While you can generally come a long way by utilizing <a href="fileformat.html#Filtering-Lines-1">line filtering</a> there might be situations where you need to manually hook into the generation and change things. In Literate this is done by letting the user supply custom pre- and post-processing functions that may do transformation of the content.</p><p>All of the generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) accepts <code>preprocess</code> and <code>postprocess</code> keyword arguments. The default &quot;transformation&quot; is the <code>identity</code> function. The input to the transformation functions is a <code>String</code>, and the output should be the transformed <code>String</code>.</p><p><code>preprocess</code> is sent the raw input that is read from the source file (<a href="pipeline.html#Pre-processing-1">modulo the default line ending transformation</a>). <code>postprocess</code> is given different things depending on the output: For markdown and script output <code>postprocess</code> is given the content <code>String</code> just before writing it to the output file, but for notebook output <code>postprocess</code> is given the dictionary representing the notebook, since, in general, this is more useful.</p><p>As an example, lets say we want to splice the date of generation into the output. We could of course update our source file before generating the docs, but we could instead use a <code>preprocess</code> function that splices the date into the source for us. Consider the following source file:</p><pre><code class="language-julia"># # Example const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="index.html"><img alt="Literate.jl logo" class="logo" src="assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li class="current"><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a><ul class="internal"></ul></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="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/customprocessing.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>5. Custom pre- and post-processing</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#Custom-pre-and-post-processing-1" id="Custom-pre-and-post-processing-1"><strong>5.</strong> Custom pre- and post-processing</a></h1><p>Since all packages are different, and may have different demands on how to create a nice example for the documentation it is important that the package maintainer does not feel limited by the by default provided syntax that this package offers. While you can generally come a long way by utilizing <a href="fileformat.html#Filtering-Lines-1">line filtering</a> there might be situations where you need to manually hook into the generation and change things. In Literate this is done by letting the user supply custom pre- and post-processing functions that may do transformation of the content.</p><p>All of the generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) accepts <code>preprocess</code> and <code>postprocess</code> keyword arguments. The default "transformation" is the <code>identity</code> function. The input to the transformation functions is a <code>String</code>, and the output should be the transformed <code>String</code>.</p><p><code>preprocess</code> is sent the raw input that is read from the source file (<a href="pipeline.html#Pre-processing-1">modulo the default line ending transformation</a>). <code>postprocess</code> is given different things depending on the output: For markdown and script output <code>postprocess</code> is given the content <code>String</code> just before writing it to the output file, but for notebook output <code>postprocess</code> is given the dictionary representing the notebook, since, in general, this is more useful.</p><p>As an example, lets say we want to splice the date of generation into the output. We could of course update our source file before generating the docs, but we could instead use a <code>preprocess</code> function that splices the date into the source for us. Consider the following source file:</p><pre><code class="language-julia"># # Example
# This example was generated DATEOFTODAY # This example was generated DATEOFTODAY
x = 1 // 3</code></pre><p>where <code>DATEOFTODAY</code> is a placeholder, to make it easier for our <code>preprocess</code> function to find the location. Now, lets define the <code>preprocess</code> function, for example</p><pre><code class="language-julia">function update_date(content) x = 1 // 3</code></pre><p>where <code>DATEOFTODAY</code> is a placeholder, to make it easier for our <code>preprocess</code> function to find the location. Now, lets define the <code>preprocess</code> function, for example</p><pre><code class="language-julia">function update_date(content)
content = replace(content, &quot;DATEOFTODAY&quot; =&gt; Date(now())) content = replace(content, "DATEOFTODAY" =&gt; Date(now()))
return content return content
end</code></pre><p>which would replace every occurrence of <code>&quot;DATEOFTODAY&quot;</code> with the current date. We would now simply give this function to the generator, for example:</p><pre><code class="language-julia">Literate.markdown(&quot;input.jl&quot;, &quot;outputdir&quot;; preprocess = update_date)</code></pre><footer><hr/><a class="previous" href="outputformats.html"><span class="direction">Previous</span><span class="title"><strong>4.</strong> Output Formats</span></a><a class="next" href="documenter.html"><span class="direction">Next</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></html> end</code></pre><p>which would replace every occurrence of <code>"DATEOFTODAY"</code> with the current date. We would now simply give this function to the generator, for example:</p><pre><code class="language-julia">Literate.markdown("input.jl", "outputdir"; preprocess = update_date)</code></pre><footer><hr/><a class="previous" href="outputformats.html"><span class="direction">Previous</span><span class="title"><strong>4.</strong> Output Formats</span></a><a class="next" href="documenter.html"><span class="direction">Next</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></HTML>

53
v1.0.1/documenter.html

@ -1,12 +1,53 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>6. Interaction with Documenter.jl · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>6. Interaction with Documenter.jl · Literate.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"><a href="index.html"><img class="logo" src="assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li><li class="current"><a class="toctext" href="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a><ul class="internal"></ul></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="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/documenter.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>6. Interaction with Documenter.jl</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Interaction-with-Documenter-1" href="#Interaction-with-Documenter-1"><strong>6.</strong> Interaction with Documenter.jl</a></h1><p>Literate can be used for any purpose, it spits out regular markdown files, and notebooks. Typically, though, these files will be used to render documentation for your package. The generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) supports a keyword argument <code>documenter</code> that lets the generator perform some extra things, keeping in mind that the source code have been written with Documenter.jl in mind. So lets take a look at what will happen if we set <code>documenter = true</code>:</p><h3><a class="nav-anchor" id="[Literate.markdown](@ref):-1" href="#[Literate.markdown](@ref):-1"><a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>:</a></h3><ul><li>The default code fence will change from<pre><code class="language-none">```julia const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="index.html"><img alt="Literate.jl logo" class="logo" src="assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li><li class="current"><a class="toctext" href="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a><ul class="internal"></ul></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="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/documenter.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>6. Interaction with Documenter.jl</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#Interaction-with-Documenter-1" id="Interaction-with-Documenter-1"><strong>6.</strong> Interaction with Documenter.jl</a></h1><p>Literate can be used for any purpose, it spits out regular markdown files, and notebooks. Typically, though, these files will be used to render documentation for your package. The generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) supports a keyword argument <code>documenter</code> that lets the generator perform some extra things, keeping in mind that the source code have been written with Documenter.jl in mind. So lets take a look at what will happen if we set <code>documenter = true</code>:</p><h3><a class="nav-anchor" href="#[Literate.markdown](@ref):-1" id="[Literate.markdown](@ref):-1"></a><a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>:</h3><ul><li>The default code fence will change from<pre><code class="language-none">```julia
# code # code
```</code></pre>to Documenters <code>@example</code> blocks:<pre><code class="language-none">```@examples $(name) ```</code></pre>to Documenters <code>@example</code> blocks:<pre><code class="language-none">```@examples $(name)
# code # code
```</code></pre></li><li>The following <code>@meta</code> block will be added to the top of the markdown page, which redirects the &quot;Edit on GitHub&quot; link on the top of the page to the <em>source file</em> rather than the generated <code>.md</code> file:<pre><code class="language-none">```@meta ```</code></pre></li><li>The following <code>@meta</code> block will be added to the top of the markdown page, which redirects the "Edit on GitHub" link on the top of the page to the <em>source file</em> rather than the generated <code>.md</code> file:<pre><code class="language-none">```@meta
EditURL = &quot;$(relpath(inputfile, outputdir))&quot; EditURL = "$(relpath(inputfile, outputdir))"
```</code></pre></li></ul><h3><a class="nav-anchor" id="[Literate.notebook](@ref):-1" href="#[Literate.notebook](@ref):-1"><a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a>:</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 notebook.</li><li>Documenter style markdown math<pre><code class="language-none">```math ```</code></pre></li></ul><h3><a class="nav-anchor" href="#[Literate.notebook](@ref):-1" id="[Literate.notebook](@ref):-1"></a><a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></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 notebook.</li><li>Documenter style markdown math<pre><code class="language-none">```math
\int f dx \int f dx
```</code></pre>is replaced with notebook compatible<pre><code class="language-none">\begin{equation} ```</code></pre>is replaced with notebook compatible<pre><code class="language-none">\begin{equation}
\int f dx \int f dx
\end{equation}</code></pre></li></ul><h3><a class="nav-anchor" id="[Literate.script](@ref):-1" href="#[Literate.script](@ref):-1"><a href="outputformats.html#Literate.script"><code>Literate.script</code></a>:</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><footer><hr/><a class="previous" href="customprocessing.html"><span class="direction">Previous</span><span class="title"><strong>5.</strong> Custom pre- and post-processing</span></a><a class="next" href="generated/example.html"><span class="direction">Next</span><span class="title"><strong>7.</strong> Example</span></a></footer></article></body></html> \end{equation}</code></pre></li></ul><h3><a class="nav-anchor" href="#[Literate.script](@ref):-1" id="[Literate.script](@ref):-1"></a><a href="outputformats.html#Literate.script"><code>Literate.script</code></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><footer><hr/><a class="previous" href="customprocessing.html"><span class="direction">Previous</span><span class="title"><strong>5.</strong> Custom pre- and post-processing</span></a><a class="next" href="generated/example.html"><span class="direction">Next</span><span class="title"><strong>7.</strong> Example</span></a></footer></article></body></HTML>

49
v1.0.1/fileformat.html

@ -1,5 +1,46 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>2. File Format · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>2. File Format · Literate.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"><a href="index.html"><img class="logo" src="assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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 class="current"><a class="toctext" href="fileformat.html"><strong>2.</strong> File Format</a><ul class="internal"><li><a class="toctext" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></li><li><a class="toctext" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</a></li><li><a class="toctext" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></li></ul></li><li><a class="toctext" href="pipeline.html"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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="fileformat.html"><strong>2.</strong> File Format</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/fileformat.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>2. File Format</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="**2.**-File-Format-1" href="#**2.**-File-Format-1"><strong>2.</strong> File Format</a></h1><p>The source file format for Literate is a regular, commented, julia (<code>.jl</code>) scripts. The idea is that the scripts also serve as documentation on their own and it is also simple to include them in the test-suite, with e.g. <code>include</code>, to make sure the examples stay up do date with other changes in your package.</p><h2><a class="nav-anchor" id="Syntax-1" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></h2><p>The basic syntax is simple:</p><ul><li>lines starting with <code>#</code> are treated as markdown,</li><li>all other lines are treated as julia code.</li></ul><p>Leading whitespace is allowed before <code>#</code>, but it will be removed when generating the output. Since <code>#</code>-lines is treated as markdown we can not use that for regular julia comments, for this you can instead use <code>##</code>, which will render as <code>#</code> in the output.</p><p>Lets look at a simple example:</p><pre><code class="language-julia"># # Rational numbers const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="index.html"><img alt="Literate.jl logo" class="logo" src="assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="index.html"><strong>1.</strong> Introduction</a></li><li class="current"><a class="toctext" href="fileformat.html"><strong>2.</strong> File Format</a><ul class="internal"><li><a class="toctext" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></li><li><a class="toctext" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</a></li><li><a class="toctext" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></li></ul></li><li><a class="toctext" href="pipeline.html"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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="fileformat.html"><strong>2.</strong> File Format</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/fileformat.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>2. File Format</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#**2.**-File-Format-1" id="**2.**-File-Format-1"><strong>2.</strong> File Format</a></h1><p>The source file format for Literate is a regular, commented, julia (<code>.jl</code>) scripts. The idea is that the scripts also serve as documentation on their own and it is also simple to include them in the test-suite, with e.g. <code>include</code>, to make sure the examples stay up do date with other changes in your package.</p><h2><a class="nav-anchor" href="#Syntax-1" id="Syntax-1"><strong>2.1.</strong> Syntax</a></h2><p>The basic syntax is simple:</p><ul><li>lines starting with <code>#</code> are treated as markdown,</li><li>all other lines are treated as julia code.</li></ul><p>Leading whitespace is allowed before <code>#</code>, but it will be removed when generating the output. Since <code>#</code>-lines is treated as markdown we can not use that for regular julia comments, for this you can instead use <code>##</code>, which will render as <code>#</code> in the output.</p><p>Lets look at a simple example:</p><pre><code class="language-julia"># # Rational numbers
# #
# In julia rational numbers can be constructed with the `//` operator. # In julia rational numbers can be constructed with the `//` operator.
# Lets define two rational numbers, `x` and `y`: # Lets define two rational numbers, `x` and `y`:
@ -9,9 +50,9 @@ y = 2//5
# When adding `x` and `y` together we obtain a new rational number: # When adding `x` and `y` together we obtain a new rational number:
z = x + y</code></pre><p>In the lines starting with <code>#</code> we can use regular markdown syntax, for example the <code>#</code> used for the heading and the backticks for formatting code. The other lines are regular julia code. We note a couple of things:</p><ul><li>The script is valid julia, which means that we can <code>include</code> it and the example will run (for example in the <code>test/runtests.jl</code> script, to include the example in the test suite).</li><li>The script is &quot;self-explanatory&quot;, i.e. the markdown lines works as comments and thus serve as good documentation on its own.</li></ul><p>For simple use this is all you need to know. The following additional special syntax can also be used:</p><ul><li><code>#md</code>, <code>#nb</code>, <code>#jl</code>, <code>#src</code>: tags to filter lines, see <a href="fileformat.html#Filtering-Lines-1">Filtering Lines</a>,</li><li><code>#-</code>: tag to manually control chunk-splits, see <a href="pipeline.html#Custom-control-over-chunk-splits-1">Custom control over chunk splits</a>.</li></ul><p>There is also some default convenience replacements that will always be performed, see <a href="fileformat.html#Default-Replacements-1">Default Replacements</a>.</p><h2><a class="nav-anchor" id="Filtering-Lines-1" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</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 &quot;tokens&quot; 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> with one of these tokens are filtered out in the <a href="pipeline.html#Pre-processing-1">preprocessing step</a>.</p><p>Suppose, for example, that we want to include a docstring within a <code>@docs</code> block using Documenter. Obviously we don&#39;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><code class="language-julia">#md # ```@docs z = x + y</code></pre><p>In the lines starting with <code>#</code> we can use regular markdown syntax, for example the <code>#</code> used for the heading and the backticks for formatting code. The other lines are regular julia code. We note a couple of things:</p><ul><li>The script is valid julia, which means that we can <code>include</code> it and the example will run (for example in the <code>test/runtests.jl</code> script, to include the example in the test suite).</li><li>The script is "self-explanatory", i.e. the markdown lines works as comments and thus serve as good documentation on its own.</li></ul><p>For simple use this is all you need to know. The following additional special syntax can also be used:</p><ul><li><code>#md</code>, <code>#nb</code>, <code>#jl</code>, <code>#src</code>: tags to filter lines, see <a href="fileformat.html#Filtering-Lines-1">Filtering Lines</a>,</li><li><code>#-</code>: tag to manually control chunk-splits, see <a href="pipeline.html#Custom-control-over-chunk-splits-1">Custom control over chunk splits</a>.</li></ul><p>There is also some default convenience replacements that will always be performed, see <a href="fileformat.html#Default-Replacements-1">Default Replacements</a>.</p><h2><a class="nav-anchor" href="#Filtering-Lines-1" id="Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</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> with one of these tokens are filtered out in the <a href="pipeline.html#Pre-processing-1">preprocessing step</a>.</p><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><code class="language-julia">#md # ```@docs
#md # Literate.markdown #md # Literate.markdown
#md # Literate.notebook #md # Literate.notebook
#md # Literate.markdown #md # Literate.markdown
#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 simple 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><code class="language-julia">using Test #src #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 simple 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><code class="language-julia">using Test #src
@test result == expected_result #src</code></pre><h2><a class="nav-anchor" id="Default-Replacements-1" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></h2><p>The following convenience &quot;macros&quot; are always expanded:</p><ul><li><p><code>@__NAME__</code></p><p>expands to the <code>name</code> keyword argument to <a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#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>expands to <code>https://github.com/$(ENV[&quot;TRAVIS_REPO_SLUG&quot;])/blob/master/</code> and is a convenient way to use when you want to link to files outside the doc-build directory. For example <code>@__REPO__ROOT_URL__src/Literate.jl</code> would link to the source of the Literate module.</p></li><li><p><code>@__NBVIEWER_ROOT_URL__</code></p><p>expands to <code>https://nbviewer.jupyter.org/github/$(ENV[&quot;TRAVIS_REPO_SLUG&quot;])/blob/gh-pages/$(folder)/</code> where <code>folder</code> is the folder that <code>Documenter.deploydocs</code> deploys too. This can be used if you want a link that opens the generated notebook in <a href="http://nbviewer.jupyter.org/">http://nbviewer.jupyter.org/</a>.</p></li></ul><footer><hr/><a class="previous" href="index.html"><span class="direction">Previous</span><span class="title"><strong>1.</strong> Introduction</span></a><a class="next" href="pipeline.html"><span class="direction">Next</span><span class="title"><strong>3.</strong> Processing pipeline</span></a></footer></article></body></html> @test result == expected_result #src</code></pre><h2><a class="nav-anchor" href="#Default-Replacements-1" id="Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></h2><p>The following convenience "macros" are always expanded:</p><ul><li><p><code>@__NAME__</code></p><p>expands to the <code>name</code> keyword argument to <a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#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>expands to <code>https://github.com/$(ENV["TRAVIS_REPO_SLUG"])/blob/master/</code> and is a convenient way to use when you want to link to files outside the doc-build directory. For example <code>@__REPO__ROOT_URL__src/Literate.jl</code> would link to the source of the Literate module.</p></li><li><p><code>@__NBVIEWER_ROOT_URL__</code></p><p>expands to <code>https://nbviewer.jupyter.org/github/$(ENV["TRAVIS_REPO_SLUG"])/blob/gh-pages/$(folder)/</code> where <code>folder</code> is the folder that <code>Documenter.deploydocs</code> deploys too. This can be used if you want a link that opens the generated notebook in <a href="http://nbviewer.jupyter.org/">http://nbviewer.jupyter.org/</a>.</p></li></ul><footer><hr/><a class="previous" href="index.html"><span class="direction">Previous</span><span class="title"><strong>1.</strong> Introduction</span></a><a class="next" href="pipeline.html"><span class="direction">Next</span><span class="title"><strong>3.</strong> Processing pipeline</span></a></footer></article></body></HTML>

188
v1.0.1/generated/example.html

@ -1,7 +1,48 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>7. Example · Literate.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 data-main="../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>7. Example · Literate.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"><a href="../index.html"><img class="logo" src="../assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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><a class="toctext" href="../outputformats.html"><strong>4.</strong> Output Formats</a></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 class="current"><a class="toctext" href="example.html"><strong>7.</strong> Example</a><ul class="internal"></ul></li></ul></nav><article id="docs"><header><nav><ul><li><a href="example.html"><strong>7.</strong> Example</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>7. Example</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="**7.**-Example-1" href="#**7.**-Example-1"><strong>7.</strong> Example</a></h1><p>This is an example generated with Literate based on this source file: <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><code>example.jl</code></a>. You are seeing the html-output which Documenter have generated based on a markdown file generated with Literate. The corresponding notebook can be found here: <a href="https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v1.0.1/generated/example.ipynb"><code>example.ipynb</code></a>, and the plain script output can be found here: <a href="example.jl"><code>example.jl</code></a>.</p><p>It is recommended to have the <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl">source file</a> available when reading this, to better understand how the syntax in the source file corresponds to the output you are seeing.</p><h3><a class="nav-anchor" id="Basic-syntax-1" href="#Basic-syntax-1">Basic syntax</a></h3><p>The basic syntax for Literate is simple, lines starting with <code>#</code> is interpreted as markdown, and all the other lines are interpreted as code. Here is some code:</p><div><pre><code class="language-julia">x = 1//3 const head = document.getElementsByTagName('head')[0];
y = 2//5</code></pre><pre><code class="language-none">2//5</code></pre></div><p>In markdown sections we can use markdown syntax. For example, we can write <em>text in italic font</em>, <strong>text in bold font</strong> and use <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">links</a>.</p><p>It is possible to filter out lines depending on the output using the <code>#md</code>, <code>#nb</code>, <code>#jl</code> and <code>#src</code> tags (see <a href="../fileformat.html#Filtering-Lines-1">Filtering Lines</a>):</p><ul><li>This line starts with <code>#md</code> and is thus only visible in the markdown output.</li></ul><p>The source file is parsed in chunks of markdown and code. Starting a line with <code>#-</code> manually inserts a chunk break. For example, if we want to display the output of the following operations we may insert <code>#-</code> in between. These two code blocks will now end up in different <code>@example</code>-blocks in the markdown output, and two different notebook cells in the notebook output.</p><div><pre><code class="language-julia">x + y</code></pre><pre><code class="language-none">11//15</code></pre></div><div><pre><code class="language-julia">x * y</code></pre><pre><code class="language-none">2//15</code></pre></div><h3><a class="nav-anchor" id="Output-Capturing-1" href="#Output-Capturing-1">Output Capturing</a></h3><p>Code chunks are by default placed in Documenter <code>@example</code> blocks in the generated markdown. This means that the output will be captured in a block when Documenter is building the docs. In notebooks the output is captured in output cells, if the <code>execute</code> keyword argument is set to true. Output to <code>stdout</code>/<code>stderr</code> is also captured.</p><div><pre><code class="language-julia">function foo()
println(&quot;This string is printed to stdout.&quot;) // Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="../index.html"><img alt="Literate.jl logo" class="logo" src="../assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="../search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="../outputformats.html"><strong>4.</strong> Output Formats</a></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 class="current"><a class="toctext" href="example.html"><strong>7.</strong> Example</a><ul class="internal"></ul></li></ul></nav><article id="docs"><header><nav><ul><li><a href="example.html"><strong>7.</strong> Example</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>7. Example</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#**7.**-Example-1" id="**7.**-Example-1"><strong>7.</strong> Example</a></h1><p>This is an example generated with Literate based on this source file: <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><code>example.jl</code></a>. You are seeing the html-output which Documenter have generated based on a markdown file generated with Literate. The corresponding notebook can be found here: <a href="https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v1.0.1/generated/example.ipynb"><code>example.ipynb</code></a>, and the plain script output can be found here: <a href="example.jl"><code>example.jl</code></a>.</p><p>It is recommended to have the <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl">source file</a> available when reading this, to better understand how the syntax in the source file corresponds to the output you are seeing.</p><h3><a class="nav-anchor" href="#Basic-syntax-1" id="Basic-syntax-1">Basic syntax</a></h3><p>The basic syntax for Literate is simple, lines starting with <code>#</code> is interpreted as markdown, and all the other lines are interpreted as code. Here is some code:</p><div><pre><code class="language-julia">x = 1//3
y = 2//5</code></pre><pre><code class="language-none">2//5</code></pre></div><p>In markdown sections we can use markdown syntax. For example, we can write <em>text in italic font</em>, <strong>text in bold font</strong> and use <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">links</a>.</p><p>It is possible to filter out lines depending on the output using the <code>#md</code>, <code>#nb</code>, <code>#jl</code> and <code>#src</code> tags (see <a href="../fileformat.html#Filtering-Lines-1">Filtering Lines</a>):</p><ul><li>This line starts with <code>#md</code> and is thus only visible in the markdown output.</li></ul><p>The source file is parsed in chunks of markdown and code. Starting a line with <code>#-</code> manually inserts a chunk break. For example, if we want to display the output of the following operations we may insert <code>#-</code> in between. These two code blocks will now end up in different <code>@example</code>-blocks in the markdown output, and two different notebook cells in the notebook output.</p><div><pre><code class="language-julia">x + y</code></pre><pre><code class="language-none">11//15</code></pre></div><div><pre><code class="language-julia">x * y</code></pre><pre><code class="language-none">2//15</code></pre></div><h3><a class="nav-anchor" href="#Output-Capturing-1" id="Output-Capturing-1">Output Capturing</a></h3><p>Code chunks are by default placed in Documenter <code>@example</code> blocks in the generated markdown. This means that the output will be captured in a block when Documenter is building the docs. In notebooks the output is captured in output cells, if the <code>execute</code> keyword argument is set to true. Output to <code>stdout</code>/<code>stderr</code> is also captured.</p><div><pre><code class="language-julia">function foo()
println("This string is printed to stdout.")
return [1, 2, 3, 4] return [1, 2, 3, 4]
end end
@ -10,121 +51,55 @@ foo()</code></pre><pre><code class="language-none">This string is printed to std
1 1
2 2
3 3
4</code></pre></div><p>Both Documenter&#39;s <code>@example</code> block and notebooks can display images. Here is an example where we generate a simple plot using the <a href="https://github.com/JuliaPlots/Plots.jl">Plots.jl</a> package</p><div><pre><code class="language-julia">using Plots 4</code></pre></div><p>Both Documenter's <code>@example</code> block and notebooks can display images. Here is an example where we generate a simple plot using the <a href="https://github.com/JuliaPlots/Plots.jl">Plots.jl</a> package</p><div><pre><code class="language-julia">using Plots
x = range(0, stop=6π, length=1000) x = range(0, stop=6π, length=1000)
y1 = sin.(x) y1 = sin.(x)
y2 = cos.(x) y2 = cos.(x)
plot(x, [y1, y2])</code></pre><?xml version="1.0" encoding="utf-8"?> plot(x, [y1, y2])</code></pre><svg height="400" viewBox="0 0 600 400" width="600" xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"><defs><clipPath id="clip4100"><rect height="400" width="600" x="0" y="0"></rect></clipPath></defs><polygon clip-path="url(#clip4100)" fill="#ffffff" fill-opacity="1" points="
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="600" height="400" viewBox="0 0 600 400">
<defs>
<clipPath id="clip4100">
<rect x="0" y="0" width="600" height="400"/>
</clipPath>
</defs>
<polygon clip-path="url(#clip4100)" points="
0,400 600,400 600,0 0,0 0,400 600,400 600,0 0,0
" fill="#ffffff" fill-opacity="1"/> "></polygon><defs><clipPath id="clip4101"><rect height="400" width="421" x="120" y="0"></rect></clipPath></defs><polygon clip-path="url(#clip4100)" fill="#ffffff" fill-opacity="1" points="
<defs>
<clipPath id="clip4101">
<rect x="120" y="0" width="421" height="400"/>
</clipPath>
</defs>
<polygon clip-path="url(#clip4100)" points="
23.622,384.252 580.315,384.252 580.315,11.811 23.622,11.811 23.622,384.252 580.315,384.252 580.315,11.811 23.622,11.811
" fill="#ffffff" fill-opacity="1"/> "></polygon><defs><clipPath id="clip4102"><rect height="373" width="558" x="23" y="11"></rect></clipPath></defs><polyline clip-path="url(#clip4102)" points="
<defs>
<clipPath id="clip4102">
<rect x="23" y="11" width="558" height="373"/>
</clipPath>
</defs>
<polyline clip-path="url(#clip4102)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
39.3775,384.252 39.3775,11.811 39.3775,384.252 39.3775,11.811
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip4102)" points="
<polyline clip-path="url(#clip4102)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
178.686,384.252 178.686,11.811 178.686,384.252 178.686,11.811
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip4102)" points="
<polyline clip-path="url(#clip4102)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
317.995,384.252 317.995,11.811 317.995,384.252 317.995,11.811
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip4102)" points="
<polyline clip-path="url(#clip4102)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
457.304,384.252 457.304,11.811 457.304,384.252 457.304,11.811
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip4102)" points="
<polyline clip-path="url(#clip4102)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
23.622,373.713 580.315,373.713 23.622,373.713 580.315,373.713
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip4102)" points="
<polyline clip-path="url(#clip4102)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
23.622,285.873 580.315,285.873 23.622,285.873 580.315,285.873
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip4102)" points="
<polyline clip-path="url(#clip4102)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
23.622,198.032 580.315,198.032 23.622,198.032 580.315,198.032
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip4102)" points="
<polyline clip-path="url(#clip4102)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
23.622,110.192 580.315,110.192 23.622,110.192 580.315,110.192
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip4102)" points="
<polyline clip-path="url(#clip4102)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
23.622,22.3518 580.315,22.3518 23.622,22.3518 580.315,22.3518
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip4100)" points="
<polyline clip-path="url(#clip4100)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,384.252 580.315,384.252 23.622,384.252 580.315,384.252
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip4100)" points="
<polyline clip-path="url(#clip4100)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,384.252 23.622,11.811 23.622,384.252 23.622,11.811
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip4100)" points="
<polyline clip-path="url(#clip4100)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
39.3775,384.252 39.3775,378.665 39.3775,384.252 39.3775,378.665
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip4100)" points="
<polyline clip-path="url(#clip4100)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
178.686,384.252 178.686,378.665 178.686,384.252 178.686,378.665
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip4100)" points="
<polyline clip-path="url(#clip4100)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
317.995,384.252 317.995,378.665 317.995,384.252 317.995,378.665
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip4100)" points="
<polyline clip-path="url(#clip4100)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
457.304,384.252 457.304,378.665 457.304,384.252 457.304,378.665
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip4100)" points="
<polyline clip-path="url(#clip4100)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,373.713 31.9724,373.713 23.622,373.713 31.9724,373.713
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip4100)" points="
<polyline clip-path="url(#clip4100)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,285.873 31.9724,285.873 23.622,285.873 31.9724,285.873
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip4100)" points="
<polyline clip-path="url(#clip4100)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,198.032 31.9724,198.032 23.622,198.032 31.9724,198.032
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip4100)" points="
<polyline clip-path="url(#clip4100)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,110.192 31.9724,110.192 23.622,110.192 31.9724,110.192
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip4100)" points="
<polyline clip-path="url(#clip4100)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,22.3518 31.9724,22.3518 23.622,22.3518 31.9724,22.3518
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><g clip-path="url(#clip4100)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 39.3775, 398.052)" x="39.3775" y="398.052">0</text></g><g clip-path="url(#clip4100)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 178.686, 398.052)" x="178.686" y="398.052">5</text></g><g clip-path="url(#clip4100)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 317.995, 398.052)" x="317.995" y="398.052">10</text></g><g clip-path="url(#clip4100)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 457.304, 398.052)" x="457.304" y="398.052">15</text></g><g clip-path="url(#clip4100)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 378.213)" x="17.622" y="378.213">-1.0</text></g><g clip-path="url(#clip4100)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 290.373)" x="17.622" y="290.373">-0.5</text></g><g clip-path="url(#clip4100)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 202.532)" x="17.622" y="202.532">0.0</text></g><g clip-path="url(#clip4100)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 114.692)" x="17.622" y="114.692">0.5</text></g><g clip-path="url(#clip4100)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 26.8518)" x="17.622" y="26.8518">1.0</text></g><polyline clip-path="url(#clip4102)" points="
<g clip-path="url(#clip4100)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 39.3775, 398.052)" x="39.3775" y="398.052">0</text>
</g>
<g clip-path="url(#clip4100)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 178.686, 398.052)" x="178.686" y="398.052">5</text>
</g>
<g clip-path="url(#clip4100)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 317.995, 398.052)" x="317.995" y="398.052">10</text>
</g>
<g clip-path="url(#clip4100)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 457.304, 398.052)" x="457.304" y="398.052">15</text>
</g>
<g clip-path="url(#clip4100)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 378.213)" x="17.622" y="378.213">-1.0</text>
</g>
<g clip-path="url(#clip4100)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 290.373)" x="17.622" y="290.373">-0.5</text>
</g>
<g clip-path="url(#clip4100)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 202.532)" x="17.622" y="202.532">0.0</text>
</g>
<g clip-path="url(#clip4100)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 114.692)" x="17.622" y="114.692">0.5</text>
</g>
<g clip-path="url(#clip4100)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 26.8518)" x="17.622" y="26.8518">1.0</text>
</g>
<polyline clip-path="url(#clip4102)" style="stroke:#009af9; stroke-width:1; stroke-opacity:1; fill:none" points="
39.3775,198.032 39.9032,194.718 40.4289,191.404 40.9546,188.093 41.4803,184.786 42.006,181.483 42.5318,178.186 43.0575,174.896 43.5832,171.615 44.1089,168.342 39.3775,198.032 39.9032,194.718 40.4289,191.404 40.9546,188.093 41.4803,184.786 42.006,181.483 42.5318,178.186 43.0575,174.896 43.5832,171.615 44.1089,168.342
44.6346,165.081 45.1603,161.831 45.686,158.594 46.2117,155.371 46.7374,152.163 47.2631,148.971 47.7888,145.797 48.3145,142.642 48.8402,139.506 49.366,136.391 44.6346,165.081 45.1603,161.831 45.686,158.594 46.2117,155.371 46.7374,152.163 47.2631,148.971 47.7888,145.797 48.3145,142.642 48.8402,139.506 49.366,136.391
49.8917,133.298 50.4174,130.229 50.9431,127.183 51.4688,124.162 51.9945,121.168 52.5202,118.201 53.0459,115.263 53.5716,112.354 54.0973,109.475 54.623,106.629 49.8917,133.298 50.4174,130.229 50.9431,127.183 51.4688,124.162 51.9945,121.168 52.5202,118.201 53.0459,115.263 53.5716,112.354 54.0973,109.475 54.623,106.629
@ -226,8 +201,7 @@ plot(x, [y1, y2])</code></pre><?xml version="1.0" encoding="utf-8"?>
554.571,259.674 555.097,256.559 555.622,253.423 556.148,250.268 556.674,247.094 557.2,243.902 557.725,240.694 558.251,237.471 558.777,234.234 559.302,230.984 554.571,259.674 555.097,256.559 555.622,253.423 556.148,250.268 556.674,247.094 557.2,243.902 557.725,240.694 558.251,237.471 558.777,234.234 559.302,230.984
559.828,227.723 560.354,224.45 560.88,221.169 561.405,217.879 561.931,214.582 562.457,211.279 562.982,207.972 563.508,204.661 564.034,201.347 564.56,198.032 559.828,227.723 560.354,224.45 560.88,221.169 561.405,217.879 561.931,214.582 562.457,211.279 562.982,207.972 563.508,204.661 564.034,201.347 564.56,198.032
"/> " style="stroke:#009af9; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip4102)" points="
<polyline clip-path="url(#clip4102)" style="stroke:#e26f46; stroke-width:1; stroke-opacity:1; fill:none" points="
39.3775,22.3518 39.9032,22.3831 40.4289,22.4769 40.9546,22.6332 41.4803,22.8519 42.006,23.133 42.5318,23.4764 43.0575,23.8819 43.5832,24.3495 44.1089,24.8788 39.3775,22.3518 39.9032,22.3831 40.4289,22.4769 40.9546,22.6332 41.4803,22.8519 42.006,23.133 42.5318,23.4764 43.0575,23.8819 43.5832,24.3495 44.1089,24.8788
44.6346,25.4698 45.1603,26.1222 45.686,26.8359 46.2117,27.6104 46.7374,28.4457 47.2631,29.3413 47.7888,30.297 48.3145,31.3124 48.8402,32.3871 49.366,33.5209 44.6346,25.4698 45.1603,26.1222 45.686,26.8359 46.2117,27.6104 46.7374,28.4457 47.2631,29.3413 47.7888,30.297 48.3145,31.3124 48.8402,32.3871 49.366,33.5209
49.8917,34.7131 50.4174,35.9636 50.9431,37.2717 51.4688,38.637 51.9945,40.0591 52.5202,41.5375 53.0459,43.0715 53.5716,44.6608 54.0973,46.3046 54.623,48.0024 49.8917,34.7131 50.4174,35.9636 50.9431,37.2717 51.4688,38.637 51.9945,40.0591 52.5202,41.5375 53.0459,43.0715 53.5716,44.6608 54.0973,46.3046 54.623,48.0024
@ -329,24 +303,12 @@ plot(x, [y1, y2])</code></pre><?xml version="1.0" encoding="utf-8"?>
554.571,33.5209 555.097,32.3871 555.622,31.3124 556.148,30.297 556.674,29.3413 557.2,28.4457 557.725,27.6104 558.251,26.8359 558.777,26.1222 559.302,25.4698 554.571,33.5209 555.097,32.3871 555.622,31.3124 556.148,30.297 556.674,29.3413 557.2,28.4457 557.725,27.6104 558.251,26.8359 558.777,26.1222 559.302,25.4698
559.828,24.8788 560.354,24.3495 560.88,23.8819 561.405,23.4764 561.931,23.133 562.457,22.8519 562.982,22.6332 563.508,22.4769 564.034,22.3831 564.56,22.3518 559.828,24.8788 560.354,24.3495 560.88,23.8819 561.405,23.4764 561.931,23.133 562.457,22.8519 562.982,22.6332 563.508,22.4769 564.034,22.3831 564.56,22.3518
"/> " style="stroke:#e26f46; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polygon clip-path="url(#clip4100)" fill="#ffffff" fill-opacity="1" points="
<polygon clip-path="url(#clip4100)" points="
489.608,78.051 562.315,78.051 562.315,32.691 489.608,32.691 489.608,78.051 562.315,78.051 562.315,32.691 489.608,32.691
" fill="#ffffff" fill-opacity="1"/> "></polygon><polyline clip-path="url(#clip4100)" points="
<polyline clip-path="url(#clip4100)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
489.608,78.051 562.315,78.051 562.315,32.691 489.608,32.691 489.608,78.051 489.608,78.051 562.315,78.051 562.315,32.691 489.608,32.691 489.608,78.051
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip4100)" points="
<polyline clip-path="url(#clip4100)" style="stroke:#009af9; stroke-width:1; stroke-opacity:1; fill:none" points="
495.608,47.811 531.608,47.811 495.608,47.811 531.608,47.811
"/> " style="stroke:#009af9; stroke-width:1; stroke-opacity:1; fill:none"></polyline><g clip-path="url(#clip4100)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:start;" transform="rotate(0, 537.608, 52.311)" x="537.608" y="52.311">y1</text></g><polyline clip-path="url(#clip4100)" points="
<g clip-path="url(#clip4100)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:start;" transform="rotate(0, 537.608, 52.311)" x="537.608" y="52.311">y1</text>
</g>
<polyline clip-path="url(#clip4100)" style="stroke:#e26f46; stroke-width:1; stroke-opacity:1; fill:none" points="
495.608,62.931 531.608,62.931 495.608,62.931 531.608,62.931
"/> " style="stroke:#e26f46; stroke-width:1; stroke-opacity:1; fill:none"></polyline><g clip-path="url(#clip4100)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:start;" transform="rotate(0, 537.608, 67.431)" x="537.608" y="67.431">y2</text></g></svg></div><h3><a class="nav-anchor" href="#Custom-processing-1" id="Custom-processing-1">Custom processing</a></h3><p>It is possible to give Literate custom pre- and post-processing functions. For example, here we insert two placeholders, which we will replace with something else at time of generation. We have here replaced our placeholders with <code>z</code> and <code>1.0 + 2.0im</code>:</p><div><pre><code class="language-julia">z = 1.0 + 2.0im</code></pre><pre><code class="language-none">1.0 + 2.0im</code></pre></div><h3><a class="nav-anchor" href="#documenter-interaction-1" id="documenter-interaction-1">Documenter.jl interaction</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, <a href="example.html#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><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p><footer><hr/><a class="previous" href="../documenter.html"><span class="direction">Previous</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></HTML>
<g clip-path="url(#clip4100)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:start;" transform="rotate(0, 537.608, 67.431)" x="537.608" y="67.431">y2</text>
</g>
</svg>
</div><h3><a class="nav-anchor" id="Custom-processing-1" href="#Custom-processing-1">Custom processing</a></h3><p>It is possible to give Literate custom pre- and post-processing functions. For example, here we insert two placeholders, which we will replace with something else at time of generation. We have here replaced our placeholders with <code>z</code> and <code>1.0 + 2.0im</code>:</p><div><pre><code class="language-julia">z = 1.0 + 2.0im</code></pre><pre><code class="language-none">1.0 + 2.0im</code></pre></div><h3><a class="nav-anchor" id="documenter-interaction-1" href="#documenter-interaction-1">Documenter.jl interaction</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, <a href="example.html#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><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p><footer><hr/><a class="previous" href="../documenter.html"><span class="direction">Previous</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></html>

45
v1.0.1/index.html

File diff suppressed because one or more lines are too long

53
v1.0.1/outputformats.html

File diff suppressed because one or more lines are too long

51
v1.0.1/pipeline.html

File diff suppressed because one or more lines are too long

45
v1.0.1/search.html

@ -1,2 +1,43 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>Search · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Search · Literate.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"><a href="index.html"><img class="logo" src="assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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><header><nav><ul><li>Search</li></ul></nav><hr/><div id="topbar"><span>Search</span><a class="fa fa-bars" href="#"></a></div></header><h1>Search</h1><p id="search-info">Number of results: <span id="search-results-number">loading...</span></p><ul id="search-results"></ul></article></body><script src="search_index.js"></script><script src="assets/search.js"></script></html> const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="index.html"><img alt="Literate.jl logo" class="logo" src="assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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><header><nav><ul><li>Search</li></ul></nav><hr/><div id="topbar"><span>Search</span><a class="fa fa-bars" href="#"></a></div></header><h1>Search</h1><p id="search-info">Number of results: <span id="search-results-number">loading...</span></p><ul id="search-results"></ul></article><script src="search_index.js"></script><script src="assets/search.js"></script></body></HTML>

49
v1.0.2/customprocessing.html

@ -1,8 +1,49 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>5. Custom pre- and post-processing · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>5. Custom pre- and post-processing · Literate.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"><a href="index.html"><img class="logo" src="assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li class="current"><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a><ul class="internal"></ul></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="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/customprocessing.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>5. Custom pre- and post-processing</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Custom-pre-and-post-processing-1" href="#Custom-pre-and-post-processing-1"><strong>5.</strong> Custom pre- and post-processing</a></h1><p>Since all packages are different, and may have different demands on how to create a nice example for the documentation it is important that the package maintainer does not feel limited by the by default provided syntax that this package offers. While you can generally come a long way by utilizing <a href="fileformat.html#Filtering-Lines-1">line filtering</a> there might be situations where you need to manually hook into the generation and change things. In Literate this is done by letting the user supply custom pre- and post-processing functions that may do transformation of the content.</p><p>All of the generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) accepts <code>preprocess</code> and <code>postprocess</code> keyword arguments. The default &quot;transformation&quot; is the <code>identity</code> function. The input to the transformation functions is a <code>String</code>, and the output should be the transformed <code>String</code>.</p><p><code>preprocess</code> is sent the raw input that is read from the source file (<a href="pipeline.html#Pre-processing-1">modulo the default line ending transformation</a>). <code>postprocess</code> is given different things depending on the output: For markdown and script output <code>postprocess</code> is given the content <code>String</code> just before writing it to the output file, but for notebook output <code>postprocess</code> is given the dictionary representing the notebook, since, in general, this is more useful.</p><p>As an example, lets say we want to splice the date of generation into the output. We could of course update our source file before generating the docs, but we could instead use a <code>preprocess</code> function that splices the date into the source for us. Consider the following source file:</p><pre><code class="language-julia"># # Example const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="index.html"><img alt="Literate.jl logo" class="logo" src="assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li class="current"><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a><ul class="internal"></ul></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="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/customprocessing.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>5. Custom pre- and post-processing</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#Custom-pre-and-post-processing-1" id="Custom-pre-and-post-processing-1"><strong>5.</strong> Custom pre- and post-processing</a></h1><p>Since all packages are different, and may have different demands on how to create a nice example for the documentation it is important that the package maintainer does not feel limited by the by default provided syntax that this package offers. While you can generally come a long way by utilizing <a href="fileformat.html#Filtering-Lines-1">line filtering</a> there might be situations where you need to manually hook into the generation and change things. In Literate this is done by letting the user supply custom pre- and post-processing functions that may do transformation of the content.</p><p>All of the generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) accepts <code>preprocess</code> and <code>postprocess</code> keyword arguments. The default "transformation" is the <code>identity</code> function. The input to the transformation functions is a <code>String</code>, and the output should be the transformed <code>String</code>.</p><p><code>preprocess</code> is sent the raw input that is read from the source file (<a href="pipeline.html#Pre-processing-1">modulo the default line ending transformation</a>). <code>postprocess</code> is given different things depending on the output: For markdown and script output <code>postprocess</code> is given the content <code>String</code> just before writing it to the output file, but for notebook output <code>postprocess</code> is given the dictionary representing the notebook, since, in general, this is more useful.</p><p>As an example, lets say we want to splice the date of generation into the output. We could of course update our source file before generating the docs, but we could instead use a <code>preprocess</code> function that splices the date into the source for us. Consider the following source file:</p><pre><code class="language-julia"># # Example
# This example was generated DATEOFTODAY # This example was generated DATEOFTODAY
x = 1 // 3</code></pre><p>where <code>DATEOFTODAY</code> is a placeholder, to make it easier for our <code>preprocess</code> function to find the location. Now, lets define the <code>preprocess</code> function, for example</p><pre><code class="language-julia">function update_date(content) x = 1 // 3</code></pre><p>where <code>DATEOFTODAY</code> is a placeholder, to make it easier for our <code>preprocess</code> function to find the location. Now, lets define the <code>preprocess</code> function, for example</p><pre><code class="language-julia">function update_date(content)
content = replace(content, &quot;DATEOFTODAY&quot; =&gt; Date(now())) content = replace(content, "DATEOFTODAY" =&gt; Date(now()))
return content return content
end</code></pre><p>which would replace every occurrence of <code>&quot;DATEOFTODAY&quot;</code> with the current date. We would now simply give this function to the generator, for example:</p><pre><code class="language-julia">Literate.markdown(&quot;input.jl&quot;, &quot;outputdir&quot;; preprocess = update_date)</code></pre><footer><hr/><a class="previous" href="outputformats.html"><span class="direction">Previous</span><span class="title"><strong>4.</strong> Output Formats</span></a><a class="next" href="documenter.html"><span class="direction">Next</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></html> end</code></pre><p>which would replace every occurrence of <code>"DATEOFTODAY"</code> with the current date. We would now simply give this function to the generator, for example:</p><pre><code class="language-julia">Literate.markdown("input.jl", "outputdir"; preprocess = update_date)</code></pre><footer><hr/><a class="previous" href="outputformats.html"><span class="direction">Previous</span><span class="title"><strong>4.</strong> Output Formats</span></a><a class="next" href="documenter.html"><span class="direction">Next</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></HTML>

53
v1.0.2/documenter.html

@ -1,12 +1,53 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>6. Interaction with Documenter.jl · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>6. Interaction with Documenter.jl · Literate.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"><a href="index.html"><img class="logo" src="assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li><li class="current"><a class="toctext" href="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a><ul class="internal"></ul></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="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/documenter.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>6. Interaction with Documenter.jl</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Interaction-with-Documenter-1" href="#Interaction-with-Documenter-1"><strong>6.</strong> Interaction with Documenter.jl</a></h1><p>Literate can be used for any purpose, it spits out regular markdown files, and notebooks. Typically, though, these files will be used to render documentation for your package. The generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) supports a keyword argument <code>documenter</code> that lets the generator perform some extra things, keeping in mind that the source code have been written with Documenter.jl in mind. So lets take a look at what will happen if we set <code>documenter = true</code>:</p><h3><a class="nav-anchor" id="[Literate.markdown](@ref):-1" href="#[Literate.markdown](@ref):-1"><a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>:</a></h3><ul><li>The default code fence will change from<pre><code class="language-none">```julia const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="index.html"><img alt="Literate.jl logo" class="logo" src="assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="customprocessing.html"><strong>5.</strong> Custom pre- and post-processing</a></li><li class="current"><a class="toctext" href="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a><ul class="internal"></ul></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="documenter.html"><strong>6.</strong> Interaction with Documenter.jl</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/documenter.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>6. Interaction with Documenter.jl</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#Interaction-with-Documenter-1" id="Interaction-with-Documenter-1"><strong>6.</strong> Interaction with Documenter.jl</a></h1><p>Literate can be used for any purpose, it spits out regular markdown files, and notebooks. Typically, though, these files will be used to render documentation for your package. The generators (<a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#Literate.script"><code>Literate.script</code></a>) supports a keyword argument <code>documenter</code> that lets the generator perform some extra things, keeping in mind that the source code have been written with Documenter.jl in mind. So lets take a look at what will happen if we set <code>documenter = true</code>:</p><h3><a class="nav-anchor" href="#[Literate.markdown](@ref):-1" id="[Literate.markdown](@ref):-1"></a><a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>:</h3><ul><li>The default code fence will change from<pre><code class="language-none">```julia
# code # code
```</code></pre>to Documenters <code>@example</code> blocks:<pre><code class="language-none">```@examples $(name) ```</code></pre>to Documenters <code>@example</code> blocks:<pre><code class="language-none">```@examples $(name)
# code # code
```</code></pre></li><li>The following <code>@meta</code> block will be added to the top of the markdown page, which redirects the &quot;Edit on GitHub&quot; link on the top of the page to the <em>source file</em> rather than the generated <code>.md</code> file:<pre><code class="language-none">```@meta ```</code></pre></li><li>The following <code>@meta</code> block will be added to the top of the markdown page, which redirects the "Edit on GitHub" link on the top of the page to the <em>source file</em> rather than the generated <code>.md</code> file:<pre><code class="language-none">```@meta
EditURL = &quot;$(relpath(inputfile, outputdir))&quot; EditURL = "$(relpath(inputfile, outputdir))"
```</code></pre></li></ul><h3><a class="nav-anchor" id="[Literate.notebook](@ref):-1" href="#[Literate.notebook](@ref):-1"><a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a>:</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 notebook.</li><li>Documenter style markdown math<pre><code class="language-none">```math ```</code></pre></li></ul><h3><a class="nav-anchor" href="#[Literate.notebook](@ref):-1" id="[Literate.notebook](@ref):-1"></a><a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></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 notebook.</li><li>Documenter style markdown math<pre><code class="language-none">```math
\int f dx \int f dx
```</code></pre>is replaced with notebook compatible<pre><code class="language-none">\begin{equation} ```</code></pre>is replaced with notebook compatible<pre><code class="language-none">\begin{equation}
\int f dx \int f dx
\end{equation}</code></pre></li></ul><h3><a class="nav-anchor" id="[Literate.script](@ref):-1" href="#[Literate.script](@ref):-1"><a href="outputformats.html#Literate.script"><code>Literate.script</code></a>:</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><footer><hr/><a class="previous" href="customprocessing.html"><span class="direction">Previous</span><span class="title"><strong>5.</strong> Custom pre- and post-processing</span></a><a class="next" href="generated/example.html"><span class="direction">Next</span><span class="title"><strong>7.</strong> Example</span></a></footer></article></body></html> \end{equation}</code></pre></li></ul><h3><a class="nav-anchor" href="#[Literate.script](@ref):-1" id="[Literate.script](@ref):-1"></a><a href="outputformats.html#Literate.script"><code>Literate.script</code></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><footer><hr/><a class="previous" href="customprocessing.html"><span class="direction">Previous</span><span class="title"><strong>5.</strong> Custom pre- and post-processing</span></a><a class="next" href="generated/example.html"><span class="direction">Next</span><span class="title"><strong>7.</strong> Example</span></a></footer></article></body></HTML>

49
v1.0.2/fileformat.html

@ -1,5 +1,46 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>2. File Format · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>2. File Format · Literate.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"><a href="index.html"><img class="logo" src="assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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 class="current"><a class="toctext" href="fileformat.html"><strong>2.</strong> File Format</a><ul class="internal"><li><a class="toctext" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></li><li><a class="toctext" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</a></li><li><a class="toctext" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></li></ul></li><li><a class="toctext" href="pipeline.html"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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="fileformat.html"><strong>2.</strong> File Format</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/fileformat.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>2. File Format</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="**2.**-File-Format-1" href="#**2.**-File-Format-1"><strong>2.</strong> File Format</a></h1><p>The source file format for Literate is a regular, commented, julia (<code>.jl</code>) scripts. The idea is that the scripts also serve as documentation on their own and it is also simple to include them in the test-suite, with e.g. <code>include</code>, to make sure the examples stay up do date with other changes in your package.</p><h2><a class="nav-anchor" id="Syntax-1" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></h2><p>The basic syntax is simple:</p><ul><li>lines starting with <code>#</code> are treated as markdown,</li><li>all other lines are treated as julia code.</li></ul><p>Leading whitespace is allowed before <code>#</code>, but it will be removed when generating the output. Since <code>#</code>-lines is treated as markdown we can not use that for regular julia comments, for this you can instead use <code>##</code>, which will render as <code>#</code> in the output.</p><p>Lets look at a simple example:</p><pre><code class="language-julia"># # Rational numbers const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="index.html"><img alt="Literate.jl logo" class="logo" src="assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="index.html"><strong>1.</strong> Introduction</a></li><li class="current"><a class="toctext" href="fileformat.html"><strong>2.</strong> File Format</a><ul class="internal"><li><a class="toctext" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></li><li><a class="toctext" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</a></li><li><a class="toctext" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></li></ul></li><li><a class="toctext" href="pipeline.html"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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="fileformat.html"><strong>2.</strong> File Format</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/fileformat.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>2. File Format</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#**2.**-File-Format-1" id="**2.**-File-Format-1"><strong>2.</strong> File Format</a></h1><p>The source file format for Literate is a regular, commented, julia (<code>.jl</code>) scripts. The idea is that the scripts also serve as documentation on their own and it is also simple to include them in the test-suite, with e.g. <code>include</code>, to make sure the examples stay up do date with other changes in your package.</p><h2><a class="nav-anchor" href="#Syntax-1" id="Syntax-1"><strong>2.1.</strong> Syntax</a></h2><p>The basic syntax is simple:</p><ul><li>lines starting with <code>#</code> are treated as markdown,</li><li>all other lines are treated as julia code.</li></ul><p>Leading whitespace is allowed before <code>#</code>, but it will be removed when generating the output. Since <code>#</code>-lines is treated as markdown we can not use that for regular julia comments, for this you can instead use <code>##</code>, which will render as <code>#</code> in the output.</p><p>Lets look at a simple example:</p><pre><code class="language-julia"># # Rational numbers
# #
# In julia rational numbers can be constructed with the `//` operator. # In julia rational numbers can be constructed with the `//` operator.
# Lets define two rational numbers, `x` and `y`: # Lets define two rational numbers, `x` and `y`:
@ -9,9 +50,9 @@ y = 2//5
# When adding `x` and `y` together we obtain a new rational number: # When adding `x` and `y` together we obtain a new rational number:
z = x + y</code></pre><p>In the lines starting with <code>#</code> we can use regular markdown syntax, for example the <code>#</code> used for the heading and the backticks for formatting code. The other lines are regular julia code. We note a couple of things:</p><ul><li>The script is valid julia, which means that we can <code>include</code> it and the example will run (for example in the <code>test/runtests.jl</code> script, to include the example in the test suite).</li><li>The script is &quot;self-explanatory&quot;, i.e. the markdown lines works as comments and thus serve as good documentation on its own.</li></ul><p>For simple use this is all you need to know. The following additional special syntax can also be used:</p><ul><li><code>#md</code>, <code>#nb</code>, <code>#jl</code>, <code>#src</code>: tags to filter lines, see <a href="fileformat.html#Filtering-Lines-1">Filtering Lines</a>,</li><li><code>#-</code>: tag to manually control chunk-splits, see <a href="pipeline.html#Custom-control-over-chunk-splits-1">Custom control over chunk splits</a>.</li></ul><p>There is also some default convenience replacements that will always be performed, see <a href="fileformat.html#Default-Replacements-1">Default Replacements</a>.</p><h2><a class="nav-anchor" id="Filtering-Lines-1" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</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 &quot;tokens&quot; 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> with one of these tokens are filtered out in the <a href="pipeline.html#Pre-processing-1">preprocessing step</a>.</p><p>Suppose, for example, that we want to include a docstring within a <code>@docs</code> block using Documenter. Obviously we don&#39;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><code class="language-julia">#md # ```@docs z = x + y</code></pre><p>In the lines starting with <code>#</code> we can use regular markdown syntax, for example the <code>#</code> used for the heading and the backticks for formatting code. The other lines are regular julia code. We note a couple of things:</p><ul><li>The script is valid julia, which means that we can <code>include</code> it and the example will run (for example in the <code>test/runtests.jl</code> script, to include the example in the test suite).</li><li>The script is "self-explanatory", i.e. the markdown lines works as comments and thus serve as good documentation on its own.</li></ul><p>For simple use this is all you need to know. The following additional special syntax can also be used:</p><ul><li><code>#md</code>, <code>#nb</code>, <code>#jl</code>, <code>#src</code>: tags to filter lines, see <a href="fileformat.html#Filtering-Lines-1">Filtering Lines</a>,</li><li><code>#-</code>: tag to manually control chunk-splits, see <a href="pipeline.html#Custom-control-over-chunk-splits-1">Custom control over chunk splits</a>.</li></ul><p>There is also some default convenience replacements that will always be performed, see <a href="fileformat.html#Default-Replacements-1">Default Replacements</a>.</p><h2><a class="nav-anchor" href="#Filtering-Lines-1" id="Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</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> with one of these tokens are filtered out in the <a href="pipeline.html#Pre-processing-1">preprocessing step</a>.</p><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><code class="language-julia">#md # ```@docs
#md # Literate.markdown #md # Literate.markdown
#md # Literate.notebook #md # Literate.notebook
#md # Literate.markdown #md # Literate.markdown
#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 simple 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><code class="language-julia">using Test #src #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 simple 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><code class="language-julia">using Test #src
@test result == expected_result #src</code></pre><h2><a class="nav-anchor" id="Default-Replacements-1" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></h2><p>The following convenience &quot;macros&quot; are always expanded:</p><ul><li><p><code>@__NAME__</code></p><p>expands to the <code>name</code> keyword argument to <a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#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>expands to <code>https://github.com/$(ENV[&quot;TRAVIS_REPO_SLUG&quot;])/blob/master/</code> and is a convenient way to use when you want to link to files outside the doc-build directory. For example <code>@__REPO__ROOT_URL__src/Literate.jl</code> would link to the source of the Literate module.</p></li><li><p><code>@__NBVIEWER_ROOT_URL__</code></p><p>expands to <code>https://nbviewer.jupyter.org/github/$(ENV[&quot;TRAVIS_REPO_SLUG&quot;])/blob/gh-pages/$(folder)/</code> where <code>folder</code> is the folder that <code>Documenter.deploydocs</code> deploys too. This can be used if you want a link that opens the generated notebook in <a href="http://nbviewer.jupyter.org/">http://nbviewer.jupyter.org/</a>.</p></li></ul><footer><hr/><a class="previous" href="index.html"><span class="direction">Previous</span><span class="title"><strong>1.</strong> Introduction</span></a><a class="next" href="pipeline.html"><span class="direction">Next</span><span class="title"><strong>3.</strong> Processing pipeline</span></a></footer></article></body></html> @test result == expected_result #src</code></pre><h2><a class="nav-anchor" href="#Default-Replacements-1" id="Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></h2><p>The following convenience "macros" are always expanded:</p><ul><li><p><code>@__NAME__</code></p><p>expands to the <code>name</code> keyword argument to <a href="outputformats.html#Literate.markdown"><code>Literate.markdown</code></a>, <a href="outputformats.html#Literate.notebook"><code>Literate.notebook</code></a> and <a href="outputformats.html#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>expands to <code>https://github.com/$(ENV["TRAVIS_REPO_SLUG"])/blob/master/</code> and is a convenient way to use when you want to link to files outside the doc-build directory. For example <code>@__REPO__ROOT_URL__src/Literate.jl</code> would link to the source of the Literate module.</p></li><li><p><code>@__NBVIEWER_ROOT_URL__</code></p><p>expands to <code>https://nbviewer.jupyter.org/github/$(ENV["TRAVIS_REPO_SLUG"])/blob/gh-pages/$(folder)/</code> where <code>folder</code> is the folder that <code>Documenter.deploydocs</code> deploys too. This can be used if you want a link that opens the generated notebook in <a href="http://nbviewer.jupyter.org/">http://nbviewer.jupyter.org/</a>.</p></li></ul><footer><hr/><a class="previous" href="index.html"><span class="direction">Previous</span><span class="title"><strong>1.</strong> Introduction</span></a><a class="next" href="pipeline.html"><span class="direction">Next</span><span class="title"><strong>3.</strong> Processing pipeline</span></a></footer></article></body></HTML>

188
v1.0.2/generated/example.html

@ -1,7 +1,48 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>7. Example · Literate.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 data-main="../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>7. Example · Literate.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"><a href="../index.html"><img class="logo" src="../assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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><a class="toctext" href="../outputformats.html"><strong>4.</strong> Output Formats</a></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 class="current"><a class="toctext" href="example.html"><strong>7.</strong> Example</a><ul class="internal"></ul></li></ul></nav><article id="docs"><header><nav><ul><li><a href="example.html"><strong>7.</strong> Example</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>7. Example</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="**7.**-Example-1" href="#**7.**-Example-1"><strong>7.</strong> Example</a></h1><p>This is an example generated with Literate based on this source file: <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><code>example.jl</code></a>. You are seeing the html-output which Documenter have generated based on a markdown file generated with Literate. The corresponding notebook can be found here: <a href="https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v1.0.2/generated/example.ipynb"><code>example.ipynb</code></a>, and the plain script output can be found here: <a href="example.jl"><code>example.jl</code></a>.</p><p>It is recommended to have the <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl">source file</a> available when reading this, to better understand how the syntax in the source file corresponds to the output you are seeing.</p><h3><a class="nav-anchor" id="Basic-syntax-1" href="#Basic-syntax-1">Basic syntax</a></h3><p>The basic syntax for Literate is simple, lines starting with <code>#</code> is interpreted as markdown, and all the other lines are interpreted as code. Here is some code:</p><div><pre><code class="language-julia">x = 1//3 const head = document.getElementsByTagName('head')[0];
y = 2//5</code></pre><pre><code class="language-none">2//5</code></pre></div><p>In markdown sections we can use markdown syntax. For example, we can write <em>text in italic font</em>, <strong>text in bold font</strong> and use <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">links</a>.</p><p>It is possible to filter out lines depending on the output using the <code>#md</code>, <code>#nb</code>, <code>#jl</code> and <code>#src</code> tags (see <a href="../fileformat.html#Filtering-Lines-1">Filtering Lines</a>):</p><ul><li>This line starts with <code>#md</code> and is thus only visible in the markdown output.</li></ul><p>The source file is parsed in chunks of markdown and code. Starting a line with <code>#-</code> manually inserts a chunk break. For example, if we want to display the output of the following operations we may insert <code>#-</code> in between. These two code blocks will now end up in different <code>@example</code>-blocks in the markdown output, and two different notebook cells in the notebook output.</p><div><pre><code class="language-julia">x + y</code></pre><pre><code class="language-none">11//15</code></pre></div><div><pre><code class="language-julia">x * y</code></pre><pre><code class="language-none">2//15</code></pre></div><h3><a class="nav-anchor" id="Output-Capturing-1" href="#Output-Capturing-1">Output Capturing</a></h3><p>Code chunks are by default placed in Documenter <code>@example</code> blocks in the generated markdown. This means that the output will be captured in a block when Documenter is building the docs. In notebooks the output is captured in output cells, if the <code>execute</code> keyword argument is set to true. Output to <code>stdout</code>/<code>stderr</code> is also captured.</p><div><pre><code class="language-julia">function foo()
println(&quot;This string is printed to stdout.&quot;) // Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="../index.html"><img alt="Literate.jl logo" class="logo" src="../assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="../search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="../outputformats.html"><strong>4.</strong> Output Formats</a></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 class="current"><a class="toctext" href="example.html"><strong>7.</strong> Example</a><ul class="internal"></ul></li></ul></nav><article id="docs"><header><nav><ul><li><a href="example.html"><strong>7.</strong> Example</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>7. Example</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#**7.**-Example-1" id="**7.**-Example-1"><strong>7.</strong> Example</a></h1><p>This is an example generated with Literate based on this source file: <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><code>example.jl</code></a>. You are seeing the html-output which Documenter have generated based on a markdown file generated with Literate. The corresponding notebook can be found here: <a href="https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v1.0.2/generated/example.ipynb"><code>example.ipynb</code></a>, and the plain script output can be found here: <a href="example.jl"><code>example.jl</code></a>.</p><p>It is recommended to have the <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl">source file</a> available when reading this, to better understand how the syntax in the source file corresponds to the output you are seeing.</p><h3><a class="nav-anchor" href="#Basic-syntax-1" id="Basic-syntax-1">Basic syntax</a></h3><p>The basic syntax for Literate is simple, lines starting with <code>#</code> is interpreted as markdown, and all the other lines are interpreted as code. Here is some code:</p><div><pre><code class="language-julia">x = 1//3
y = 2//5</code></pre><pre><code class="language-none">2//5</code></pre></div><p>In markdown sections we can use markdown syntax. For example, we can write <em>text in italic font</em>, <strong>text in bold font</strong> and use <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">links</a>.</p><p>It is possible to filter out lines depending on the output using the <code>#md</code>, <code>#nb</code>, <code>#jl</code> and <code>#src</code> tags (see <a href="../fileformat.html#Filtering-Lines-1">Filtering Lines</a>):</p><ul><li>This line starts with <code>#md</code> and is thus only visible in the markdown output.</li></ul><p>The source file is parsed in chunks of markdown and code. Starting a line with <code>#-</code> manually inserts a chunk break. For example, if we want to display the output of the following operations we may insert <code>#-</code> in between. These two code blocks will now end up in different <code>@example</code>-blocks in the markdown output, and two different notebook cells in the notebook output.</p><div><pre><code class="language-julia">x + y</code></pre><pre><code class="language-none">11//15</code></pre></div><div><pre><code class="language-julia">x * y</code></pre><pre><code class="language-none">2//15</code></pre></div><h3><a class="nav-anchor" href="#Output-Capturing-1" id="Output-Capturing-1">Output Capturing</a></h3><p>Code chunks are by default placed in Documenter <code>@example</code> blocks in the generated markdown. This means that the output will be captured in a block when Documenter is building the docs. In notebooks the output is captured in output cells, if the <code>execute</code> keyword argument is set to true. Output to <code>stdout</code>/<code>stderr</code> is also captured.</p><div><pre><code class="language-julia">function foo()
println("This string is printed to stdout.")
return [1, 2, 3, 4] return [1, 2, 3, 4]
end end
@ -10,121 +51,55 @@ foo()</code></pre><pre><code class="language-none">This string is printed to std
1 1
2 2
3 3
4</code></pre></div><p>Both Documenter&#39;s <code>@example</code> block and notebooks can display images. Here is an example where we generate a simple plot using the <a href="https://github.com/JuliaPlots/Plots.jl">Plots.jl</a> package</p><div><pre><code class="language-julia">using Plots 4</code></pre></div><p>Both Documenter's <code>@example</code> block and notebooks can display images. Here is an example where we generate a simple plot using the <a href="https://github.com/JuliaPlots/Plots.jl">Plots.jl</a> package</p><div><pre><code class="language-julia">using Plots
x = range(0, stop=6π, length=1000) x = range(0, stop=6π, length=1000)
y1 = sin.(x) y1 = sin.(x)
y2 = cos.(x) y2 = cos.(x)
plot(x, [y1, y2])</code></pre><?xml version="1.0" encoding="utf-8"?> plot(x, [y1, y2])</code></pre><svg height="400" viewBox="0 0 600 400" width="600" xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"><defs><clipPath id="clip7300"><rect height="400" width="600" x="0" y="0"></rect></clipPath></defs><polygon clip-path="url(#clip7300)" fill="#ffffff" fill-opacity="1" points="
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="600" height="400" viewBox="0 0 600 400">
<defs>
<clipPath id="clip7300">
<rect x="0" y="0" width="600" height="400"/>
</clipPath>
</defs>
<polygon clip-path="url(#clip7300)" points="
0,400 600,400 600,0 0,0 0,400 600,400 600,0 0,0
" fill="#ffffff" fill-opacity="1"/> "></polygon><defs><clipPath id="clip7301"><rect height="400" width="421" x="120" y="0"></rect></clipPath></defs><polygon clip-path="url(#clip7300)" fill="#ffffff" fill-opacity="1" points="
<defs>
<clipPath id="clip7301">
<rect x="120" y="0" width="421" height="400"/>
</clipPath>
</defs>
<polygon clip-path="url(#clip7300)" points="
23.622,384.252 580.315,384.252 580.315,11.811 23.622,11.811 23.622,384.252 580.315,384.252 580.315,11.811 23.622,11.811
" fill="#ffffff" fill-opacity="1"/> "></polygon><defs><clipPath id="clip7302"><rect height="373" width="558" x="23" y="11"></rect></clipPath></defs><polyline clip-path="url(#clip7302)" points="
<defs>
<clipPath id="clip7302">
<rect x="23" y="11" width="558" height="373"/>
</clipPath>
</defs>
<polyline clip-path="url(#clip7302)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
39.3775,384.252 39.3775,11.811 39.3775,384.252 39.3775,11.811
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip7302)" points="
<polyline clip-path="url(#clip7302)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
178.686,384.252 178.686,11.811 178.686,384.252 178.686,11.811
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip7302)" points="
<polyline clip-path="url(#clip7302)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
317.995,384.252 317.995,11.811 317.995,384.252 317.995,11.811
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip7302)" points="
<polyline clip-path="url(#clip7302)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
457.304,384.252 457.304,11.811 457.304,384.252 457.304,11.811
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip7302)" points="
<polyline clip-path="url(#clip7302)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
23.622,373.713 580.315,373.713 23.622,373.713 580.315,373.713
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip7302)" points="
<polyline clip-path="url(#clip7302)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
23.622,285.873 580.315,285.873 23.622,285.873 580.315,285.873
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip7302)" points="
<polyline clip-path="url(#clip7302)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
23.622,198.032 580.315,198.032 23.622,198.032 580.315,198.032
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip7302)" points="
<polyline clip-path="url(#clip7302)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
23.622,110.192 580.315,110.192 23.622,110.192 580.315,110.192
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip7302)" points="
<polyline clip-path="url(#clip7302)" style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none" points="
23.622,22.3518 580.315,22.3518 23.622,22.3518 580.315,22.3518
"/> " style="stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip7300)" points="
<polyline clip-path="url(#clip7300)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,384.252 580.315,384.252 23.622,384.252 580.315,384.252
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7300)" points="
<polyline clip-path="url(#clip7300)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,384.252 23.622,11.811 23.622,384.252 23.622,11.811
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7300)" points="
<polyline clip-path="url(#clip7300)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
39.3775,384.252 39.3775,378.665 39.3775,384.252 39.3775,378.665
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7300)" points="
<polyline clip-path="url(#clip7300)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
178.686,384.252 178.686,378.665 178.686,384.252 178.686,378.665
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7300)" points="
<polyline clip-path="url(#clip7300)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
317.995,384.252 317.995,378.665 317.995,384.252 317.995,378.665
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7300)" points="
<polyline clip-path="url(#clip7300)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
457.304,384.252 457.304,378.665 457.304,384.252 457.304,378.665
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7300)" points="
<polyline clip-path="url(#clip7300)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,373.713 31.9724,373.713 23.622,373.713 31.9724,373.713
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7300)" points="
<polyline clip-path="url(#clip7300)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,285.873 31.9724,285.873 23.622,285.873 31.9724,285.873
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7300)" points="
<polyline clip-path="url(#clip7300)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,198.032 31.9724,198.032 23.622,198.032 31.9724,198.032
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7300)" points="
<polyline clip-path="url(#clip7300)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,110.192 31.9724,110.192 23.622,110.192 31.9724,110.192
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7300)" points="
<polyline clip-path="url(#clip7300)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
23.622,22.3518 31.9724,22.3518 23.622,22.3518 31.9724,22.3518
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><g clip-path="url(#clip7300)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 39.3775, 398.052)" x="39.3775" y="398.052">0</text></g><g clip-path="url(#clip7300)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 178.686, 398.052)" x="178.686" y="398.052">5</text></g><g clip-path="url(#clip7300)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 317.995, 398.052)" x="317.995" y="398.052">10</text></g><g clip-path="url(#clip7300)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 457.304, 398.052)" x="457.304" y="398.052">15</text></g><g clip-path="url(#clip7300)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 378.213)" x="17.622" y="378.213">-1.0</text></g><g clip-path="url(#clip7300)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 290.373)" x="17.622" y="290.373">-0.5</text></g><g clip-path="url(#clip7300)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 202.532)" x="17.622" y="202.532">0.0</text></g><g clip-path="url(#clip7300)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 114.692)" x="17.622" y="114.692">0.5</text></g><g clip-path="url(#clip7300)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 26.8518)" x="17.622" y="26.8518">1.0</text></g><polyline clip-path="url(#clip7302)" points="
<g clip-path="url(#clip7300)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 39.3775, 398.052)" x="39.3775" y="398.052">0</text>
</g>
<g clip-path="url(#clip7300)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 178.686, 398.052)" x="178.686" y="398.052">5</text>
</g>
<g clip-path="url(#clip7300)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 317.995, 398.052)" x="317.995" y="398.052">10</text>
</g>
<g clip-path="url(#clip7300)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;" transform="rotate(0, 457.304, 398.052)" x="457.304" y="398.052">15</text>
</g>
<g clip-path="url(#clip7300)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 378.213)" x="17.622" y="378.213">-1.0</text>
</g>
<g clip-path="url(#clip7300)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 290.373)" x="17.622" y="290.373">-0.5</text>
</g>
<g clip-path="url(#clip7300)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 202.532)" x="17.622" y="202.532">0.0</text>
</g>
<g clip-path="url(#clip7300)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 114.692)" x="17.622" y="114.692">0.5</text>
</g>
<g clip-path="url(#clip7300)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;" transform="rotate(0, 17.622, 26.8518)" x="17.622" y="26.8518">1.0</text>
</g>
<polyline clip-path="url(#clip7302)" style="stroke:#009af9; stroke-width:1; stroke-opacity:1; fill:none" points="
39.3775,198.032 39.9032,194.718 40.4289,191.404 40.9546,188.093 41.4803,184.786 42.006,181.483 42.5318,178.186 43.0575,174.896 43.5832,171.615 44.1089,168.342 39.3775,198.032 39.9032,194.718 40.4289,191.404 40.9546,188.093 41.4803,184.786 42.006,181.483 42.5318,178.186 43.0575,174.896 43.5832,171.615 44.1089,168.342
44.6346,165.081 45.1603,161.831 45.686,158.594 46.2117,155.371 46.7374,152.163 47.2631,148.971 47.7888,145.797 48.3145,142.642 48.8402,139.506 49.366,136.391 44.6346,165.081 45.1603,161.831 45.686,158.594 46.2117,155.371 46.7374,152.163 47.2631,148.971 47.7888,145.797 48.3145,142.642 48.8402,139.506 49.366,136.391
49.8917,133.298 50.4174,130.229 50.9431,127.183 51.4688,124.162 51.9945,121.168 52.5202,118.201 53.0459,115.263 53.5716,112.354 54.0973,109.475 54.623,106.629 49.8917,133.298 50.4174,130.229 50.9431,127.183 51.4688,124.162 51.9945,121.168 52.5202,118.201 53.0459,115.263 53.5716,112.354 54.0973,109.475 54.623,106.629
@ -226,8 +201,7 @@ plot(x, [y1, y2])</code></pre><?xml version="1.0" encoding="utf-8"?>
554.571,259.674 555.097,256.559 555.622,253.423 556.148,250.268 556.674,247.094 557.2,243.902 557.725,240.694 558.251,237.471 558.777,234.234 559.302,230.984 554.571,259.674 555.097,256.559 555.622,253.423 556.148,250.268 556.674,247.094 557.2,243.902 557.725,240.694 558.251,237.471 558.777,234.234 559.302,230.984
559.828,227.723 560.354,224.45 560.88,221.169 561.405,217.879 561.931,214.582 562.457,211.279 562.982,207.972 563.508,204.661 564.034,201.347 564.56,198.032 559.828,227.723 560.354,224.45 560.88,221.169 561.405,217.879 561.931,214.582 562.457,211.279 562.982,207.972 563.508,204.661 564.034,201.347 564.56,198.032
"/> " style="stroke:#009af9; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7302)" points="
<polyline clip-path="url(#clip7302)" style="stroke:#e26f46; stroke-width:1; stroke-opacity:1; fill:none" points="
39.3775,22.3518 39.9032,22.3831 40.4289,22.4769 40.9546,22.6332 41.4803,22.8519 42.006,23.133 42.5318,23.4764 43.0575,23.8819 43.5832,24.3495 44.1089,24.8788 39.3775,22.3518 39.9032,22.3831 40.4289,22.4769 40.9546,22.6332 41.4803,22.8519 42.006,23.133 42.5318,23.4764 43.0575,23.8819 43.5832,24.3495 44.1089,24.8788
44.6346,25.4698 45.1603,26.1222 45.686,26.8359 46.2117,27.6104 46.7374,28.4457 47.2631,29.3413 47.7888,30.297 48.3145,31.3124 48.8402,32.3871 49.366,33.5209 44.6346,25.4698 45.1603,26.1222 45.686,26.8359 46.2117,27.6104 46.7374,28.4457 47.2631,29.3413 47.7888,30.297 48.3145,31.3124 48.8402,32.3871 49.366,33.5209
49.8917,34.7131 50.4174,35.9636 50.9431,37.2717 51.4688,38.637 51.9945,40.0591 52.5202,41.5375 53.0459,43.0715 53.5716,44.6608 54.0973,46.3046 54.623,48.0024 49.8917,34.7131 50.4174,35.9636 50.9431,37.2717 51.4688,38.637 51.9945,40.0591 52.5202,41.5375 53.0459,43.0715 53.5716,44.6608 54.0973,46.3046 54.623,48.0024
@ -329,24 +303,12 @@ plot(x, [y1, y2])</code></pre><?xml version="1.0" encoding="utf-8"?>
554.571,33.5209 555.097,32.3871 555.622,31.3124 556.148,30.297 556.674,29.3413 557.2,28.4457 557.725,27.6104 558.251,26.8359 558.777,26.1222 559.302,25.4698 554.571,33.5209 555.097,32.3871 555.622,31.3124 556.148,30.297 556.674,29.3413 557.2,28.4457 557.725,27.6104 558.251,26.8359 558.777,26.1222 559.302,25.4698
559.828,24.8788 560.354,24.3495 560.88,23.8819 561.405,23.4764 561.931,23.133 562.457,22.8519 562.982,22.6332 563.508,22.4769 564.034,22.3831 564.56,22.3518 559.828,24.8788 560.354,24.3495 560.88,23.8819 561.405,23.4764 561.931,23.133 562.457,22.8519 562.982,22.6332 563.508,22.4769 564.034,22.3831 564.56,22.3518
"/> " style="stroke:#e26f46; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polygon clip-path="url(#clip7300)" fill="#ffffff" fill-opacity="1" points="
<polygon clip-path="url(#clip7300)" points="
489.608,78.051 562.315,78.051 562.315,32.691 489.608,32.691 489.608,78.051 562.315,78.051 562.315,32.691 489.608,32.691
" fill="#ffffff" fill-opacity="1"/> "></polygon><polyline clip-path="url(#clip7300)" points="
<polyline clip-path="url(#clip7300)" style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none" points="
489.608,78.051 562.315,78.051 562.315,32.691 489.608,32.691 489.608,78.051 489.608,78.051 562.315,78.051 562.315,32.691 489.608,32.691 489.608,78.051
"/> " style="stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7300)" points="
<polyline clip-path="url(#clip7300)" style="stroke:#009af9; stroke-width:1; stroke-opacity:1; fill:none" points="
495.608,47.811 531.608,47.811 495.608,47.811 531.608,47.811
"/> " style="stroke:#009af9; stroke-width:1; stroke-opacity:1; fill:none"></polyline><g clip-path="url(#clip7300)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:start;" transform="rotate(0, 537.608, 52.311)" x="537.608" y="52.311">y1</text></g><polyline clip-path="url(#clip7300)" points="
<g clip-path="url(#clip7300)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:start;" transform="rotate(0, 537.608, 52.311)" x="537.608" y="52.311">y1</text>
</g>
<polyline clip-path="url(#clip7300)" style="stroke:#e26f46; stroke-width:1; stroke-opacity:1; fill:none" points="
495.608,62.931 531.608,62.931 495.608,62.931 531.608,62.931
"/> " style="stroke:#e26f46; stroke-width:1; stroke-opacity:1; fill:none"></polyline><g clip-path="url(#clip7300)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:start;" transform="rotate(0, 537.608, 67.431)" x="537.608" y="67.431">y2</text></g></svg></div><h3><a class="nav-anchor" href="#Custom-processing-1" id="Custom-processing-1">Custom processing</a></h3><p>It is possible to give Literate custom pre- and post-processing functions. For example, here we insert two placeholders, which we will replace with something else at time of generation. We have here replaced our placeholders with <code>z</code> and <code>1.0 + 2.0im</code>:</p><div><pre><code class="language-julia">z = 1.0 + 2.0im</code></pre><pre><code class="language-none">1.0 + 2.0im</code></pre></div><h3><a class="nav-anchor" href="#documenter-interaction-1" id="documenter-interaction-1">Documenter.jl interaction</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, <a href="example.html#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><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p><footer><hr/><a class="previous" href="../documenter.html"><span class="direction">Previous</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></HTML>
<g clip-path="url(#clip7300)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:start;" transform="rotate(0, 537.608, 67.431)" x="537.608" y="67.431">y2</text>
</g>
</svg>
</div><h3><a class="nav-anchor" id="Custom-processing-1" href="#Custom-processing-1">Custom processing</a></h3><p>It is possible to give Literate custom pre- and post-processing functions. For example, here we insert two placeholders, which we will replace with something else at time of generation. We have here replaced our placeholders with <code>z</code> and <code>1.0 + 2.0im</code>:</p><div><pre><code class="language-julia">z = 1.0 + 2.0im</code></pre><pre><code class="language-none">1.0 + 2.0im</code></pre></div><h3><a class="nav-anchor" id="documenter-interaction-1" href="#documenter-interaction-1">Documenter.jl interaction</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, <a href="example.html#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><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p><footer><hr/><a class="previous" href="../documenter.html"><span class="direction">Previous</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></html>

45
v1.0.2/index.html

File diff suppressed because one or more lines are too long

53
v1.0.2/outputformats.html

File diff suppressed because one or more lines are too long

51
v1.0.2/pipeline.html

File diff suppressed because one or more lines are too long

45
v1.0.2/search.html

@ -1,2 +1,43 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>Search · Literate.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 data-main="assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Search · Literate.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"><a href="index.html"><img class="logo" src="assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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><header><nav><ul><li>Search</li></ul></nav><hr/><div id="topbar"><span>Search</span><a class="fa fa-bars" href="#"></a></div></header><h1>Search</h1><p id="search-info">Number of results: <span id="search-results-number">loading...</span></p><ul id="search-results"></ul></article></body><script src="search_index.js"></script><script src="assets/search.js"></script></html> const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="index.html"><img alt="Literate.jl logo" class="logo" src="assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="search.html" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></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><a class="toctext" href="outputformats.html"><strong>4.</strong> Output Formats</a></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><header><nav><ul><li>Search</li></ul></nav><hr/><div id="topbar"><span>Search</span><a class="fa fa-bars" href="#"></a></div></header><h1>Search</h1><p id="search-info">Number of results: <span id="search-results-number">loading...</span></p><ul id="search-results"></ul></article><script src="search_index.js"></script><script src="assets/search.js"></script></body></HTML>

63
v1.0.3/customprocessing/index.html

@ -1,29 +1,70 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>5. Custom pre- and post-processing · Literate.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 data-main="../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>5. Custom pre- and post-processing · Literate.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"><a href="../index.html"><img class="logo" src="../assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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="../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li class="current"><a class="toctext" href><strong>5.</strong> Custom pre- and post-processing</a><ul class="internal"></ul></li><li><a class="toctext" href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href><strong>5.</strong> Custom pre- and post-processing</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/customprocessing.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>5. Custom pre- and post-processing</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Custom-pre-and-post-processing-1" href="#Custom-pre-and-post-processing-1"><strong>5.</strong> Custom pre- and post-processing</a></h1><p>Since all packages are different, and may have different demands on how to create a nice example for the documentation it is important that the package maintainer does not feel limited by the by default provided syntax that this package offers. While you can generally come a long way by utilizing <a href="../fileformat/#Filtering-Lines-1">line filtering</a> there might be situations where you need to manually hook into the generation and change things. In Literate this is done by letting the user supply custom pre- and post-processing functions that may do transformation of the content.</p><p>All of the generators (<a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <a href="../outputformats/#Literate.script"><code>Literate.script</code></a>) accepts <code>preprocess</code> and <code>postprocess</code> keyword arguments. The default &quot;transformation&quot; is the <code>identity</code> function. The input to the transformation functions is a <code>String</code>, and the output should be the transformed <code>String</code>.</p><p><code>preprocess</code> is sent the raw input that is read from the source file (<a href="../pipeline/#Pre-processing-1">modulo the default line ending transformation</a>). <code>postprocess</code> is given different things depending on the output: For markdown and script output <code>postprocess</code> is given the content <code>String</code> just before writing it to the output file, but for notebook output <code>postprocess</code> is given the dictionary representing the notebook, since, in general, this is more useful.</p><h3><a class="nav-anchor" id="Example:-Adding-current-date-1" href="#Example:-Adding-current-date-1">Example: Adding current date</a></h3><p>As an example, lets say we want to splice the date of generation into the output. We could of course update our source file before generating the docs, but we could instead use a <code>preprocess</code> function that splices the date into the source for us. Consider the following source file:</p><pre><code class="language-julia"># # Example const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="../index.html"><img alt="Literate.jl logo" class="logo" src="../assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="../search/" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li class="current"><a class="toctext" href=""><strong>5.</strong> Custom pre- and post-processing</a><ul class="internal"></ul></li><li><a class="toctext" href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href=""><strong>5.</strong> Custom pre- and post-processing</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/customprocessing.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>5. Custom pre- and post-processing</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#Custom-pre-and-post-processing-1" id="Custom-pre-and-post-processing-1"><strong>5.</strong> Custom pre- and post-processing</a></h1><p>Since all packages are different, and may have different demands on how to create a nice example for the documentation it is important that the package maintainer does not feel limited by the by default provided syntax that this package offers. While you can generally come a long way by utilizing <a href="../fileformat/#Filtering-Lines-1">line filtering</a> there might be situations where you need to manually hook into the generation and change things. In Literate this is done by letting the user supply custom pre- and post-processing functions that may do transformation of the content.</p><p>All of the generators (<a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <a href="../outputformats/#Literate.script"><code>Literate.script</code></a>) accepts <code>preprocess</code> and <code>postprocess</code> keyword arguments. The default "transformation" is the <code>identity</code> function. The input to the transformation functions is a <code>String</code>, and the output should be the transformed <code>String</code>.</p><p><code>preprocess</code> is sent the raw input that is read from the source file (<a href="../pipeline/#Pre-processing-1">modulo the default line ending transformation</a>). <code>postprocess</code> is given different things depending on the output: For markdown and script output <code>postprocess</code> is given the content <code>String</code> just before writing it to the output file, but for notebook output <code>postprocess</code> is given the dictionary representing the notebook, since, in general, this is more useful.</p><h3><a class="nav-anchor" href="#Example:-Adding-current-date-1" id="Example:-Adding-current-date-1">Example: Adding current date</a></h3><p>As an example, lets say we want to splice the date of generation into the output. We could of course update our source file before generating the docs, but we could instead use a <code>preprocess</code> function that splices the date into the source for us. Consider the following source file:</p><pre><code class="language-julia"># # Example
# This example was generated DATEOFTODAY # This example was generated DATEOFTODAY
x = 1 // 3</code></pre><p>where <code>DATEOFTODAY</code> is a placeholder, to make it easier for our <code>preprocess</code> function to find the location. Now, lets define the <code>preprocess</code> function, for example</p><pre><code class="language-julia">function update_date(content) x = 1 // 3</code></pre><p>where <code>DATEOFTODAY</code> is a placeholder, to make it easier for our <code>preprocess</code> function to find the location. Now, lets define the <code>preprocess</code> function, for example</p><pre><code class="language-julia">function update_date(content)
content = replace(content, &quot;DATEOFTODAY&quot; =&gt; Date(now())) content = replace(content, "DATEOFTODAY" =&gt; Date(now()))
return content return content
end</code></pre><p>which would replace every occurrence of <code>&quot;DATEOFTODAY&quot;</code> with the current date. We would now simply give this function to the generator, for example:</p><pre><code class="language-julia">Literate.markdown(&quot;input.jl&quot;, &quot;outputdir&quot;; preprocess = update_date)</code></pre><h3><a class="nav-anchor" id="Example:-Replacing-include-calls-with-included-code-1" href="#Example:-Replacing-include-calls-with-included-code-1">Example: Replacing <code>include</code> calls with included code</a></h3><p>Let&#39;s say that we have some individual example files <code>file1, file2, ...</code> etc. that are <em>runnable</em> and also following the style of Literate. These files could be for example used in the test suite of your package.</p><p>We want to group them all into a single page in our documentation, but we do not want to copy paste the content of <code>file1, ...</code> for robustness: the files are included in the test suite and some changes may occur to them. We want these changes to also be reflected in the documentation.</p><p>A very easy way to do this is using <code>preprocess</code> to interchange <code>include</code> statements with file content. First, create a runnable <code>.jl</code> following the format of Literate</p><pre><code class="language-julia"># # Replace includes end</code></pre><p>which would replace every occurrence of <code>"DATEOFTODAY"</code> with the current date. We would now simply give this function to the generator, for example:</p><pre><code class="language-julia">Literate.markdown("input.jl", "outputdir"; preprocess = update_date)</code></pre><h3><a class="nav-anchor" href="#Example:-Replacing-include-calls-with-included-code-1" id="Example:-Replacing-include-calls-with-included-code-1">Example: Replacing <code>include</code> calls with included code</a></h3><p>Let's say that we have some individual example files <code>file1, file2, ...</code> etc. that are <em>runnable</em> and also following the style of Literate. These files could be for example used in the test suite of your package.</p><p>We want to group them all into a single page in our documentation, but we do not want to copy paste the content of <code>file1, ...</code> for robustness: the files are included in the test suite and some changes may occur to them. We want these changes to also be reflected in the documentation.</p><p>A very easy way to do this is using <code>preprocess</code> to interchange <code>include</code> statements with file content. First, create a runnable <code>.jl</code> following the format of Literate</p><pre><code class="language-julia"># # Replace includes
# This is an example to replace `include` calls with the actual file content. # This is an example to replace `include` calls with the actual file content.
include(&quot;file1.jl&quot;) include("file1.jl")
# Cool, we just saw the result of the above code snippet. Here is one more: # Cool, we just saw the result of the above code snippet. Here is one more:
include(&quot;file2.jl&quot;)</code></pre><p>Let&#39;s say we have saved this file as <code>examples.jl</code>. Then, you want to properly define a pre-processing function:</p><pre><code class="language-julia">function replace_includes(str) include("file2.jl")</code></pre><p>Let's say we have saved this file as <code>examples.jl</code>. Then, you want to properly define a pre-processing function:</p><pre><code class="language-julia">function replace_includes(str)
included = [&quot;file1.jl&quot;, &quot;file2.jl&quot;] included = ["file1.jl", "file2.jl"]
# Here the path loads the files from their proper directory, # Here the path loads the files from their proper directory,
# which may not be the directory of the `examples.jl` file! # which may not be the directory of the `examples.jl` file!
path = &quot;directory/to/example/files/&quot; path = "directory/to/example/files/"
for ex in included for ex in included
content = read(path*ex, String) content = read(path*ex, String)
str = replace(str, &quot;include(\&quot;$(ex)\&quot;)&quot; =&gt; content) str = replace(str, "include(\"$(ex)\")" =&gt; content)
end end
return str 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. <a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a> as</p><pre><code class="language-julia">Literate.markdown(&quot;examples.jl&quot;, &quot;path/to/save/markdown&quot;; 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. <a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a> as</p><pre><code class="language-julia">Literate.markdown("examples.jl", "path/to/save/markdown";
name = &quot;markdown_file_name&quot;, 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 example in the documentation of the Julia package <a href="https://github.com/JuliaDynamics/TimeseriesPrediction.jl"><code>TimeseriesPrediction</code></a>, see <a href="https://github.com/JuliaDynamics/DynamicalSystems.jl/blob/master/docs/src/tsprediction/stexamples.jl">here</a> and <a href="https://github.com/JuliaDynamics/DynamicalSystems.jl/blob/master/docs/make.jl#L11-L29">here for the generating script</a></p><footer><hr/><a class="previous" href="../outputformats/"><span class="direction">Previous</span><span class="title"><strong>4.</strong> Output Formats</span></a><a class="next" href="../documenter/"><span class="direction">Next</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></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 example in the documentation of the Julia package <a href="https://github.com/JuliaDynamics/TimeseriesPrediction.jl"><code>TimeseriesPrediction</code></a>, see <a href="https://github.com/JuliaDynamics/DynamicalSystems.jl/blob/master/docs/src/tsprediction/stexamples.jl">here</a> and <a href="https://github.com/JuliaDynamics/DynamicalSystems.jl/blob/master/docs/make.jl#L11-L29">here for the generating script</a></p><footer><hr/><a class="previous" href="../outputformats/"><span class="direction">Previous</span><span class="title"><strong>4.</strong> Output Formats</span></a><a class="next" href="../documenter/"><span class="direction">Next</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></HTML>

53
v1.0.3/documenter/index.html

@ -1,12 +1,53 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>6. Interaction with Documenter.jl · Literate.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 data-main="../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>6. Interaction with Documenter.jl · Literate.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"><a href="../index.html"><img class="logo" src="../assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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="../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li class="current"><a class="toctext" href><strong>6.</strong> Interaction with Documenter.jl</a><ul class="internal"></ul></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href><strong>6.</strong> Interaction with Documenter.jl</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/documenter.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>6. Interaction with Documenter.jl</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Interaction-with-Documenter-1" href="#Interaction-with-Documenter-1"><strong>6.</strong> Interaction with Documenter.jl</a></h1><p>Literate can be used for any purpose, it spits out regular markdown files, and notebooks. Typically, though, these files will be used to render documentation for your package. The generators (<a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <a href="../outputformats/#Literate.script"><code>Literate.script</code></a>) supports a keyword argument <code>documenter</code> that lets the generator perform some extra things, keeping in mind that the source code have been written with Documenter.jl in mind. So lets take a look at what will happen if we set <code>documenter = true</code>:</p><h3><a class="nav-anchor" id="[Literate.markdown](@ref):-1" href="#[Literate.markdown](@ref):-1"><a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>:</a></h3><ul><li>The default code fence will change from<pre><code class="language-none">```julia const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="../index.html"><img alt="Literate.jl logo" class="logo" src="../assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="../search/" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li class="current"><a class="toctext" href=""><strong>6.</strong> Interaction with Documenter.jl</a><ul class="internal"></ul></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href=""><strong>6.</strong> Interaction with Documenter.jl</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/documenter.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>6. Interaction with Documenter.jl</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#Interaction-with-Documenter-1" id="Interaction-with-Documenter-1"><strong>6.</strong> Interaction with Documenter.jl</a></h1><p>Literate can be used for any purpose, it spits out regular markdown files, and notebooks. Typically, though, these files will be used to render documentation for your package. The generators (<a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <a href="../outputformats/#Literate.script"><code>Literate.script</code></a>) supports a keyword argument <code>documenter</code> that lets the generator perform some extra things, keeping in mind that the source code have been written with Documenter.jl in mind. So lets take a look at what will happen if we set <code>documenter = true</code>:</p><h3><a class="nav-anchor" href="#[Literate.markdown](@ref):-1" id="[Literate.markdown](@ref):-1"></a><a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>:</h3><ul><li>The default code fence will change from<pre><code class="language-none">```julia
# code # code
```</code></pre>to Documenters <code>@example</code> blocks:<pre><code class="language-none">```@examples $(name) ```</code></pre>to Documenters <code>@example</code> blocks:<pre><code class="language-none">```@examples $(name)
# code # code
```</code></pre></li><li>The following <code>@meta</code> block will be added to the top of the markdown page, which redirects the &quot;Edit on GitHub&quot; link on the top of the page to the <em>source file</em> rather than the generated <code>.md</code> file:<pre><code class="language-none">```@meta ```</code></pre></li><li>The following <code>@meta</code> block will be added to the top of the markdown page, which redirects the "Edit on GitHub" link on the top of the page to the <em>source file</em> rather than the generated <code>.md</code> file:<pre><code class="language-none">```@meta
EditURL = &quot;$(relpath(inputfile, outputdir))&quot; EditURL = "$(relpath(inputfile, outputdir))"
```</code></pre></li></ul><h3><a class="nav-anchor" id="[Literate.notebook](@ref):-1" href="#[Literate.notebook](@ref):-1"><a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a>:</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 notebook.</li><li>Documenter style markdown math<pre><code class="language-none">```math ```</code></pre></li></ul><h3><a class="nav-anchor" href="#[Literate.notebook](@ref):-1" id="[Literate.notebook](@ref):-1"></a><a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></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 notebook.</li><li>Documenter style markdown math<pre><code class="language-none">```math
\int f dx \int f dx
```</code></pre>is replaced with notebook compatible<pre><code class="language-none">\begin{equation} ```</code></pre>is replaced with notebook compatible<pre><code class="language-none">\begin{equation}
\int f dx \int f dx
\end{equation}</code></pre></li></ul><h3><a class="nav-anchor" id="[Literate.script](@ref):-1" href="#[Literate.script](@ref):-1"><a href="../outputformats/#Literate.script"><code>Literate.script</code></a>:</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><footer><hr/><a class="previous" href="../customprocessing/"><span class="direction">Previous</span><span class="title"><strong>5.</strong> Custom pre- and post-processing</span></a><a class="next" href="../generated/example/"><span class="direction">Next</span><span class="title"><strong>7.</strong> Example</span></a></footer></article></body></html> \end{equation}</code></pre></li></ul><h3><a class="nav-anchor" href="#[Literate.script](@ref):-1" id="[Literate.script](@ref):-1"></a><a href="../outputformats/#Literate.script"><code>Literate.script</code></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><footer><hr/><a class="previous" href="../customprocessing/"><span class="direction">Previous</span><span class="title"><strong>5.</strong> Custom pre- and post-processing</span></a><a class="next" href="../generated/example/"><span class="direction">Next</span><span class="title"><strong>7.</strong> Example</span></a></footer></article></body></HTML>

49
v1.0.3/fileformat/index.html

@ -1,5 +1,46 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>2. File Format · Literate.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 data-main="../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>2. File Format · Literate.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"><a href="../index.html"><img class="logo" src="../assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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="../"><strong>1.</strong> Introduction</a></li><li class="current"><a class="toctext" href><strong>2.</strong> File Format</a><ul class="internal"><li><a class="toctext" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></li><li><a class="toctext" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</a></li><li><a class="toctext" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></li></ul></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><a class="toctext" href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href><strong>2.</strong> File Format</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/fileformat.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>2. File Format</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="**2.**-File-Format-1" href="#**2.**-File-Format-1"><strong>2.</strong> File Format</a></h1><p>The source file format for Literate is a regular, commented, julia (<code>.jl</code>) scripts. The idea is that the scripts also serve as documentation on their own and it is also simple to include them in the test-suite, with e.g. <code>include</code>, to make sure the examples stay up do date with other changes in your package.</p><h2><a class="nav-anchor" id="Syntax-1" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></h2><p>The basic syntax is simple:</p><ul><li>lines starting with <code>#</code> are treated as markdown,</li><li>all other lines are treated as julia code.</li></ul><p>Leading whitespace is allowed before <code>#</code>, but it will be removed when generating the output. Since <code>#</code>-lines is treated as markdown we can not use that for regular julia comments, for this you can instead use <code>##</code>, which will render as <code>#</code> in the output.</p><p>Lets look at a simple example:</p><pre><code class="language-julia"># # Rational numbers const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="../index.html"><img alt="Literate.jl logo" class="logo" src="../assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="../search/" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="../"><strong>1.</strong> Introduction</a></li><li class="current"><a class="toctext" href=""><strong>2.</strong> File Format</a><ul class="internal"><li><a class="toctext" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></li><li><a class="toctext" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</a></li><li><a class="toctext" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></li></ul></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><a class="toctext" href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href=""><strong>2.</strong> File Format</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/fileformat.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>2. File Format</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#**2.**-File-Format-1" id="**2.**-File-Format-1"><strong>2.</strong> File Format</a></h1><p>The source file format for Literate is a regular, commented, julia (<code>.jl</code>) scripts. The idea is that the scripts also serve as documentation on their own and it is also simple to include them in the test-suite, with e.g. <code>include</code>, to make sure the examples stay up do date with other changes in your package.</p><h2><a class="nav-anchor" href="#Syntax-1" id="Syntax-1"><strong>2.1.</strong> Syntax</a></h2><p>The basic syntax is simple:</p><ul><li>lines starting with <code>#</code> are treated as markdown,</li><li>all other lines are treated as julia code.</li></ul><p>Leading whitespace is allowed before <code>#</code>, but it will be removed when generating the output. Since <code>#</code>-lines is treated as markdown we can not use that for regular julia comments, for this you can instead use <code>##</code>, which will render as <code>#</code> in the output.</p><p>Lets look at a simple example:</p><pre><code class="language-julia"># # Rational numbers
# #
# In julia rational numbers can be constructed with the `//` operator. # In julia rational numbers can be constructed with the `//` operator.
# Lets define two rational numbers, `x` and `y`: # Lets define two rational numbers, `x` and `y`:
@ -9,9 +50,9 @@ y = 2//5
# When adding `x` and `y` together we obtain a new rational number: # When adding `x` and `y` together we obtain a new rational number:
z = x + y</code></pre><p>In the lines starting with <code>#</code> we can use regular markdown syntax, for example the <code>#</code> used for the heading and the backticks for formatting code. The other lines are regular julia code. We note a couple of things:</p><ul><li>The script is valid julia, which means that we can <code>include</code> it and the example will run (for example in the <code>test/runtests.jl</code> script, to include the example in the test suite).</li><li>The script is &quot;self-explanatory&quot;, i.e. the markdown lines works as comments and thus serve as good documentation on its own.</li></ul><p>For simple use this is all you need to know. The following additional special syntax can also be used:</p><ul><li><code>#md</code>, <code>#nb</code>, <code>#jl</code>, <code>#src</code>: tags to filter lines, see <a href="#Filtering-Lines-1">Filtering Lines</a>,</li><li><code>#-</code>: tag to manually control chunk-splits, see <a href="../pipeline/#Custom-control-over-chunk-splits-1">Custom control over chunk splits</a>.</li></ul><p>There is also some default convenience replacements that will always be performed, see <a href="#Default-Replacements-1">Default Replacements</a>.</p><h2><a class="nav-anchor" id="Filtering-Lines-1" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</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 &quot;tokens&quot; 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> with one of these tokens are filtered out in the <a href="../pipeline/#Pre-processing-1">preprocessing step</a>.</p><p>Suppose, for example, that we want to include a docstring within a <code>@docs</code> block using Documenter. Obviously we don&#39;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><code class="language-julia">#md # ```@docs z = x + y</code></pre><p>In the lines starting with <code>#</code> we can use regular markdown syntax, for example the <code>#</code> used for the heading and the backticks for formatting code. The other lines are regular julia code. We note a couple of things:</p><ul><li>The script is valid julia, which means that we can <code>include</code> it and the example will run (for example in the <code>test/runtests.jl</code> script, to include the example in the test suite).</li><li>The script is "self-explanatory", i.e. the markdown lines works as comments and thus serve as good documentation on its own.</li></ul><p>For simple use this is all you need to know. The following additional special syntax can also be used:</p><ul><li><code>#md</code>, <code>#nb</code>, <code>#jl</code>, <code>#src</code>: tags to filter lines, see <a href="#Filtering-Lines-1">Filtering Lines</a>,</li><li><code>#-</code>: tag to manually control chunk-splits, see <a href="../pipeline/#Custom-control-over-chunk-splits-1">Custom control over chunk splits</a>.</li></ul><p>There is also some default convenience replacements that will always be performed, see <a href="#Default-Replacements-1">Default Replacements</a>.</p><h2><a class="nav-anchor" href="#Filtering-Lines-1" id="Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</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> with one of these tokens are filtered out in the <a href="../pipeline/#Pre-processing-1">preprocessing step</a>.</p><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><code class="language-julia">#md # ```@docs
#md # Literate.markdown #md # Literate.markdown
#md # Literate.notebook #md # Literate.notebook
#md # Literate.markdown #md # Literate.markdown
#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 simple 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><code class="language-julia">using Test #src #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 simple 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><code class="language-julia">using Test #src
@test result == expected_result #src</code></pre><h2><a class="nav-anchor" id="Default-Replacements-1" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></h2><p>The following convenience &quot;macros&quot; are always expanded:</p><ul><li><p><code>@__NAME__</code></p><p>expands to the <code>name</code> keyword argument to <a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <a href="../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>expands to <code>https://github.com/$(ENV[&quot;TRAVIS_REPO_SLUG&quot;])/blob/master/</code> and is a convenient way to use when you want to link to files outside the doc-build directory. For example <code>@__REPO__ROOT_URL__src/Literate.jl</code> would link to the source of the Literate module.</p></li><li><p><code>@__NBVIEWER_ROOT_URL__</code></p><p>expands to <code>https://nbviewer.jupyter.org/github/$(ENV[&quot;TRAVIS_REPO_SLUG&quot;])/blob/gh-pages/$(folder)/</code> where <code>folder</code> is the folder that <code>Documenter.deploydocs</code> deploys too. This can be used if you want a link that opens the generated notebook in <a href="http://nbviewer.jupyter.org/">http://nbviewer.jupyter.org/</a>.</p></li></ul><footer><hr/><a class="previous" href="../"><span class="direction">Previous</span><span class="title"><strong>1.</strong> Introduction</span></a><a class="next" href="../pipeline/"><span class="direction">Next</span><span class="title"><strong>3.</strong> Processing pipeline</span></a></footer></article></body></html> @test result == expected_result #src</code></pre><h2><a class="nav-anchor" href="#Default-Replacements-1" id="Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></h2><p>The following convenience "macros" are always expanded:</p><ul><li><p><code>@__NAME__</code></p><p>expands to the <code>name</code> keyword argument to <a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <a href="../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>expands to <code>https://github.com/$(ENV["TRAVIS_REPO_SLUG"])/blob/master/</code> and is a convenient way to use when you want to link to files outside the doc-build directory. For example <code>@__REPO__ROOT_URL__src/Literate.jl</code> would link to the source of the Literate module.</p></li><li><p><code>@__NBVIEWER_ROOT_URL__</code></p><p>expands to <code>https://nbviewer.jupyter.org/github/$(ENV["TRAVIS_REPO_SLUG"])/blob/gh-pages/$(folder)/</code> where <code>folder</code> is the folder that <code>Documenter.deploydocs</code> deploys too. This can be used if you want a link that opens the generated notebook in <a href="http://nbviewer.jupyter.org/">http://nbviewer.jupyter.org/</a>.</p></li></ul><footer><hr/><a class="previous" href="../"><span class="direction">Previous</span><span class="title"><strong>1.</strong> Introduction</span></a><a class="next" href="../pipeline/"><span class="direction">Next</span><span class="title"><strong>3.</strong> Processing pipeline</span></a></footer></article></body></HTML>

193
v1.0.3/generated/example/index.html

@ -1,7 +1,48 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>7. Example · Literate.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 data-main="../../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../../siteinfo.js"></script><script src="../../../versions.js"></script><link href="../../assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>7. Example · Literate.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"><a href="../../index.html"><img class="logo" src="../../assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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="../../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><a class="toctext" href="../../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li class="current"><a class="toctext" href><strong>7.</strong> Example</a><ul class="internal"></ul></li></ul></nav><article id="docs"><header><nav><ul><li><a href><strong>7.</strong> Example</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>7. Example</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="**7.**-Example-1" href="#**7.**-Example-1"><strong>7.</strong> Example</a></h1><p>This is an example generated with Literate based on this source file: <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><code>example.jl</code></a>. You are seeing the html-output which Documenter have generated based on a markdown file generated with Literate. The corresponding notebook can be found here: <a href="https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v1.0.3/generated/example.ipynb"><code>example.ipynb</code></a>, and the plain script output can be found here: <a href="../example.jl"><code>example.jl</code></a>.</p><p>It is recommended to have the <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl">source file</a> available when reading this, to better understand how the syntax in the source file corresponds to the output you are seeing.</p><h3><a class="nav-anchor" id="Basic-syntax-1" href="#Basic-syntax-1">Basic syntax</a></h3><p>The basic syntax for Literate is simple, lines starting with <code>#</code> is interpreted as markdown, and all the other lines are interpreted as code. Here is some code:</p><div><pre><code class="language-julia">x = 1//3 const head = document.getElementsByTagName('head')[0];
y = 2//5</code></pre><pre><code class="language-none">2//5</code></pre></div><p>In markdown sections we can use markdown syntax. For example, we can write <em>text in italic font</em>, <strong>text in bold font</strong> and use <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">links</a>.</p><p>It is possible to filter out lines depending on the output using the <code>#md</code>, <code>#nb</code>, <code>#jl</code> and <code>#src</code> tags (see <a href="../../fileformat/#Filtering-Lines-1">Filtering Lines</a>):</p><ul><li>This line starts with <code>#md</code> and is thus only visible in the markdown output.</li></ul><p>The source file is parsed in chunks of markdown and code. Starting a line with <code>#-</code> manually inserts a chunk break. For example, if we want to display the output of the following operations we may insert <code>#-</code> in between. These two code blocks will now end up in different <code>@example</code>-blocks in the markdown output, and two different notebook cells in the notebook output.</p><div><pre><code class="language-julia">x + y</code></pre><pre><code class="language-none">11//15</code></pre></div><div><pre><code class="language-julia">x * y</code></pre><pre><code class="language-none">2//15</code></pre></div><h3><a class="nav-anchor" id="Output-Capturing-1" href="#Output-Capturing-1">Output Capturing</a></h3><p>Code chunks are by default placed in Documenter <code>@example</code> blocks in the generated markdown. This means that the output will be captured in a block when Documenter is building the docs. In notebooks the output is captured in output cells, if the <code>execute</code> keyword argument is set to true. Output to <code>stdout</code>/<code>stderr</code> is also captured.</p><div><pre><code class="language-julia">function foo()
println(&quot;This string is printed to stdout.&quot;) // Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="../../index.html"><img alt="Literate.jl logo" class="logo" src="../../assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="../../search/" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="../../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><a class="toctext" href="../../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li class="current"><a class="toctext" href=""><strong>7.</strong> Example</a><ul class="internal"></ul></li></ul></nav><article id="docs"><header><nav><ul><li><a href=""><strong>7.</strong> Example</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>7. Example</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#**7.**-Example-1" id="**7.**-Example-1"><strong>7.</strong> Example</a></h1><p>This is an example generated with Literate based on this source file: <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><code>example.jl</code></a>. You are seeing the html-output which Documenter have generated based on a markdown file generated with Literate. The corresponding notebook can be found here: <a href="https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v1.0.3/generated/example.ipynb"><code>example.ipynb</code></a>, and the plain script output can be found here: <a href="../example.jl"><code>example.jl</code></a>.</p><p>It is recommended to have the <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl">source file</a> available when reading this, to better understand how the syntax in the source file corresponds to the output you are seeing.</p><h3><a class="nav-anchor" href="#Basic-syntax-1" id="Basic-syntax-1">Basic syntax</a></h3><p>The basic syntax for Literate is simple, lines starting with <code>#</code> is interpreted as markdown, and all the other lines are interpreted as code. Here is some code:</p><div><pre><code class="language-julia">x = 1//3
y = 2//5</code></pre><pre><code class="language-none">2//5</code></pre></div><p>In markdown sections we can use markdown syntax. For example, we can write <em>text in italic font</em>, <strong>text in bold font</strong> and use <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">links</a>.</p><p>It is possible to filter out lines depending on the output using the <code>#md</code>, <code>#nb</code>, <code>#jl</code> and <code>#src</code> tags (see <a href="../../fileformat/#Filtering-Lines-1">Filtering Lines</a>):</p><ul><li>This line starts with <code>#md</code> and is thus only visible in the markdown output.</li></ul><p>The source file is parsed in chunks of markdown and code. Starting a line with <code>#-</code> manually inserts a chunk break. For example, if we want to display the output of the following operations we may insert <code>#-</code> in between. These two code blocks will now end up in different <code>@example</code>-blocks in the markdown output, and two different notebook cells in the notebook output.</p><div><pre><code class="language-julia">x + y</code></pre><pre><code class="language-none">11//15</code></pre></div><div><pre><code class="language-julia">x * y</code></pre><pre><code class="language-none">2//15</code></pre></div><h3><a class="nav-anchor" href="#Output-Capturing-1" id="Output-Capturing-1">Output Capturing</a></h3><p>Code chunks are by default placed in Documenter <code>@example</code> blocks in the generated markdown. This means that the output will be captured in a block when Documenter is building the docs. In notebooks the output is captured in output cells, if the <code>execute</code> keyword argument is set to true. Output to <code>stdout</code>/<code>stderr</code> is also captured.</p><div><pre><code class="language-julia">function foo()
println("This string is printed to stdout.")
return [1, 2, 3, 4] return [1, 2, 3, 4]
end end
@ -10,126 +51,55 @@ foo()</code></pre><pre><code class="language-none">This string is printed to std
1 1
2 2
3 3
4</code></pre></div><p>Both Documenter&#39;s <code>@example</code> block and notebooks can display images. Here is an example where we generate a simple plot using the <a href="https://github.com/JuliaPlots/Plots.jl">Plots.jl</a> package</p><div><pre><code class="language-julia">using Plots 4</code></pre></div><p>Both Documenter's <code>@example</code> block and notebooks can display images. Here is an example where we generate a simple plot using the <a href="https://github.com/JuliaPlots/Plots.jl">Plots.jl</a> package</p><div><pre><code class="language-julia">using Plots
x = range(0, stop=6π, length=1000) x = range(0, stop=6π, length=1000)
y1 = sin.(x) y1 = sin.(x)
y2 = cos.(x) y2 = cos.(x)
plot(x, [y1, y2])</code></pre><?xml version="1.0" encoding="utf-8"?> plot(x, [y1, y2])</code></pre><svg height="400" viewBox="0 0 2400 1600" width="600" xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"><defs><clipPath id="clip5500"><rect height="2000" width="2000" x="0" y="0"></rect></clipPath></defs><defs><clipPath id="clip5501"><rect height="1600" width="2400" x="0" y="0"></rect></clipPath></defs><polygon clip-path="url(#clip5501)" fill="#ffffff" fill-opacity="1" fill-rule="evenodd" points="
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="600" height="400" viewBox="0 0 2400 1600">
<defs>
<clipPath id="clip5500">
<rect x="0" y="0" width="2000" height="2000"/>
</clipPath>
</defs>
<defs>
<clipPath id="clip5501">
<rect x="0" y="0" width="2400" height="1600"/>
</clipPath>
</defs>
<polygon clip-path="url(#clip5501)" points="
0,1600 2400,1600 2400,0 0,0 0,1600 2400,1600 2400,0 0,0
" fill="#ffffff" fill-rule="evenodd" fill-opacity="1"/> "></polygon><defs><clipPath id="clip5502"><rect height="1600" width="1681" x="480" y="0"></rect></clipPath></defs><polygon clip-path="url(#clip5501)" fill="#ffffff" fill-opacity="1" fill-rule="evenodd" points="
<defs>
<clipPath id="clip5502">
<rect x="480" y="0" width="1681" height="1600"/>
</clipPath>
</defs>
<polygon clip-path="url(#clip5501)" points="
94.4882,1537.01 2321.26,1537.01 2321.26,47.2441 94.4882,47.2441 94.4882,1537.01 2321.26,1537.01 2321.26,47.2441 94.4882,47.2441
" fill="#ffffff" fill-rule="evenodd" fill-opacity="1"/> "></polygon><defs><clipPath id="clip5503"><rect height="1491" width="2228" x="94" y="47"></rect></clipPath></defs><polyline clip-path="url(#clip5503)" points="
<defs>
<clipPath id="clip5503">
<rect x="94" y="47" width="2228" height="1491"/>
</clipPath>
</defs>
<polyline clip-path="url(#clip5503)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
157.51,1537.01 157.51,47.2441 157.51,1537.01 157.51,47.2441
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip5503)" points="
<polyline clip-path="url(#clip5503)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
714.745,1537.01 714.745,47.2441 714.745,1537.01 714.745,47.2441
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip5503)" points="
<polyline clip-path="url(#clip5503)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
1271.98,1537.01 1271.98,47.2441 1271.98,1537.01 1271.98,47.2441
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip5503)" points="
<polyline clip-path="url(#clip5503)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
1829.22,1537.01 1829.22,47.2441 1829.22,1537.01 1829.22,47.2441
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip5503)" points="
<polyline clip-path="url(#clip5503)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
94.4882,1494.85 2321.26,1494.85 94.4882,1494.85 2321.26,1494.85
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip5503)" points="
<polyline clip-path="url(#clip5503)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
94.4882,1143.49 2321.26,1143.49 94.4882,1143.49 2321.26,1143.49
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip5503)" points="
<polyline clip-path="url(#clip5503)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
94.4882,792.13 2321.26,792.13 94.4882,792.13 2321.26,792.13
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip5503)" points="
<polyline clip-path="url(#clip5503)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
94.4882,440.769 2321.26,440.769 94.4882,440.769 2321.26,440.769
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip5503)" points="
<polyline clip-path="url(#clip5503)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
94.4882,89.4072 2321.26,89.4072 94.4882,89.4072 2321.26,89.4072
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip5501)" points="
<polyline clip-path="url(#clip5501)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
94.4882,1537.01 2321.26,1537.01 94.4882,1537.01 2321.26,1537.01
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5501)" points="
<polyline clip-path="url(#clip5501)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
94.4882,1537.01 94.4882,47.2441 94.4882,1537.01 94.4882,47.2441
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5501)" points="
<polyline clip-path="url(#clip5501)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
157.51,1537.01 157.51,1514.66 157.51,1537.01 157.51,1514.66
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5501)" points="
<polyline clip-path="url(#clip5501)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
714.745,1537.01 714.745,1514.66 714.745,1537.01 714.745,1514.66
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5501)" points="
<polyline clip-path="url(#clip5501)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
1271.98,1537.01 1271.98,1514.66 1271.98,1537.01 1271.98,1514.66
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5501)" points="
<polyline clip-path="url(#clip5501)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
1829.22,1537.01 1829.22,1514.66 1829.22,1537.01 1829.22,1514.66
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5501)" points="
<polyline clip-path="url(#clip5501)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
94.4882,1494.85 127.89,1494.85 94.4882,1494.85 127.89,1494.85
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5501)" points="
<polyline clip-path="url(#clip5501)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
94.4882,1143.49 127.89,1143.49 94.4882,1143.49 127.89,1143.49
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5501)" points="
<polyline clip-path="url(#clip5501)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
94.4882,792.13 127.89,792.13 94.4882,792.13 127.89,792.13
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5501)" points="
<polyline clip-path="url(#clip5501)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
94.4882,440.769 127.89,440.769 94.4882,440.769 127.89,440.769
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5501)" points="
<polyline clip-path="url(#clip5501)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
94.4882,89.4072 127.89,89.4072 94.4882,89.4072 127.89,89.4072
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><g clip-path="url(#clip5501)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 157.51, 1591.01)" x="157.51" y="1591.01">0</text></g><g clip-path="url(#clip5501)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 714.745, 1591.01)" x="714.745" y="1591.01">5</text></g><g clip-path="url(#clip5501)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 1271.98, 1591.01)" x="1271.98" y="1591.01">10</text></g><g clip-path="url(#clip5501)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 1829.22, 1591.01)" x="1829.22" y="1591.01">15</text></g><g clip-path="url(#clip5501)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 1512.35)" x="70.4882" y="1512.35">-1.0</text></g><g clip-path="url(#clip5501)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 1160.99)" x="70.4882" y="1160.99">-0.5</text></g><g clip-path="url(#clip5501)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 809.63)" x="70.4882" y="809.63">0.0</text></g><g clip-path="url(#clip5501)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 458.269)" x="70.4882" y="458.269">0.5</text></g><g clip-path="url(#clip5501)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 106.907)" x="70.4882" y="106.907">1.0</text></g><polyline clip-path="url(#clip5503)" points="
<g clip-path="url(#clip5501)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 157.51, 1591.01)" x="157.51" y="1591.01">0</text>
</g>
<g clip-path="url(#clip5501)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 714.745, 1591.01)" x="714.745" y="1591.01">5</text>
</g>
<g clip-path="url(#clip5501)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 1271.98, 1591.01)" x="1271.98" y="1591.01">10</text>
</g>
<g clip-path="url(#clip5501)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 1829.22, 1591.01)" x="1829.22" y="1591.01">15</text>
</g>
<g clip-path="url(#clip5501)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 1512.35)" x="70.4882" y="1512.35">-1.0</text>
</g>
<g clip-path="url(#clip5501)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 1160.99)" x="70.4882" y="1160.99">-0.5</text>
</g>
<g clip-path="url(#clip5501)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 809.63)" x="70.4882" y="809.63">0.0</text>
</g>
<g clip-path="url(#clip5501)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 458.269)" x="70.4882" y="458.269">0.5</text>
</g>
<g clip-path="url(#clip5501)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 106.907)" x="70.4882" y="106.907">1.0</text>
</g>
<polyline clip-path="url(#clip5503)" style="stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none" points="
157.51,792.13 159.613,778.871 161.716,765.618 163.819,752.373 165.921,739.143 168.024,725.932 170.127,712.744 172.23,699.585 174.333,686.458 176.436,673.369 157.51,792.13 159.613,778.871 161.716,765.618 163.819,752.373 165.921,739.143 168.024,725.932 170.127,712.744 172.23,699.585 174.333,686.458 176.436,673.369
178.538,660.323 180.641,647.323 182.744,634.375 184.847,621.483 186.95,608.651 189.052,595.886 191.155,583.189 193.258,570.568 195.361,558.025 197.464,545.566 178.538,660.323 180.641,647.323 182.744,634.375 184.847,621.483 186.95,608.651 189.052,595.886 191.155,583.189 193.258,570.568 195.361,558.025 197.464,545.566
199.567,533.194 201.669,520.914 203.772,508.731 205.875,496.649 207.978,484.673 210.081,472.805 212.184,461.051 214.286,449.416 216.389,437.902 218.492,426.514 199.567,533.194 201.669,520.914 203.772,508.731 205.875,496.649 207.978,484.673 210.081,472.805 212.184,461.051 214.286,449.416 216.389,437.902 218.492,426.514
@ -231,8 +201,7 @@ plot(x, [y1, y2])</code></pre><?xml version="1.0" encoding="utf-8"?>
2218.28,1038.69 2220.39,1026.23 2222.49,1013.69 2224.59,1001.07 2226.7,988.374 2228.8,975.608 2230.9,962.777 2233,949.885 2235.11,936.937 2237.21,923.937 2218.28,1038.69 2220.39,1026.23 2222.49,1013.69 2224.59,1001.07 2226.7,988.374 2228.8,975.608 2230.9,962.777 2233,949.885 2235.11,936.937 2237.21,923.937
2239.31,910.891 2241.42,897.802 2243.52,884.675 2245.62,871.516 2247.72,858.328 2249.83,845.117 2251.93,831.886 2254.03,818.642 2256.14,805.388 2258.24,792.13 2239.31,910.891 2241.42,897.802 2243.52,884.675 2245.62,871.516 2247.72,858.328 2249.83,845.117 2251.93,831.886 2254.03,818.642 2256.14,805.388 2258.24,792.13
"/> " style="stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5503)" points="
<polyline clip-path="url(#clip5503)" style="stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none" points="
157.51,89.4072 159.613,89.5323 161.716,89.9075 163.819,90.5327 165.921,91.4077 168.024,92.5322 170.127,93.9057 172.23,95.5278 174.333,97.3978 176.436,99.5152 157.51,89.4072 159.613,89.5323 161.716,89.9075 163.819,90.5327 165.921,91.4077 168.024,92.5322 170.127,93.9057 172.23,95.5278 174.333,97.3978 176.436,99.5152
178.538,101.879 180.641,104.489 182.744,107.343 184.847,110.442 186.95,113.783 189.052,117.365 191.155,121.188 193.258,125.25 195.361,129.549 197.464,134.083 178.538,101.879 180.641,104.489 182.744,107.343 184.847,110.442 186.95,113.783 189.052,117.365 191.155,121.188 193.258,125.25 195.361,129.549 197.464,134.083
199.567,138.853 201.669,143.854 203.772,149.087 205.875,154.548 207.978,160.237 210.081,166.15 212.184,172.286 214.286,178.643 216.389,185.218 218.492,192.01 199.567,138.853 201.669,143.854 203.772,149.087 205.875,154.548 207.978,160.237 210.081,166.15 212.184,172.286 214.286,178.643 216.389,185.218 218.492,192.01
@ -334,24 +303,12 @@ plot(x, [y1, y2])</code></pre><?xml version="1.0" encoding="utf-8"?>
2218.28,134.083 2220.39,129.549 2222.49,125.25 2224.59,121.188 2226.7,117.365 2228.8,113.783 2230.9,110.442 2233,107.343 2235.11,104.489 2237.21,101.879 2218.28,134.083 2220.39,129.549 2222.49,125.25 2224.59,121.188 2226.7,117.365 2228.8,113.783 2230.9,110.442 2233,107.343 2235.11,104.489 2237.21,101.879
2239.31,99.5152 2241.42,97.3978 2243.52,95.5278 2245.62,93.9057 2247.72,92.5322 2249.83,91.4077 2251.93,90.5327 2254.03,89.9075 2256.14,89.5323 2258.24,89.4072 2239.31,99.5152 2241.42,97.3978 2243.52,95.5278 2245.62,93.9057 2247.72,92.5322 2249.83,91.4077 2251.93,90.5327 2254.03,89.9075 2256.14,89.5323 2258.24,89.4072
"/> " style="stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polygon clip-path="url(#clip5501)" fill="#ffffff" fill-opacity="1" fill-rule="evenodd" points="
<polygon clip-path="url(#clip5501)" points="
1958.43,312.204 2249.26,312.204 2249.26,130.764 1958.43,130.764 1958.43,312.204 2249.26,312.204 2249.26,130.764 1958.43,130.764
" fill="#ffffff" fill-rule="evenodd" fill-opacity="1"/> "></polygon><polyline clip-path="url(#clip5501)" points="
<polyline clip-path="url(#clip5501)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
1958.43,312.204 2249.26,312.204 2249.26,130.764 1958.43,130.764 1958.43,312.204 1958.43,312.204 2249.26,312.204 2249.26,130.764 1958.43,130.764 1958.43,312.204
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5501)" points="
<polyline clip-path="url(#clip5501)" style="stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none" points="
1982.43,191.244 2126.43,191.244 1982.43,191.244 2126.43,191.244
"/> " style="stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none"></polyline><g clip-path="url(#clip5501)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;" transform="rotate(0, 2150.43, 208.744)" x="2150.43" y="208.744">y1</text></g><polyline clip-path="url(#clip5501)" points="
<g clip-path="url(#clip5501)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;" transform="rotate(0, 2150.43, 208.744)" x="2150.43" y="208.744">y1</text>
</g>
<polyline clip-path="url(#clip5501)" style="stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none" points="
1982.43,251.724 2126.43,251.724 1982.43,251.724 2126.43,251.724
"/> " style="stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none"></polyline><g clip-path="url(#clip5501)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;" transform="rotate(0, 2150.43, 269.224)" x="2150.43" y="269.224">y2</text></g></svg></div><h3><a class="nav-anchor" href="#Custom-processing-1" id="Custom-processing-1">Custom processing</a></h3><p>It is possible to give Literate custom pre- and post-processing functions. For example, here we insert two placeholders, which we will replace with something else at time of generation. We have here replaced our placeholders with <code>z</code> and <code>1.0 + 2.0im</code>:</p><div><pre><code class="language-julia">z = 1.0 + 2.0im</code></pre><pre><code class="language-none">1.0 + 2.0im</code></pre></div><h3><a class="nav-anchor" href="#documenter-interaction-1" id="documenter-interaction-1">Documenter.jl interaction</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, <a href="#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><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p><footer><hr/><a class="previous" href="../../documenter/"><span class="direction">Previous</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></HTML>
<g clip-path="url(#clip5501)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;" transform="rotate(0, 2150.43, 269.224)" x="2150.43" y="269.224">y2</text>
</g>
</svg>
</div><h3><a class="nav-anchor" id="Custom-processing-1" href="#Custom-processing-1">Custom processing</a></h3><p>It is possible to give Literate custom pre- and post-processing functions. For example, here we insert two placeholders, which we will replace with something else at time of generation. We have here replaced our placeholders with <code>z</code> and <code>1.0 + 2.0im</code>:</p><div><pre><code class="language-julia">z = 1.0 + 2.0im</code></pre><pre><code class="language-none">1.0 + 2.0im</code></pre></div><h3><a class="nav-anchor" id="documenter-interaction-1" href="#documenter-interaction-1">Documenter.jl interaction</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, <a href="#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><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p><footer><hr/><a class="previous" href="../../documenter/"><span class="direction">Previous</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></html>

45
v1.0.3/index.html

File diff suppressed because one or more lines are too long

53
v1.0.3/outputformats/index.html

File diff suppressed because one or more lines are too long

51
v1.0.3/pipeline/index.html

File diff suppressed because one or more lines are too long

45
v1.0.3/search/index.html

@ -1,2 +1,43 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>Search · Literate.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 data-main="../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Search · Literate.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"><a href="../index.html"><img class="logo" src="../assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.jl</h1><select id="version-selector" onChange="window.location.href=this.value" style="visibility: hidden"></select><form class="search" id="search-form" action><input id="search-query" name="q" type="text" placeholder="Search docs"/></form><ul><li><a class="toctext" href="../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><a class="toctext" href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article><header><nav><ul><li>Search</li></ul></nav><hr/><div id="topbar"><span>Search</span><a class="fa fa-bars" href="#"></a></div></header><h1>Search</h1><p id="search-info">Number of results: <span id="search-results-number">loading...</span></p><ul id="search-results"></ul></article></body><script src="../search_index.js"></script><script src="../assets/search.js"></script></html> const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="../index.html"><img alt="Literate.jl logo" class="logo" src="../assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><a class="toctext" href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article><header><nav><ul><li>Search</li></ul></nav><hr/><div id="topbar"><span>Search</span><a class="fa fa-bars" href="#"></a></div></header><h1>Search</h1><p id="search-info">Number of results: <span id="search-results-number">loading...</span></p><ul id="search-results"></ul></article><script src="../search_index.js"></script><script src="../assets/search.js"></script></body></HTML>

63
v1.0.4/customprocessing/index.html

@ -1,29 +1,70 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>5. Custom pre- and post-processing · Literate.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 data-main="../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>5. Custom pre- and post-processing · Literate.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"><a href="../index.html"><img class="logo" src="../assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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="../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li class="current"><a class="toctext" href><strong>5.</strong> Custom pre- and post-processing</a><ul class="internal"></ul></li><li><a class="toctext" href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href><strong>5.</strong> Custom pre- and post-processing</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/customprocessing.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>5. Custom pre- and post-processing</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Custom-pre-and-post-processing-1" href="#Custom-pre-and-post-processing-1"><strong>5.</strong> Custom pre- and post-processing</a></h1><p>Since all packages are different, and may have different demands on how to create a nice example for the documentation it is important that the package maintainer does not feel limited by the by default provided syntax that this package offers. While you can generally come a long way by utilizing <a href="../fileformat/#Filtering-Lines-1">line filtering</a> there might be situations where you need to manually hook into the generation and change things. In Literate this is done by letting the user supply custom pre- and post-processing functions that may do transformation of the content.</p><p>All of the generators (<a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <a href="../outputformats/#Literate.script"><code>Literate.script</code></a>) accepts <code>preprocess</code> and <code>postprocess</code> keyword arguments. The default &quot;transformation&quot; is the <code>identity</code> function. The input to the transformation functions is a <code>String</code>, and the output should be the transformed <code>String</code>.</p><p><code>preprocess</code> is sent the raw input that is read from the source file (<a href="../pipeline/#Pre-processing-1">modulo the default line ending transformation</a>). <code>postprocess</code> is given different things depending on the output: For markdown and script output <code>postprocess</code> is given the content <code>String</code> just before writing it to the output file, but for notebook output <code>postprocess</code> is given the dictionary representing the notebook, since, in general, this is more useful.</p><h3><a class="nav-anchor" id="Example:-Adding-current-date-1" href="#Example:-Adding-current-date-1">Example: Adding current date</a></h3><p>As an example, lets say we want to splice the date of generation into the output. We could of course update our source file before generating the docs, but we could instead use a <code>preprocess</code> function that splices the date into the source for us. Consider the following source file:</p><pre><code class="language-julia"># # Example const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="../index.html"><img alt="Literate.jl logo" class="logo" src="../assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="../search/" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li class="current"><a class="toctext" href=""><strong>5.</strong> Custom pre- and post-processing</a><ul class="internal"></ul></li><li><a class="toctext" href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href=""><strong>5.</strong> Custom pre- and post-processing</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/customprocessing.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>5. Custom pre- and post-processing</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#Custom-pre-and-post-processing-1" id="Custom-pre-and-post-processing-1"><strong>5.</strong> Custom pre- and post-processing</a></h1><p>Since all packages are different, and may have different demands on how to create a nice example for the documentation it is important that the package maintainer does not feel limited by the by default provided syntax that this package offers. While you can generally come a long way by utilizing <a href="../fileformat/#Filtering-Lines-1">line filtering</a> there might be situations where you need to manually hook into the generation and change things. In Literate this is done by letting the user supply custom pre- and post-processing functions that may do transformation of the content.</p><p>All of the generators (<a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <a href="../outputformats/#Literate.script"><code>Literate.script</code></a>) accepts <code>preprocess</code> and <code>postprocess</code> keyword arguments. The default "transformation" is the <code>identity</code> function. The input to the transformation functions is a <code>String</code>, and the output should be the transformed <code>String</code>.</p><p><code>preprocess</code> is sent the raw input that is read from the source file (<a href="../pipeline/#Pre-processing-1">modulo the default line ending transformation</a>). <code>postprocess</code> is given different things depending on the output: For markdown and script output <code>postprocess</code> is given the content <code>String</code> just before writing it to the output file, but for notebook output <code>postprocess</code> is given the dictionary representing the notebook, since, in general, this is more useful.</p><h3><a class="nav-anchor" href="#Example:-Adding-current-date-1" id="Example:-Adding-current-date-1">Example: Adding current date</a></h3><p>As an example, lets say we want to splice the date of generation into the output. We could of course update our source file before generating the docs, but we could instead use a <code>preprocess</code> function that splices the date into the source for us. Consider the following source file:</p><pre><code class="language-julia"># # Example
# This example was generated DATEOFTODAY # This example was generated DATEOFTODAY
x = 1 // 3</code></pre><p>where <code>DATEOFTODAY</code> is a placeholder, to make it easier for our <code>preprocess</code> function to find the location. Now, lets define the <code>preprocess</code> function, for example</p><pre><code class="language-julia">function update_date(content) x = 1 // 3</code></pre><p>where <code>DATEOFTODAY</code> is a placeholder, to make it easier for our <code>preprocess</code> function to find the location. Now, lets define the <code>preprocess</code> function, for example</p><pre><code class="language-julia">function update_date(content)
content = replace(content, &quot;DATEOFTODAY&quot; =&gt; Date(now())) content = replace(content, "DATEOFTODAY" =&gt; Date(now()))
return content return content
end</code></pre><p>which would replace every occurrence of <code>&quot;DATEOFTODAY&quot;</code> with the current date. We would now simply give this function to the generator, for example:</p><pre><code class="language-julia">Literate.markdown(&quot;input.jl&quot;, &quot;outputdir&quot;; preprocess = update_date)</code></pre><h3><a class="nav-anchor" id="Example:-Replacing-include-calls-with-included-code-1" href="#Example:-Replacing-include-calls-with-included-code-1">Example: Replacing <code>include</code> calls with included code</a></h3><p>Let&#39;s say that we have some individual example files <code>file1, file2, ...</code> etc. that are <em>runnable</em> and also following the style of Literate. These files could be for example used in the test suite of your package.</p><p>We want to group them all into a single page in our documentation, but we do not want to copy paste the content of <code>file1, ...</code> for robustness: the files are included in the test suite and some changes may occur to them. We want these changes to also be reflected in the documentation.</p><p>A very easy way to do this is using <code>preprocess</code> to interchange <code>include</code> statements with file content. First, create a runnable <code>.jl</code> following the format of Literate</p><pre><code class="language-julia"># # Replace includes end</code></pre><p>which would replace every occurrence of <code>"DATEOFTODAY"</code> with the current date. We would now simply give this function to the generator, for example:</p><pre><code class="language-julia">Literate.markdown("input.jl", "outputdir"; preprocess = update_date)</code></pre><h3><a class="nav-anchor" href="#Example:-Replacing-include-calls-with-included-code-1" id="Example:-Replacing-include-calls-with-included-code-1">Example: Replacing <code>include</code> calls with included code</a></h3><p>Let's say that we have some individual example files <code>file1, file2, ...</code> etc. that are <em>runnable</em> and also following the style of Literate. These files could be for example used in the test suite of your package.</p><p>We want to group them all into a single page in our documentation, but we do not want to copy paste the content of <code>file1, ...</code> for robustness: the files are included in the test suite and some changes may occur to them. We want these changes to also be reflected in the documentation.</p><p>A very easy way to do this is using <code>preprocess</code> to interchange <code>include</code> statements with file content. First, create a runnable <code>.jl</code> following the format of Literate</p><pre><code class="language-julia"># # Replace includes
# This is an example to replace `include` calls with the actual file content. # This is an example to replace `include` calls with the actual file content.
include(&quot;file1.jl&quot;) include("file1.jl")
# Cool, we just saw the result of the above code snippet. Here is one more: # Cool, we just saw the result of the above code snippet. Here is one more:
include(&quot;file2.jl&quot;)</code></pre><p>Let&#39;s say we have saved this file as <code>examples.jl</code>. Then, you want to properly define a pre-processing function:</p><pre><code class="language-julia">function replace_includes(str) include("file2.jl")</code></pre><p>Let's say we have saved this file as <code>examples.jl</code>. Then, you want to properly define a pre-processing function:</p><pre><code class="language-julia">function replace_includes(str)
included = [&quot;file1.jl&quot;, &quot;file2.jl&quot;] included = ["file1.jl", "file2.jl"]
# Here the path loads the files from their proper directory, # Here the path loads the files from their proper directory,
# which may not be the directory of the `examples.jl` file! # which may not be the directory of the `examples.jl` file!
path = &quot;directory/to/example/files/&quot; path = "directory/to/example/files/"
for ex in included for ex in included
content = read(path*ex, String) content = read(path*ex, String)
str = replace(str, &quot;include(\&quot;$(ex)\&quot;)&quot; =&gt; content) str = replace(str, "include(\"$(ex)\")" =&gt; content)
end end
return str 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. <a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a> as</p><pre><code class="language-julia">Literate.markdown(&quot;examples.jl&quot;, &quot;path/to/save/markdown&quot;; 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. <a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a> as</p><pre><code class="language-julia">Literate.markdown("examples.jl", "path/to/save/markdown";
name = &quot;markdown_file_name&quot;, 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 example in the documentation of the Julia package <a href="https://github.com/JuliaDynamics/TimeseriesPrediction.jl"><code>TimeseriesPrediction</code></a>, see <a href="https://github.com/JuliaDynamics/DynamicalSystems.jl/blob/master/docs/src/tsprediction/stexamples.jl">here</a> and <a href="https://github.com/JuliaDynamics/DynamicalSystems.jl/blob/master/docs/make.jl#L11-L29">here for the generating script</a></p><footer><hr/><a class="previous" href="../outputformats/"><span class="direction">Previous</span><span class="title"><strong>4.</strong> Output Formats</span></a><a class="next" href="../documenter/"><span class="direction">Next</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></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 example in the documentation of the Julia package <a href="https://github.com/JuliaDynamics/TimeseriesPrediction.jl"><code>TimeseriesPrediction</code></a>, see <a href="https://github.com/JuliaDynamics/DynamicalSystems.jl/blob/master/docs/src/tsprediction/stexamples.jl">here</a> and <a href="https://github.com/JuliaDynamics/DynamicalSystems.jl/blob/master/docs/make.jl#L11-L29">here for the generating script</a></p><footer><hr/><a class="previous" href="../outputformats/"><span class="direction">Previous</span><span class="title"><strong>4.</strong> Output Formats</span></a><a class="next" href="../documenter/"><span class="direction">Next</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></HTML>

53
v1.0.4/documenter/index.html

@ -1,12 +1,53 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>6. Interaction with Documenter.jl · Literate.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 data-main="../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>6. Interaction with Documenter.jl · Literate.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"><a href="../index.html"><img class="logo" src="../assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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="../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li class="current"><a class="toctext" href><strong>6.</strong> Interaction with Documenter.jl</a><ul class="internal"></ul></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href><strong>6.</strong> Interaction with Documenter.jl</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/documenter.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>6. Interaction with Documenter.jl</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Interaction-with-Documenter-1" href="#Interaction-with-Documenter-1"><strong>6.</strong> Interaction with Documenter.jl</a></h1><p>Literate can be used for any purpose, it spits out regular markdown files, and notebooks. Typically, though, these files will be used to render documentation for your package. The generators (<a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <a href="../outputformats/#Literate.script"><code>Literate.script</code></a>) supports a keyword argument <code>documenter</code> that lets the generator perform some extra things, keeping in mind that the source code have been written with Documenter.jl in mind. So lets take a look at what will happen if we set <code>documenter = true</code>:</p><h3><a class="nav-anchor" id="[Literate.markdown](@ref):-1" href="#[Literate.markdown](@ref):-1"><a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>:</a></h3><ul><li>The default code fence will change from<pre><code class="language-none">```julia const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="../index.html"><img alt="Literate.jl logo" class="logo" src="../assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="../search/" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li class="current"><a class="toctext" href=""><strong>6.</strong> Interaction with Documenter.jl</a><ul class="internal"></ul></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href=""><strong>6.</strong> Interaction with Documenter.jl</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/documenter.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>6. Interaction with Documenter.jl</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#Interaction-with-Documenter-1" id="Interaction-with-Documenter-1"><strong>6.</strong> Interaction with Documenter.jl</a></h1><p>Literate can be used for any purpose, it spits out regular markdown files, and notebooks. Typically, though, these files will be used to render documentation for your package. The generators (<a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <a href="../outputformats/#Literate.script"><code>Literate.script</code></a>) supports a keyword argument <code>documenter</code> that lets the generator perform some extra things, keeping in mind that the source code have been written with Documenter.jl in mind. So lets take a look at what will happen if we set <code>documenter = true</code>:</p><h3><a class="nav-anchor" href="#[Literate.markdown](@ref):-1" id="[Literate.markdown](@ref):-1"></a><a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>:</h3><ul><li>The default code fence will change from<pre><code class="language-none">```julia
# code # code
```</code></pre>to Documenters <code>@example</code> blocks:<pre><code class="language-none">```@examples $(name) ```</code></pre>to Documenters <code>@example</code> blocks:<pre><code class="language-none">```@examples $(name)
# code # code
```</code></pre></li><li>The following <code>@meta</code> block will be added to the top of the markdown page, which redirects the &quot;Edit on GitHub&quot; link on the top of the page to the <em>source file</em> rather than the generated <code>.md</code> file:<pre><code class="language-none">```@meta ```</code></pre></li><li>The following <code>@meta</code> block will be added to the top of the markdown page, which redirects the "Edit on GitHub" link on the top of the page to the <em>source file</em> rather than the generated <code>.md</code> file:<pre><code class="language-none">```@meta
EditURL = &quot;$(relpath(inputfile, outputdir))&quot; EditURL = "$(relpath(inputfile, outputdir))"
```</code></pre></li></ul><h3><a class="nav-anchor" id="[Literate.notebook](@ref):-1" href="#[Literate.notebook](@ref):-1"><a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a>:</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 notebook.</li><li>Documenter style markdown math<pre><code class="language-none">```math ```</code></pre></li></ul><h3><a class="nav-anchor" href="#[Literate.notebook](@ref):-1" id="[Literate.notebook](@ref):-1"></a><a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></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 notebook.</li><li>Documenter style markdown math<pre><code class="language-none">```math
\int f dx \int f dx
```</code></pre>is replaced with notebook compatible<pre><code class="language-none">\begin{equation} ```</code></pre>is replaced with notebook compatible<pre><code class="language-none">\begin{equation}
\int f dx \int f dx
\end{equation}</code></pre></li></ul><h3><a class="nav-anchor" id="[Literate.script](@ref):-1" href="#[Literate.script](@ref):-1"><a href="../outputformats/#Literate.script"><code>Literate.script</code></a>:</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><footer><hr/><a class="previous" href="../customprocessing/"><span class="direction">Previous</span><span class="title"><strong>5.</strong> Custom pre- and post-processing</span></a><a class="next" href="../generated/example/"><span class="direction">Next</span><span class="title"><strong>7.</strong> Example</span></a></footer></article></body></html> \end{equation}</code></pre></li></ul><h3><a class="nav-anchor" href="#[Literate.script](@ref):-1" id="[Literate.script](@ref):-1"></a><a href="../outputformats/#Literate.script"><code>Literate.script</code></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><footer><hr/><a class="previous" href="../customprocessing/"><span class="direction">Previous</span><span class="title"><strong>5.</strong> Custom pre- and post-processing</span></a><a class="next" href="../generated/example/"><span class="direction">Next</span><span class="title"><strong>7.</strong> Example</span></a></footer></article></body></HTML>

49
v1.0.4/fileformat/index.html

@ -1,5 +1,46 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>2. File Format · Literate.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 data-main="../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>2. File Format · Literate.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"><a href="../index.html"><img class="logo" src="../assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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="../"><strong>1.</strong> Introduction</a></li><li class="current"><a class="toctext" href><strong>2.</strong> File Format</a><ul class="internal"><li><a class="toctext" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></li><li><a class="toctext" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</a></li><li><a class="toctext" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></li></ul></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><a class="toctext" href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href><strong>2.</strong> File Format</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/fileformat.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>2. File Format</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="**2.**-File-Format-1" href="#**2.**-File-Format-1"><strong>2.</strong> File Format</a></h1><p>The source file format for Literate is a regular, commented, julia (<code>.jl</code>) scripts. The idea is that the scripts also serve as documentation on their own and it is also simple to include them in the test-suite, with e.g. <code>include</code>, to make sure the examples stay up do date with other changes in your package.</p><h2><a class="nav-anchor" id="Syntax-1" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></h2><p>The basic syntax is simple:</p><ul><li>lines starting with <code>#</code> are treated as markdown,</li><li>all other lines are treated as julia code.</li></ul><p>Leading whitespace is allowed before <code>#</code>, but it will be removed when generating the output. Since <code>#</code>-lines is treated as markdown we can not use that for regular julia comments, for this you can instead use <code>##</code>, which will render as <code>#</code> in the output.</p><p>Lets look at a simple example:</p><pre><code class="language-julia"># # Rational numbers const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="../index.html"><img alt="Literate.jl logo" class="logo" src="../assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="../search/" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="../"><strong>1.</strong> Introduction</a></li><li class="current"><a class="toctext" href=""><strong>2.</strong> File Format</a><ul class="internal"><li><a class="toctext" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></li><li><a class="toctext" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</a></li><li><a class="toctext" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></li></ul></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><a class="toctext" href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href=""><strong>2.</strong> File Format</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/fileformat.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>2. File Format</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#**2.**-File-Format-1" id="**2.**-File-Format-1"><strong>2.</strong> File Format</a></h1><p>The source file format for Literate is a regular, commented, julia (<code>.jl</code>) scripts. The idea is that the scripts also serve as documentation on their own and it is also simple to include them in the test-suite, with e.g. <code>include</code>, to make sure the examples stay up do date with other changes in your package.</p><h2><a class="nav-anchor" href="#Syntax-1" id="Syntax-1"><strong>2.1.</strong> Syntax</a></h2><p>The basic syntax is simple:</p><ul><li>lines starting with <code>#</code> are treated as markdown,</li><li>all other lines are treated as julia code.</li></ul><p>Leading whitespace is allowed before <code>#</code>, but it will be removed when generating the output. Since <code>#</code>-lines is treated as markdown we can not use that for regular julia comments, for this you can instead use <code>##</code>, which will render as <code>#</code> in the output.</p><p>Lets look at a simple example:</p><pre><code class="language-julia"># # Rational numbers
# #
# In julia rational numbers can be constructed with the `//` operator. # In julia rational numbers can be constructed with the `//` operator.
# Lets define two rational numbers, `x` and `y`: # Lets define two rational numbers, `x` and `y`:
@ -9,9 +50,9 @@ y = 2//5
# When adding `x` and `y` together we obtain a new rational number: # When adding `x` and `y` together we obtain a new rational number:
z = x + y</code></pre><p>In the lines starting with <code>#</code> we can use regular markdown syntax, for example the <code>#</code> used for the heading and the backticks for formatting code. The other lines are regular julia code. We note a couple of things:</p><ul><li>The script is valid julia, which means that we can <code>include</code> it and the example will run (for example in the <code>test/runtests.jl</code> script, to include the example in the test suite).</li><li>The script is &quot;self-explanatory&quot;, i.e. the markdown lines works as comments and thus serve as good documentation on its own.</li></ul><p>For simple use this is all you need to know. The following additional special syntax can also be used:</p><ul><li><code>#md</code>, <code>#nb</code>, <code>#jl</code>, <code>#src</code>: tags to filter lines, see <a href="#Filtering-Lines-1">Filtering Lines</a>,</li><li><code>#-</code>: tag to manually control chunk-splits, see <a href="../pipeline/#Custom-control-over-chunk-splits-1">Custom control over chunk splits</a>.</li></ul><p>There is also some default convenience replacements that will always be performed, see <a href="#Default-Replacements-1">Default Replacements</a>.</p><h2><a class="nav-anchor" id="Filtering-Lines-1" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</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 &quot;tokens&quot; 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> with one of these tokens are filtered out in the <a href="../pipeline/#Pre-processing-1">preprocessing step</a>.</p><p>Suppose, for example, that we want to include a docstring within a <code>@docs</code> block using Documenter. Obviously we don&#39;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><code class="language-julia">#md # ```@docs z = x + y</code></pre><p>In the lines starting with <code>#</code> we can use regular markdown syntax, for example the <code>#</code> used for the heading and the backticks for formatting code. The other lines are regular julia code. We note a couple of things:</p><ul><li>The script is valid julia, which means that we can <code>include</code> it and the example will run (for example in the <code>test/runtests.jl</code> script, to include the example in the test suite).</li><li>The script is "self-explanatory", i.e. the markdown lines works as comments and thus serve as good documentation on its own.</li></ul><p>For simple use this is all you need to know. The following additional special syntax can also be used:</p><ul><li><code>#md</code>, <code>#nb</code>, <code>#jl</code>, <code>#src</code>: tags to filter lines, see <a href="#Filtering-Lines-1">Filtering Lines</a>,</li><li><code>#-</code>: tag to manually control chunk-splits, see <a href="../pipeline/#Custom-control-over-chunk-splits-1">Custom control over chunk splits</a>.</li></ul><p>There is also some default convenience replacements that will always be performed, see <a href="#Default-Replacements-1">Default Replacements</a>.</p><h2><a class="nav-anchor" href="#Filtering-Lines-1" id="Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</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> with one of these tokens are filtered out in the <a href="../pipeline/#Pre-processing-1">preprocessing step</a>.</p><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><code class="language-julia">#md # ```@docs
#md # Literate.markdown #md # Literate.markdown
#md # Literate.notebook #md # Literate.notebook
#md # Literate.markdown #md # Literate.markdown
#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 simple 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><code class="language-julia">using Test #src #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 simple 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><code class="language-julia">using Test #src
@test result == expected_result #src</code></pre><h2><a class="nav-anchor" id="Default-Replacements-1" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></h2><p>The following convenience &quot;macros&quot; are always expanded:</p><ul><li><p><code>@__NAME__</code></p><p>expands to the <code>name</code> keyword argument to <a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <a href="../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>expands to <code>https://github.com/$(ENV[&quot;TRAVIS_REPO_SLUG&quot;])/blob/master/</code> and is a convenient way to use when you want to link to files outside the doc-build directory. For example <code>@__REPO__ROOT_URL__src/Literate.jl</code> would link to the source of the Literate module.</p></li><li><p><code>@__NBVIEWER_ROOT_URL__</code></p><p>expands to <code>https://nbviewer.jupyter.org/github/$(ENV[&quot;TRAVIS_REPO_SLUG&quot;])/blob/gh-pages/$(folder)/</code> where <code>folder</code> is the folder that <code>Documenter.deploydocs</code> deploys too. This can be used if you want a link that opens the generated notebook in <a href="http://nbviewer.jupyter.org/">http://nbviewer.jupyter.org/</a>.</p></li></ul><footer><hr/><a class="previous" href="../"><span class="direction">Previous</span><span class="title"><strong>1.</strong> Introduction</span></a><a class="next" href="../pipeline/"><span class="direction">Next</span><span class="title"><strong>3.</strong> Processing pipeline</span></a></footer></article></body></html> @test result == expected_result #src</code></pre><h2><a class="nav-anchor" href="#Default-Replacements-1" id="Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></h2><p>The following convenience "macros" are always expanded:</p><ul><li><p><code>@__NAME__</code></p><p>expands to the <code>name</code> keyword argument to <a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <a href="../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>expands to <code>https://github.com/$(ENV["TRAVIS_REPO_SLUG"])/blob/master/</code> and is a convenient way to use when you want to link to files outside the doc-build directory. For example <code>@__REPO__ROOT_URL__src/Literate.jl</code> would link to the source of the Literate module.</p></li><li><p><code>@__NBVIEWER_ROOT_URL__</code></p><p>expands to <code>https://nbviewer.jupyter.org/github/$(ENV["TRAVIS_REPO_SLUG"])/blob/gh-pages/$(folder)/</code> where <code>folder</code> is the folder that <code>Documenter.deploydocs</code> deploys too. This can be used if you want a link that opens the generated notebook in <a href="http://nbviewer.jupyter.org/">http://nbviewer.jupyter.org/</a>.</p></li></ul><footer><hr/><a class="previous" href="../"><span class="direction">Previous</span><span class="title"><strong>1.</strong> Introduction</span></a><a class="next" href="../pipeline/"><span class="direction">Next</span><span class="title"><strong>3.</strong> Processing pipeline</span></a></footer></article></body></HTML>

193
v1.0.4/generated/example/index.html

@ -1,7 +1,48 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>7. Example · Literate.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 data-main="../../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../../siteinfo.js"></script><script src="../../../versions.js"></script><link href="../../assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>7. Example · Literate.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"><a href="../../index.html"><img class="logo" src="../../assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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="../../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><a class="toctext" href="../../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li class="current"><a class="toctext" href><strong>7.</strong> Example</a><ul class="internal"></ul></li></ul></nav><article id="docs"><header><nav><ul><li><a href><strong>7.</strong> Example</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>7. Example</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="**7.**-Example-1" href="#**7.**-Example-1"><strong>7.</strong> Example</a></h1><p>This is an example generated with Literate based on this source file: <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><code>example.jl</code></a>. You are seeing the html-output which Documenter have generated based on a markdown file generated with Literate. The corresponding notebook can be found here: <a href="https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v1.0.4/generated/example.ipynb"><code>example.ipynb</code></a>, and the plain script output can be found here: <a href="../example.jl"><code>example.jl</code></a>.</p><p>It is recommended to have the <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl">source file</a> available when reading this, to better understand how the syntax in the source file corresponds to the output you are seeing.</p><h3><a class="nav-anchor" id="Basic-syntax-1" href="#Basic-syntax-1">Basic syntax</a></h3><p>The basic syntax for Literate is simple, lines starting with <code>#</code> is interpreted as markdown, and all the other lines are interpreted as code. Here is some code:</p><div><pre><code class="language-julia">x = 1//3 const head = document.getElementsByTagName('head')[0];
y = 2//5</code></pre><pre><code class="language-none">2//5</code></pre></div><p>In markdown sections we can use markdown syntax. For example, we can write <em>text in italic font</em>, <strong>text in bold font</strong> and use <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">links</a>.</p><p>It is possible to filter out lines depending on the output using the <code>#md</code>, <code>#nb</code>, <code>#jl</code> and <code>#src</code> tags (see <a href="../../fileformat/#Filtering-Lines-1">Filtering Lines</a>):</p><ul><li>This line starts with <code>#md</code> and is thus only visible in the markdown output.</li></ul><p>The source file is parsed in chunks of markdown and code. Starting a line with <code>#-</code> manually inserts a chunk break. For example, if we want to display the output of the following operations we may insert <code>#-</code> in between. These two code blocks will now end up in different <code>@example</code>-blocks in the markdown output, and two different notebook cells in the notebook output.</p><div><pre><code class="language-julia">x + y</code></pre><pre><code class="language-none">11//15</code></pre></div><div><pre><code class="language-julia">x * y</code></pre><pre><code class="language-none">2//15</code></pre></div><h3><a class="nav-anchor" id="Output-Capturing-1" href="#Output-Capturing-1">Output Capturing</a></h3><p>Code chunks are by default placed in Documenter <code>@example</code> blocks in the generated markdown. This means that the output will be captured in a block when Documenter is building the docs. In notebooks the output is captured in output cells, if the <code>execute</code> keyword argument is set to true. Output to <code>stdout</code>/<code>stderr</code> is also captured.</p><div><pre><code class="language-julia">function foo()
println(&quot;This string is printed to stdout.&quot;) // Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="../../index.html"><img alt="Literate.jl logo" class="logo" src="../../assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="../../search/" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="../../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><a class="toctext" href="../../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li class="current"><a class="toctext" href=""><strong>7.</strong> Example</a><ul class="internal"></ul></li></ul></nav><article id="docs"><header><nav><ul><li><a href=""><strong>7.</strong> Example</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>7. Example</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#**7.**-Example-1" id="**7.**-Example-1"><strong>7.</strong> Example</a></h1><p>This is an example generated with Literate based on this source file: <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><code>example.jl</code></a>. You are seeing the html-output which Documenter have generated based on a markdown file generated with Literate. The corresponding notebook can be found here: <a href="https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v1.0.4/generated/example.ipynb"><code>example.ipynb</code></a>, and the plain script output can be found here: <a href="../example.jl"><code>example.jl</code></a>.</p><p>It is recommended to have the <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl">source file</a> available when reading this, to better understand how the syntax in the source file corresponds to the output you are seeing.</p><h3><a class="nav-anchor" href="#Basic-syntax-1" id="Basic-syntax-1">Basic syntax</a></h3><p>The basic syntax for Literate is simple, lines starting with <code>#</code> is interpreted as markdown, and all the other lines are interpreted as code. Here is some code:</p><div><pre><code class="language-julia">x = 1//3
y = 2//5</code></pre><pre><code class="language-none">2//5</code></pre></div><p>In markdown sections we can use markdown syntax. For example, we can write <em>text in italic font</em>, <strong>text in bold font</strong> and use <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">links</a>.</p><p>It is possible to filter out lines depending on the output using the <code>#md</code>, <code>#nb</code>, <code>#jl</code> and <code>#src</code> tags (see <a href="../../fileformat/#Filtering-Lines-1">Filtering Lines</a>):</p><ul><li>This line starts with <code>#md</code> and is thus only visible in the markdown output.</li></ul><p>The source file is parsed in chunks of markdown and code. Starting a line with <code>#-</code> manually inserts a chunk break. For example, if we want to display the output of the following operations we may insert <code>#-</code> in between. These two code blocks will now end up in different <code>@example</code>-blocks in the markdown output, and two different notebook cells in the notebook output.</p><div><pre><code class="language-julia">x + y</code></pre><pre><code class="language-none">11//15</code></pre></div><div><pre><code class="language-julia">x * y</code></pre><pre><code class="language-none">2//15</code></pre></div><h3><a class="nav-anchor" href="#Output-Capturing-1" id="Output-Capturing-1">Output Capturing</a></h3><p>Code chunks are by default placed in Documenter <code>@example</code> blocks in the generated markdown. This means that the output will be captured in a block when Documenter is building the docs. In notebooks the output is captured in output cells, if the <code>execute</code> keyword argument is set to true. Output to <code>stdout</code>/<code>stderr</code> is also captured.</p><div><pre><code class="language-julia">function foo()
println("This string is printed to stdout.")
return [1, 2, 3, 4] return [1, 2, 3, 4]
end end
@ -10,126 +51,55 @@ foo()</code></pre><pre><code class="language-none">This string is printed to std
1 1
2 2
3 3
4</code></pre></div><p>Both Documenter&#39;s <code>@example</code> block and notebooks can display images. Here is an example where we generate a simple plot using the <a href="https://github.com/JuliaPlots/Plots.jl">Plots.jl</a> package</p><div><pre><code class="language-julia">using Plots 4</code></pre></div><p>Both Documenter's <code>@example</code> block and notebooks can display images. Here is an example where we generate a simple plot using the <a href="https://github.com/JuliaPlots/Plots.jl">Plots.jl</a> package</p><div><pre><code class="language-julia">using Plots
x = range(0, stop=6π, length=1000) x = range(0, stop=6π, length=1000)
y1 = sin.(x) y1 = sin.(x)
y2 = cos.(x) y2 = cos.(x)
plot(x, [y1, y2])</code></pre><?xml version="1.0" encoding="utf-8"?> plot(x, [y1, y2])</code></pre><svg height="400" viewBox="0 0 2400 1600" width="600" xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"><defs><clipPath id="clip5300"><rect height="2000" width="2000" x="0" y="0"></rect></clipPath></defs><defs><clipPath id="clip5301"><rect height="1600" width="2400" x="0" y="0"></rect></clipPath></defs><polygon clip-path="url(#clip5301)" fill="#ffffff" fill-opacity="1" fill-rule="evenodd" points="
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="600" height="400" viewBox="0 0 2400 1600">
<defs>
<clipPath id="clip5300">
<rect x="0" y="0" width="2000" height="2000"/>
</clipPath>
</defs>
<defs>
<clipPath id="clip5301">
<rect x="0" y="0" width="2400" height="1600"/>
</clipPath>
</defs>
<polygon clip-path="url(#clip5301)" points="
0,1600 2400,1600 2400,0 0,0 0,1600 2400,1600 2400,0 0,0
" fill="#ffffff" fill-rule="evenodd" fill-opacity="1"/> "></polygon><defs><clipPath id="clip5302"><rect height="1600" width="1681" x="480" y="0"></rect></clipPath></defs><polygon clip-path="url(#clip5301)" fill="#ffffff" fill-opacity="1" fill-rule="evenodd" points="
<defs>
<clipPath id="clip5302">
<rect x="480" y="0" width="1681" height="1600"/>
</clipPath>
</defs>
<polygon clip-path="url(#clip5301)" points="
94.4882,1537.01 2321.26,1537.01 2321.26,47.2441 94.4882,47.2441 94.4882,1537.01 2321.26,1537.01 2321.26,47.2441 94.4882,47.2441
" fill="#ffffff" fill-rule="evenodd" fill-opacity="1"/> "></polygon><defs><clipPath id="clip5303"><rect height="1491" width="2228" x="94" y="47"></rect></clipPath></defs><polyline clip-path="url(#clip5303)" points="
<defs>
<clipPath id="clip5303">
<rect x="94" y="47" width="2228" height="1491"/>
</clipPath>
</defs>
<polyline clip-path="url(#clip5303)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
157.51,1537.01 157.51,47.2441 157.51,1537.01 157.51,47.2441
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip5303)" points="
<polyline clip-path="url(#clip5303)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
714.745,1537.01 714.745,47.2441 714.745,1537.01 714.745,47.2441
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip5303)" points="
<polyline clip-path="url(#clip5303)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
1271.98,1537.01 1271.98,47.2441 1271.98,1537.01 1271.98,47.2441
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip5303)" points="
<polyline clip-path="url(#clip5303)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
1829.22,1537.01 1829.22,47.2441 1829.22,1537.01 1829.22,47.2441
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip5303)" points="
<polyline clip-path="url(#clip5303)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
94.4882,1494.85 2321.26,1494.85 94.4882,1494.85 2321.26,1494.85
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip5303)" points="
<polyline clip-path="url(#clip5303)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
94.4882,1143.49 2321.26,1143.49 94.4882,1143.49 2321.26,1143.49
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip5303)" points="
<polyline clip-path="url(#clip5303)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
94.4882,792.13 2321.26,792.13 94.4882,792.13 2321.26,792.13
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip5303)" points="
<polyline clip-path="url(#clip5303)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
94.4882,440.769 2321.26,440.769 94.4882,440.769 2321.26,440.769
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip5303)" points="
<polyline clip-path="url(#clip5303)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
94.4882,89.4072 2321.26,89.4072 94.4882,89.4072 2321.26,89.4072
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip5301)" points="
<polyline clip-path="url(#clip5301)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
94.4882,1537.01 2321.26,1537.01 94.4882,1537.01 2321.26,1537.01
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5301)" points="
<polyline clip-path="url(#clip5301)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
94.4882,1537.01 94.4882,47.2441 94.4882,1537.01 94.4882,47.2441
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5301)" points="
<polyline clip-path="url(#clip5301)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
157.51,1537.01 157.51,1514.66 157.51,1537.01 157.51,1514.66
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5301)" points="
<polyline clip-path="url(#clip5301)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
714.745,1537.01 714.745,1514.66 714.745,1537.01 714.745,1514.66
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5301)" points="
<polyline clip-path="url(#clip5301)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
1271.98,1537.01 1271.98,1514.66 1271.98,1537.01 1271.98,1514.66
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5301)" points="
<polyline clip-path="url(#clip5301)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
1829.22,1537.01 1829.22,1514.66 1829.22,1537.01 1829.22,1514.66
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5301)" points="
<polyline clip-path="url(#clip5301)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
94.4882,1494.85 127.89,1494.85 94.4882,1494.85 127.89,1494.85
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5301)" points="
<polyline clip-path="url(#clip5301)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
94.4882,1143.49 127.89,1143.49 94.4882,1143.49 127.89,1143.49
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5301)" points="
<polyline clip-path="url(#clip5301)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
94.4882,792.13 127.89,792.13 94.4882,792.13 127.89,792.13
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5301)" points="
<polyline clip-path="url(#clip5301)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
94.4882,440.769 127.89,440.769 94.4882,440.769 127.89,440.769
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5301)" points="
<polyline clip-path="url(#clip5301)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
94.4882,89.4072 127.89,89.4072 94.4882,89.4072 127.89,89.4072
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><g clip-path="url(#clip5301)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 157.51, 1591.01)" x="157.51" y="1591.01">0</text></g><g clip-path="url(#clip5301)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 714.745, 1591.01)" x="714.745" y="1591.01">5</text></g><g clip-path="url(#clip5301)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 1271.98, 1591.01)" x="1271.98" y="1591.01">10</text></g><g clip-path="url(#clip5301)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 1829.22, 1591.01)" x="1829.22" y="1591.01">15</text></g><g clip-path="url(#clip5301)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 1512.35)" x="70.4882" y="1512.35">-1.0</text></g><g clip-path="url(#clip5301)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 1160.99)" x="70.4882" y="1160.99">-0.5</text></g><g clip-path="url(#clip5301)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 809.63)" x="70.4882" y="809.63">0.0</text></g><g clip-path="url(#clip5301)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 458.269)" x="70.4882" y="458.269">0.5</text></g><g clip-path="url(#clip5301)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 106.907)" x="70.4882" y="106.907">1.0</text></g><polyline clip-path="url(#clip5303)" points="
<g clip-path="url(#clip5301)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 157.51, 1591.01)" x="157.51" y="1591.01">0</text>
</g>
<g clip-path="url(#clip5301)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 714.745, 1591.01)" x="714.745" y="1591.01">5</text>
</g>
<g clip-path="url(#clip5301)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 1271.98, 1591.01)" x="1271.98" y="1591.01">10</text>
</g>
<g clip-path="url(#clip5301)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 1829.22, 1591.01)" x="1829.22" y="1591.01">15</text>
</g>
<g clip-path="url(#clip5301)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 1512.35)" x="70.4882" y="1512.35">-1.0</text>
</g>
<g clip-path="url(#clip5301)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 1160.99)" x="70.4882" y="1160.99">-0.5</text>
</g>
<g clip-path="url(#clip5301)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 809.63)" x="70.4882" y="809.63">0.0</text>
</g>
<g clip-path="url(#clip5301)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 458.269)" x="70.4882" y="458.269">0.5</text>
</g>
<g clip-path="url(#clip5301)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 106.907)" x="70.4882" y="106.907">1.0</text>
</g>
<polyline clip-path="url(#clip5303)" style="stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none" points="
157.51,792.13 159.613,778.871 161.716,765.618 163.819,752.373 165.921,739.143 168.024,725.932 170.127,712.744 172.23,699.585 174.333,686.458 176.436,673.369 157.51,792.13 159.613,778.871 161.716,765.618 163.819,752.373 165.921,739.143 168.024,725.932 170.127,712.744 172.23,699.585 174.333,686.458 176.436,673.369
178.538,660.323 180.641,647.323 182.744,634.375 184.847,621.483 186.95,608.651 189.052,595.886 191.155,583.189 193.258,570.568 195.361,558.025 197.464,545.566 178.538,660.323 180.641,647.323 182.744,634.375 184.847,621.483 186.95,608.651 189.052,595.886 191.155,583.189 193.258,570.568 195.361,558.025 197.464,545.566
199.567,533.194 201.669,520.914 203.772,508.731 205.875,496.649 207.978,484.673 210.081,472.805 212.184,461.051 214.286,449.416 216.389,437.902 218.492,426.514 199.567,533.194 201.669,520.914 203.772,508.731 205.875,496.649 207.978,484.673 210.081,472.805 212.184,461.051 214.286,449.416 216.389,437.902 218.492,426.514
@ -231,8 +201,7 @@ plot(x, [y1, y2])</code></pre><?xml version="1.0" encoding="utf-8"?>
2218.28,1038.69 2220.39,1026.23 2222.49,1013.69 2224.59,1001.07 2226.7,988.374 2228.8,975.608 2230.9,962.777 2233,949.885 2235.11,936.937 2237.21,923.937 2218.28,1038.69 2220.39,1026.23 2222.49,1013.69 2224.59,1001.07 2226.7,988.374 2228.8,975.608 2230.9,962.777 2233,949.885 2235.11,936.937 2237.21,923.937
2239.31,910.891 2241.42,897.802 2243.52,884.675 2245.62,871.516 2247.72,858.328 2249.83,845.117 2251.93,831.886 2254.03,818.642 2256.14,805.388 2258.24,792.13 2239.31,910.891 2241.42,897.802 2243.52,884.675 2245.62,871.516 2247.72,858.328 2249.83,845.117 2251.93,831.886 2254.03,818.642 2256.14,805.388 2258.24,792.13
"/> " style="stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5303)" points="
<polyline clip-path="url(#clip5303)" style="stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none" points="
157.51,89.4072 159.613,89.5323 161.716,89.9075 163.819,90.5327 165.921,91.4077 168.024,92.5322 170.127,93.9057 172.23,95.5278 174.333,97.3978 176.436,99.5152 157.51,89.4072 159.613,89.5323 161.716,89.9075 163.819,90.5327 165.921,91.4077 168.024,92.5322 170.127,93.9057 172.23,95.5278 174.333,97.3978 176.436,99.5152
178.538,101.879 180.641,104.489 182.744,107.343 184.847,110.442 186.95,113.783 189.052,117.365 191.155,121.188 193.258,125.25 195.361,129.549 197.464,134.083 178.538,101.879 180.641,104.489 182.744,107.343 184.847,110.442 186.95,113.783 189.052,117.365 191.155,121.188 193.258,125.25 195.361,129.549 197.464,134.083
199.567,138.853 201.669,143.854 203.772,149.087 205.875,154.548 207.978,160.237 210.081,166.15 212.184,172.286 214.286,178.643 216.389,185.218 218.492,192.01 199.567,138.853 201.669,143.854 203.772,149.087 205.875,154.548 207.978,160.237 210.081,166.15 212.184,172.286 214.286,178.643 216.389,185.218 218.492,192.01
@ -334,24 +303,12 @@ plot(x, [y1, y2])</code></pre><?xml version="1.0" encoding="utf-8"?>
2218.28,134.083 2220.39,129.549 2222.49,125.25 2224.59,121.188 2226.7,117.365 2228.8,113.783 2230.9,110.442 2233,107.343 2235.11,104.489 2237.21,101.879 2218.28,134.083 2220.39,129.549 2222.49,125.25 2224.59,121.188 2226.7,117.365 2228.8,113.783 2230.9,110.442 2233,107.343 2235.11,104.489 2237.21,101.879
2239.31,99.5152 2241.42,97.3978 2243.52,95.5278 2245.62,93.9057 2247.72,92.5322 2249.83,91.4077 2251.93,90.5327 2254.03,89.9075 2256.14,89.5323 2258.24,89.4072 2239.31,99.5152 2241.42,97.3978 2243.52,95.5278 2245.62,93.9057 2247.72,92.5322 2249.83,91.4077 2251.93,90.5327 2254.03,89.9075 2256.14,89.5323 2258.24,89.4072
"/> " style="stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polygon clip-path="url(#clip5301)" fill="#ffffff" fill-opacity="1" fill-rule="evenodd" points="
<polygon clip-path="url(#clip5301)" points="
1958.43,312.204 2249.26,312.204 2249.26,130.764 1958.43,130.764 1958.43,312.204 2249.26,312.204 2249.26,130.764 1958.43,130.764
" fill="#ffffff" fill-rule="evenodd" fill-opacity="1"/> "></polygon><polyline clip-path="url(#clip5301)" points="
<polyline clip-path="url(#clip5301)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
1958.43,312.204 2249.26,312.204 2249.26,130.764 1958.43,130.764 1958.43,312.204 1958.43,312.204 2249.26,312.204 2249.26,130.764 1958.43,130.764 1958.43,312.204
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5301)" points="
<polyline clip-path="url(#clip5301)" style="stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none" points="
1982.43,191.244 2126.43,191.244 1982.43,191.244 2126.43,191.244
"/> " style="stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none"></polyline><g clip-path="url(#clip5301)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;" transform="rotate(0, 2150.43, 208.744)" x="2150.43" y="208.744">y1</text></g><polyline clip-path="url(#clip5301)" points="
<g clip-path="url(#clip5301)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;" transform="rotate(0, 2150.43, 208.744)" x="2150.43" y="208.744">y1</text>
</g>
<polyline clip-path="url(#clip5301)" style="stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none" points="
1982.43,251.724 2126.43,251.724 1982.43,251.724 2126.43,251.724
"/> " style="stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none"></polyline><g clip-path="url(#clip5301)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;" transform="rotate(0, 2150.43, 269.224)" x="2150.43" y="269.224">y2</text></g></svg></div><h3><a class="nav-anchor" href="#Custom-processing-1" id="Custom-processing-1">Custom processing</a></h3><p>It is possible to give Literate custom pre- and post-processing functions. For example, here we insert two placeholders, which we will replace with something else at time of generation. We have here replaced our placeholders with <code>z</code> and <code>1.0 + 2.0im</code>:</p><div><pre><code class="language-julia">z = 1.0 + 2.0im</code></pre><pre><code class="language-none">1.0 + 2.0im</code></pre></div><h3><a class="nav-anchor" href="#documenter-interaction-1" id="documenter-interaction-1">Documenter.jl interaction</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, <a href="#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><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p><footer><hr/><a class="previous" href="../../documenter/"><span class="direction">Previous</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></HTML>
<g clip-path="url(#clip5301)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;" transform="rotate(0, 2150.43, 269.224)" x="2150.43" y="269.224">y2</text>
</g>
</svg>
</div><h3><a class="nav-anchor" id="Custom-processing-1" href="#Custom-processing-1">Custom processing</a></h3><p>It is possible to give Literate custom pre- and post-processing functions. For example, here we insert two placeholders, which we will replace with something else at time of generation. We have here replaced our placeholders with <code>z</code> and <code>1.0 + 2.0im</code>:</p><div><pre><code class="language-julia">z = 1.0 + 2.0im</code></pre><pre><code class="language-none">1.0 + 2.0im</code></pre></div><h3><a class="nav-anchor" id="documenter-interaction-1" href="#documenter-interaction-1">Documenter.jl interaction</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, <a href="#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><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p><footer><hr/><a class="previous" href="../../documenter/"><span class="direction">Previous</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></html>

45
v1.0.4/index.html

File diff suppressed because one or more lines are too long

53
v1.0.4/outputformats/index.html

File diff suppressed because one or more lines are too long

51
v1.0.4/pipeline/index.html

File diff suppressed because one or more lines are too long

45
v1.0.4/search/index.html

@ -1,2 +1,43 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>Search · Literate.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 data-main="../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Search · Literate.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"><a href="../index.html"><img class="logo" src="../assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.jl</h1><select id="version-selector" onChange="window.location.href=this.value" style="visibility: hidden"></select><form class="search" id="search-form" action><input id="search-query" name="q" type="text" placeholder="Search docs"/></form><ul><li><a class="toctext" href="../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><a class="toctext" href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article><header><nav><ul><li>Search</li></ul></nav><hr/><div id="topbar"><span>Search</span><a class="fa fa-bars" href="#"></a></div></header><h1>Search</h1><p id="search-info">Number of results: <span id="search-results-number">loading...</span></p><ul id="search-results"></ul></article></body><script src="../search_index.js"></script><script src="../assets/search.js"></script></html> const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="../index.html"><img alt="Literate.jl logo" class="logo" src="../assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><a class="toctext" href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article><header><nav><ul><li>Search</li></ul></nav><hr/><div id="topbar"><span>Search</span><a class="fa fa-bars" href="#"></a></div></header><h1>Search</h1><p id="search-info">Number of results: <span id="search-results-number">loading...</span></p><ul id="search-results"></ul></article><script src="../search_index.js"></script><script src="../assets/search.js"></script></body></HTML>

63
v1.0.5/customprocessing/index.html

@ -1,29 +1,70 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>5. Custom pre- and post-processing · Literate.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 data-main="../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>5. Custom pre- and post-processing · Literate.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"><a href="../index.html"><img class="logo" src="../assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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="../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li class="current"><a class="toctext" href><strong>5.</strong> Custom pre- and post-processing</a><ul class="internal"></ul></li><li><a class="toctext" href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href><strong>5.</strong> Custom pre- and post-processing</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/customprocessing.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>5. Custom pre- and post-processing</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Custom-pre-and-post-processing-1" href="#Custom-pre-and-post-processing-1"><strong>5.</strong> Custom pre- and post-processing</a></h1><p>Since all packages are different, and may have different demands on how to create a nice example for the documentation it is important that the package maintainer does not feel limited by the by default provided syntax that this package offers. While you can generally come a long way by utilizing <a href="../fileformat/#Filtering-Lines-1">line filtering</a> there might be situations where you need to manually hook into the generation and change things. In Literate this is done by letting the user supply custom pre- and post-processing functions that may do transformation of the content.</p><p>All of the generators (<a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <a href="../outputformats/#Literate.script"><code>Literate.script</code></a>) accepts <code>preprocess</code> and <code>postprocess</code> keyword arguments. The default &quot;transformation&quot; is the <code>identity</code> function. The input to the transformation functions is a <code>String</code>, and the output should be the transformed <code>String</code>.</p><p><code>preprocess</code> is sent the raw input that is read from the source file (<a href="../pipeline/#Pre-processing-1">modulo the default line ending transformation</a>). <code>postprocess</code> is given different things depending on the output: For markdown and script output <code>postprocess</code> is given the content <code>String</code> just before writing it to the output file, but for notebook output <code>postprocess</code> is given the dictionary representing the notebook, since, in general, this is more useful.</p><h3><a class="nav-anchor" id="Example:-Adding-current-date-1" href="#Example:-Adding-current-date-1">Example: Adding current date</a></h3><p>As an example, lets say we want to splice the date of generation into the output. We could of course update our source file before generating the docs, but we could instead use a <code>preprocess</code> function that splices the date into the source for us. Consider the following source file:</p><pre><code class="language-julia"># # Example const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="../index.html"><img alt="Literate.jl logo" class="logo" src="../assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="../search/" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li class="current"><a class="toctext" href=""><strong>5.</strong> Custom pre- and post-processing</a><ul class="internal"></ul></li><li><a class="toctext" href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href=""><strong>5.</strong> Custom pre- and post-processing</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/customprocessing.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>5. Custom pre- and post-processing</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#Custom-pre-and-post-processing-1" id="Custom-pre-and-post-processing-1"><strong>5.</strong> Custom pre- and post-processing</a></h1><p>Since all packages are different, and may have different demands on how to create a nice example for the documentation it is important that the package maintainer does not feel limited by the by default provided syntax that this package offers. While you can generally come a long way by utilizing <a href="../fileformat/#Filtering-Lines-1">line filtering</a> there might be situations where you need to manually hook into the generation and change things. In Literate this is done by letting the user supply custom pre- and post-processing functions that may do transformation of the content.</p><p>All of the generators (<a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <a href="../outputformats/#Literate.script"><code>Literate.script</code></a>) accepts <code>preprocess</code> and <code>postprocess</code> keyword arguments. The default "transformation" is the <code>identity</code> function. The input to the transformation functions is a <code>String</code>, and the output should be the transformed <code>String</code>.</p><p><code>preprocess</code> is sent the raw input that is read from the source file (<a href="../pipeline/#Pre-processing-1">modulo the default line ending transformation</a>). <code>postprocess</code> is given different things depending on the output: For markdown and script output <code>postprocess</code> is given the content <code>String</code> just before writing it to the output file, but for notebook output <code>postprocess</code> is given the dictionary representing the notebook, since, in general, this is more useful.</p><h3><a class="nav-anchor" href="#Example:-Adding-current-date-1" id="Example:-Adding-current-date-1">Example: Adding current date</a></h3><p>As an example, lets say we want to splice the date of generation into the output. We could of course update our source file before generating the docs, but we could instead use a <code>preprocess</code> function that splices the date into the source for us. Consider the following source file:</p><pre><code class="language-julia"># # Example
# This example was generated DATEOFTODAY # This example was generated DATEOFTODAY
x = 1 // 3</code></pre><p>where <code>DATEOFTODAY</code> is a placeholder, to make it easier for our <code>preprocess</code> function to find the location. Now, lets define the <code>preprocess</code> function, for example</p><pre><code class="language-julia">function update_date(content) x = 1 // 3</code></pre><p>where <code>DATEOFTODAY</code> is a placeholder, to make it easier for our <code>preprocess</code> function to find the location. Now, lets define the <code>preprocess</code> function, for example</p><pre><code class="language-julia">function update_date(content)
content = replace(content, &quot;DATEOFTODAY&quot; =&gt; Date(now())) content = replace(content, "DATEOFTODAY" =&gt; Date(now()))
return content return content
end</code></pre><p>which would replace every occurrence of <code>&quot;DATEOFTODAY&quot;</code> with the current date. We would now simply give this function to the generator, for example:</p><pre><code class="language-julia">Literate.markdown(&quot;input.jl&quot;, &quot;outputdir&quot;; preprocess = update_date)</code></pre><h3><a class="nav-anchor" id="Example:-Replacing-include-calls-with-included-code-1" href="#Example:-Replacing-include-calls-with-included-code-1">Example: Replacing <code>include</code> calls with included code</a></h3><p>Let&#39;s say that we have some individual example files <code>file1, file2, ...</code> etc. that are <em>runnable</em> and also following the style of Literate. These files could be for example used in the test suite of your package.</p><p>We want to group them all into a single page in our documentation, but we do not want to copy paste the content of <code>file1, ...</code> for robustness: the files are included in the test suite and some changes may occur to them. We want these changes to also be reflected in the documentation.</p><p>A very easy way to do this is using <code>preprocess</code> to interchange <code>include</code> statements with file content. First, create a runnable <code>.jl</code> following the format of Literate</p><pre><code class="language-julia"># # Replace includes end</code></pre><p>which would replace every occurrence of <code>"DATEOFTODAY"</code> with the current date. We would now simply give this function to the generator, for example:</p><pre><code class="language-julia">Literate.markdown("input.jl", "outputdir"; preprocess = update_date)</code></pre><h3><a class="nav-anchor" href="#Example:-Replacing-include-calls-with-included-code-1" id="Example:-Replacing-include-calls-with-included-code-1">Example: Replacing <code>include</code> calls with included code</a></h3><p>Let's say that we have some individual example files <code>file1, file2, ...</code> etc. that are <em>runnable</em> and also following the style of Literate. These files could be for example used in the test suite of your package.</p><p>We want to group them all into a single page in our documentation, but we do not want to copy paste the content of <code>file1, ...</code> for robustness: the files are included in the test suite and some changes may occur to them. We want these changes to also be reflected in the documentation.</p><p>A very easy way to do this is using <code>preprocess</code> to interchange <code>include</code> statements with file content. First, create a runnable <code>.jl</code> following the format of Literate</p><pre><code class="language-julia"># # Replace includes
# This is an example to replace `include` calls with the actual file content. # This is an example to replace `include` calls with the actual file content.
include(&quot;file1.jl&quot;) include("file1.jl")
# Cool, we just saw the result of the above code snippet. Here is one more: # Cool, we just saw the result of the above code snippet. Here is one more:
include(&quot;file2.jl&quot;)</code></pre><p>Let&#39;s say we have saved this file as <code>examples.jl</code>. Then, you want to properly define a pre-processing function:</p><pre><code class="language-julia">function replace_includes(str) include("file2.jl")</code></pre><p>Let's say we have saved this file as <code>examples.jl</code>. Then, you want to properly define a pre-processing function:</p><pre><code class="language-julia">function replace_includes(str)
included = [&quot;file1.jl&quot;, &quot;file2.jl&quot;] included = ["file1.jl", "file2.jl"]
# Here the path loads the files from their proper directory, # Here the path loads the files from their proper directory,
# which may not be the directory of the `examples.jl` file! # which may not be the directory of the `examples.jl` file!
path = &quot;directory/to/example/files/&quot; path = "directory/to/example/files/"
for ex in included for ex in included
content = read(path*ex, String) content = read(path*ex, String)
str = replace(str, &quot;include(\&quot;$(ex)\&quot;)&quot; =&gt; content) str = replace(str, "include(\"$(ex)\")" =&gt; content)
end end
return str 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. <a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a> as</p><pre><code class="language-julia">Literate.markdown(&quot;examples.jl&quot;, &quot;path/to/save/markdown&quot;; 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. <a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a> as</p><pre><code class="language-julia">Literate.markdown("examples.jl", "path/to/save/markdown";
name = &quot;markdown_file_name&quot;, 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 example in the documentation of the Julia package <a href="https://github.com/JuliaDynamics/TimeseriesPrediction.jl"><code>TimeseriesPrediction</code></a>, see <a href="https://github.com/JuliaDynamics/DynamicalSystems.jl/blob/master/docs/src/tsprediction/stexamples.jl">here</a> and <a href="https://github.com/JuliaDynamics/DynamicalSystems.jl/blob/master/docs/make.jl#L11-L29">here for the generating script</a></p><footer><hr/><a class="previous" href="../outputformats/"><span class="direction">Previous</span><span class="title"><strong>4.</strong> Output Formats</span></a><a class="next" href="../documenter/"><span class="direction">Next</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></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 example in the documentation of the Julia package <a href="https://github.com/JuliaDynamics/TimeseriesPrediction.jl"><code>TimeseriesPrediction</code></a>, see <a href="https://github.com/JuliaDynamics/DynamicalSystems.jl/blob/master/docs/src/tsprediction/stexamples.jl">here</a> and <a href="https://github.com/JuliaDynamics/DynamicalSystems.jl/blob/master/docs/make.jl#L11-L29">here for the generating script</a></p><footer><hr/><a class="previous" href="../outputformats/"><span class="direction">Previous</span><span class="title"><strong>4.</strong> Output Formats</span></a><a class="next" href="../documenter/"><span class="direction">Next</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></HTML>

53
v1.0.5/documenter/index.html

@ -1,12 +1,53 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>6. Interaction with Documenter.jl · Literate.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 data-main="../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>6. Interaction with Documenter.jl · Literate.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"><a href="../index.html"><img class="logo" src="../assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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="../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li class="current"><a class="toctext" href><strong>6.</strong> Interaction with Documenter.jl</a><ul class="internal"></ul></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href><strong>6.</strong> Interaction with Documenter.jl</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/documenter.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>6. Interaction with Documenter.jl</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Interaction-with-Documenter-1" href="#Interaction-with-Documenter-1"><strong>6.</strong> Interaction with Documenter.jl</a></h1><p>Literate can be used for any purpose, it spits out regular markdown files, and notebooks. Typically, though, these files will be used to render documentation for your package. The generators (<a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <a href="../outputformats/#Literate.script"><code>Literate.script</code></a>) supports a keyword argument <code>documenter</code> that lets the generator perform some extra things, keeping in mind that the source code have been written with Documenter.jl in mind. So lets take a look at what will happen if we set <code>documenter = true</code>:</p><h3><a class="nav-anchor" id="[Literate.markdown](@ref):-1" href="#[Literate.markdown](@ref):-1"><a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>:</a></h3><ul><li>The default code fence will change from<pre><code class="language-none">```julia const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="../index.html"><img alt="Literate.jl logo" class="logo" src="../assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="../search/" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li class="current"><a class="toctext" href=""><strong>6.</strong> Interaction with Documenter.jl</a><ul class="internal"></ul></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href=""><strong>6.</strong> Interaction with Documenter.jl</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/documenter.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>6. Interaction with Documenter.jl</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#Interaction-with-Documenter-1" id="Interaction-with-Documenter-1"><strong>6.</strong> Interaction with Documenter.jl</a></h1><p>Literate can be used for any purpose, it spits out regular markdown files, and notebooks. Typically, though, these files will be used to render documentation for your package. The generators (<a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <a href="../outputformats/#Literate.script"><code>Literate.script</code></a>) supports a keyword argument <code>documenter</code> that lets the generator perform some extra things, keeping in mind that the source code have been written with Documenter.jl in mind. So lets take a look at what will happen if we set <code>documenter = true</code>:</p><h3><a class="nav-anchor" href="#[Literate.markdown](@ref):-1" id="[Literate.markdown](@ref):-1"></a><a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>:</h3><ul><li>The default code fence will change from<pre><code class="language-none">```julia
# code # code
```</code></pre>to Documenters <code>@example</code> blocks:<pre><code class="language-none">```@examples $(name) ```</code></pre>to Documenters <code>@example</code> blocks:<pre><code class="language-none">```@examples $(name)
# code # code
```</code></pre></li><li>The following <code>@meta</code> block will be added to the top of the markdown page, which redirects the &quot;Edit on GitHub&quot; link on the top of the page to the <em>source file</em> rather than the generated <code>.md</code> file:<pre><code class="language-none">```@meta ```</code></pre></li><li>The following <code>@meta</code> block will be added to the top of the markdown page, which redirects the "Edit on GitHub" link on the top of the page to the <em>source file</em> rather than the generated <code>.md</code> file:<pre><code class="language-none">```@meta
EditURL = &quot;$(relpath(inputfile, outputdir))&quot; EditURL = "$(relpath(inputfile, outputdir))"
```</code></pre></li></ul><h3><a class="nav-anchor" id="[Literate.notebook](@ref):-1" href="#[Literate.notebook](@ref):-1"><a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a>:</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 notebook.</li><li>Documenter style markdown math<pre><code class="language-none">```math ```</code></pre></li></ul><h3><a class="nav-anchor" href="#[Literate.notebook](@ref):-1" id="[Literate.notebook](@ref):-1"></a><a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></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 notebook.</li><li>Documenter style markdown math<pre><code class="language-none">```math
\int f dx \int f dx
```</code></pre>is replaced with notebook compatible<pre><code class="language-none">\begin{equation} ```</code></pre>is replaced with notebook compatible<pre><code class="language-none">\begin{equation}
\int f dx \int f dx
\end{equation}</code></pre></li></ul><h3><a class="nav-anchor" id="[Literate.script](@ref):-1" href="#[Literate.script](@ref):-1"><a href="../outputformats/#Literate.script"><code>Literate.script</code></a>:</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><footer><hr/><a class="previous" href="../customprocessing/"><span class="direction">Previous</span><span class="title"><strong>5.</strong> Custom pre- and post-processing</span></a><a class="next" href="../generated/example/"><span class="direction">Next</span><span class="title"><strong>7.</strong> Example</span></a></footer></article></body></html> \end{equation}</code></pre></li></ul><h3><a class="nav-anchor" href="#[Literate.script](@ref):-1" id="[Literate.script](@ref):-1"></a><a href="../outputformats/#Literate.script"><code>Literate.script</code></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><footer><hr/><a class="previous" href="../customprocessing/"><span class="direction">Previous</span><span class="title"><strong>5.</strong> Custom pre- and post-processing</span></a><a class="next" href="../generated/example/"><span class="direction">Next</span><span class="title"><strong>7.</strong> Example</span></a></footer></article></body></HTML>

49
v1.0.5/fileformat/index.html

@ -1,5 +1,46 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>2. File Format · Literate.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 data-main="../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>2. File Format · Literate.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"><a href="../index.html"><img class="logo" src="../assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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="../"><strong>1.</strong> Introduction</a></li><li class="current"><a class="toctext" href><strong>2.</strong> File Format</a><ul class="internal"><li><a class="toctext" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></li><li><a class="toctext" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</a></li><li><a class="toctext" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></li></ul></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><a class="toctext" href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href><strong>2.</strong> File Format</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/fileformat.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>2. File Format</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="**2.**-File-Format-1" href="#**2.**-File-Format-1"><strong>2.</strong> File Format</a></h1><p>The source file format for Literate is a regular, commented, julia (<code>.jl</code>) scripts. The idea is that the scripts also serve as documentation on their own and it is also simple to include them in the test-suite, with e.g. <code>include</code>, to make sure the examples stay up do date with other changes in your package.</p><h2><a class="nav-anchor" id="Syntax-1" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></h2><p>The basic syntax is simple:</p><ul><li>lines starting with <code>#</code> are treated as markdown,</li><li>all other lines are treated as julia code.</li></ul><p>Leading whitespace is allowed before <code>#</code>, but it will be removed when generating the output. Since <code>#</code>-lines is treated as markdown we can not use that for regular julia comments, for this you can instead use <code>##</code>, which will render as <code>#</code> in the output.</p><p>Lets look at a simple example:</p><pre><code class="language-julia"># # Rational numbers const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="../index.html"><img alt="Literate.jl logo" class="logo" src="../assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="../search/" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="../"><strong>1.</strong> Introduction</a></li><li class="current"><a class="toctext" href=""><strong>2.</strong> File Format</a><ul class="internal"><li><a class="toctext" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></li><li><a class="toctext" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</a></li><li><a class="toctext" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></li></ul></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><a class="toctext" href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href=""><strong>2.</strong> File Format</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/fileformat.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>2. File Format</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#**2.**-File-Format-1" id="**2.**-File-Format-1"><strong>2.</strong> File Format</a></h1><p>The source file format for Literate is a regular, commented, julia (<code>.jl</code>) scripts. The idea is that the scripts also serve as documentation on their own and it is also simple to include them in the test-suite, with e.g. <code>include</code>, to make sure the examples stay up do date with other changes in your package.</p><h2><a class="nav-anchor" href="#Syntax-1" id="Syntax-1"><strong>2.1.</strong> Syntax</a></h2><p>The basic syntax is simple:</p><ul><li>lines starting with <code>#</code> are treated as markdown,</li><li>all other lines are treated as julia code.</li></ul><p>Leading whitespace is allowed before <code>#</code>, but it will be removed when generating the output. Since <code>#</code>-lines is treated as markdown we can not use that for regular julia comments, for this you can instead use <code>##</code>, which will render as <code>#</code> in the output.</p><p>Lets look at a simple example:</p><pre><code class="language-julia"># # Rational numbers
# #
# In julia rational numbers can be constructed with the `//` operator. # In julia rational numbers can be constructed with the `//` operator.
# Lets define two rational numbers, `x` and `y`: # Lets define two rational numbers, `x` and `y`:
@ -9,9 +50,9 @@ y = 2//5
# When adding `x` and `y` together we obtain a new rational number: # When adding `x` and `y` together we obtain a new rational number:
z = x + y</code></pre><p>In the lines starting with <code>#</code> we can use regular markdown syntax, for example the <code>#</code> used for the heading and the backticks for formatting code. The other lines are regular julia code. We note a couple of things:</p><ul><li>The script is valid julia, which means that we can <code>include</code> it and the example will run (for example in the <code>test/runtests.jl</code> script, to include the example in the test suite).</li><li>The script is &quot;self-explanatory&quot;, i.e. the markdown lines works as comments and thus serve as good documentation on its own.</li></ul><p>For simple use this is all you need to know. The following additional special syntax can also be used:</p><ul><li><code>#md</code>, <code>#nb</code>, <code>#jl</code>, <code>#src</code>: tags to filter lines, see <a href="#Filtering-Lines-1">Filtering Lines</a>,</li><li><code>#-</code>: tag to manually control chunk-splits, see <a href="../pipeline/#Custom-control-over-chunk-splits-1">Custom control over chunk splits</a>.</li></ul><p>There is also some default convenience replacements that will always be performed, see <a href="#Default-Replacements-1">Default Replacements</a>.</p><h2><a class="nav-anchor" id="Filtering-Lines-1" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</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 &quot;tokens&quot; 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> with one of these tokens are filtered out in the <a href="../pipeline/#Pre-processing-1">preprocessing step</a>.</p><p>Suppose, for example, that we want to include a docstring within a <code>@docs</code> block using Documenter. Obviously we don&#39;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><code class="language-julia">#md # ```@docs z = x + y</code></pre><p>In the lines starting with <code>#</code> we can use regular markdown syntax, for example the <code>#</code> used for the heading and the backticks for formatting code. The other lines are regular julia code. We note a couple of things:</p><ul><li>The script is valid julia, which means that we can <code>include</code> it and the example will run (for example in the <code>test/runtests.jl</code> script, to include the example in the test suite).</li><li>The script is "self-explanatory", i.e. the markdown lines works as comments and thus serve as good documentation on its own.</li></ul><p>For simple use this is all you need to know. The following additional special syntax can also be used:</p><ul><li><code>#md</code>, <code>#nb</code>, <code>#jl</code>, <code>#src</code>: tags to filter lines, see <a href="#Filtering-Lines-1">Filtering Lines</a>,</li><li><code>#-</code>: tag to manually control chunk-splits, see <a href="../pipeline/#Custom-control-over-chunk-splits-1">Custom control over chunk splits</a>.</li></ul><p>There is also some default convenience replacements that will always be performed, see <a href="#Default-Replacements-1">Default Replacements</a>.</p><h2><a class="nav-anchor" href="#Filtering-Lines-1" id="Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</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> with one of these tokens are filtered out in the <a href="../pipeline/#Pre-processing-1">preprocessing step</a>.</p><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><code class="language-julia">#md # ```@docs
#md # Literate.markdown #md # Literate.markdown
#md # Literate.notebook #md # Literate.notebook
#md # Literate.markdown #md # Literate.markdown
#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 simple 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><code class="language-julia">using Test #src #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 simple 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><code class="language-julia">using Test #src
@test result == expected_result #src</code></pre><h2><a class="nav-anchor" id="Default-Replacements-1" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></h2><p>The following convenience &quot;macros&quot; are always expanded:</p><ul><li><p><code>@__NAME__</code></p><p>expands to the <code>name</code> keyword argument to <a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <a href="../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>expands to <code>https://github.com/$(ENV[&quot;TRAVIS_REPO_SLUG&quot;])/blob/master/</code> and is a convenient way to use when you want to link to files outside the doc-build directory. For example <code>@__REPO__ROOT_URL__src/Literate.jl</code> would link to the source of the Literate module.</p></li><li><p><code>@__NBVIEWER_ROOT_URL__</code></p><p>expands to <code>https://nbviewer.jupyter.org/github/$(ENV[&quot;TRAVIS_REPO_SLUG&quot;])/blob/gh-pages/$(folder)/</code> where <code>folder</code> is the folder that <code>Documenter.deploydocs</code> deploys too. This can be used if you want a link that opens the generated notebook in <a href="http://nbviewer.jupyter.org/">http://nbviewer.jupyter.org/</a>.</p></li></ul><footer><hr/><a class="previous" href="../"><span class="direction">Previous</span><span class="title"><strong>1.</strong> Introduction</span></a><a class="next" href="../pipeline/"><span class="direction">Next</span><span class="title"><strong>3.</strong> Processing pipeline</span></a></footer></article></body></html> @test result == expected_result #src</code></pre><h2><a class="nav-anchor" href="#Default-Replacements-1" id="Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></h2><p>The following convenience "macros" are always expanded:</p><ul><li><p><code>@__NAME__</code></p><p>expands to the <code>name</code> keyword argument to <a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <a href="../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>expands to <code>https://github.com/$(ENV["TRAVIS_REPO_SLUG"])/blob/master/</code> and is a convenient way to use when you want to link to files outside the doc-build directory. For example <code>@__REPO__ROOT_URL__src/Literate.jl</code> would link to the source of the Literate module.</p></li><li><p><code>@__NBVIEWER_ROOT_URL__</code></p><p>expands to <code>https://nbviewer.jupyter.org/github/$(ENV["TRAVIS_REPO_SLUG"])/blob/gh-pages/$(folder)/</code> where <code>folder</code> is the folder that <code>Documenter.deploydocs</code> deploys too. This can be used if you want a link that opens the generated notebook in <a href="http://nbviewer.jupyter.org/">http://nbviewer.jupyter.org/</a>.</p></li></ul><footer><hr/><a class="previous" href="../"><span class="direction">Previous</span><span class="title"><strong>1.</strong> Introduction</span></a><a class="next" href="../pipeline/"><span class="direction">Next</span><span class="title"><strong>3.</strong> Processing pipeline</span></a></footer></article></body></HTML>

193
v1.0.5/generated/example/index.html

@ -1,7 +1,48 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>7. Example · Literate.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 data-main="../../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../../siteinfo.js"></script><script src="../../../versions.js"></script><link href="../../assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>7. Example · Literate.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"><a href="../../index.html"><img class="logo" src="../../assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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="../../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><a class="toctext" href="../../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li class="current"><a class="toctext" href><strong>7.</strong> Example</a><ul class="internal"></ul></li></ul></nav><article id="docs"><header><nav><ul><li><a href><strong>7.</strong> Example</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>7. Example</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="**7.**-Example-1" href="#**7.**-Example-1"><strong>7.</strong> Example</a></h1><p>This is an example generated with Literate based on this source file: <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><code>example.jl</code></a>. You are seeing the html-output which Documenter have generated based on a markdown file generated with Literate. The corresponding notebook can be found here: <a href="https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v1.0.5/generated/example.ipynb"><code>example.ipynb</code></a>, and the plain script output can be found here: <a href="../example.jl"><code>example.jl</code></a>.</p><p>It is recommended to have the <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl">source file</a> available when reading this, to better understand how the syntax in the source file corresponds to the output you are seeing.</p><h3><a class="nav-anchor" id="Basic-syntax-1" href="#Basic-syntax-1">Basic syntax</a></h3><p>The basic syntax for Literate is simple, lines starting with <code>#</code> is interpreted as markdown, and all the other lines are interpreted as code. Here is some code:</p><div><pre><code class="language-julia">x = 1//3 const head = document.getElementsByTagName('head')[0];
y = 2//5</code></pre><pre><code class="language-none">2//5</code></pre></div><p>In markdown sections we can use markdown syntax. For example, we can write <em>text in italic font</em>, <strong>text in bold font</strong> and use <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">links</a>.</p><p>It is possible to filter out lines depending on the output using the <code>#md</code>, <code>#nb</code>, <code>#jl</code> and <code>#src</code> tags (see <a href="../../fileformat/#Filtering-Lines-1">Filtering Lines</a>):</p><ul><li>This line starts with <code>#md</code> and is thus only visible in the markdown output.</li></ul><p>The source file is parsed in chunks of markdown and code. Starting a line with <code>#-</code> manually inserts a chunk break. For example, if we want to display the output of the following operations we may insert <code>#-</code> in between. These two code blocks will now end up in different <code>@example</code>-blocks in the markdown output, and two different notebook cells in the notebook output.</p><div><pre><code class="language-julia">x + y</code></pre><pre><code class="language-none">11//15</code></pre></div><div><pre><code class="language-julia">x * y</code></pre><pre><code class="language-none">2//15</code></pre></div><h3><a class="nav-anchor" id="Output-Capturing-1" href="#Output-Capturing-1">Output Capturing</a></h3><p>Code chunks are by default placed in Documenter <code>@example</code> blocks in the generated markdown. This means that the output will be captured in a block when Documenter is building the docs. In notebooks the output is captured in output cells, if the <code>execute</code> keyword argument is set to true. Output to <code>stdout</code>/<code>stderr</code> is also captured.</p><div><pre><code class="language-julia">function foo()
println(&quot;This string is printed to stdout.&quot;) // Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="../../index.html"><img alt="Literate.jl logo" class="logo" src="../../assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="../../search/" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="../../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><a class="toctext" href="../../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li class="current"><a class="toctext" href=""><strong>7.</strong> Example</a><ul class="internal"></ul></li></ul></nav><article id="docs"><header><nav><ul><li><a href=""><strong>7.</strong> Example</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>7. Example</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#**7.**-Example-1" id="**7.**-Example-1"><strong>7.</strong> Example</a></h1><p>This is an example generated with Literate based on this source file: <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><code>example.jl</code></a>. You are seeing the html-output which Documenter have generated based on a markdown file generated with Literate. The corresponding notebook can be found here: <a href="https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v1.0.5/generated/example.ipynb"><code>example.ipynb</code></a>, and the plain script output can be found here: <a href="../example.jl"><code>example.jl</code></a>.</p><p>It is recommended to have the <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl">source file</a> available when reading this, to better understand how the syntax in the source file corresponds to the output you are seeing.</p><h3><a class="nav-anchor" href="#Basic-syntax-1" id="Basic-syntax-1">Basic syntax</a></h3><p>The basic syntax for Literate is simple, lines starting with <code>#</code> is interpreted as markdown, and all the other lines are interpreted as code. Here is some code:</p><div><pre><code class="language-julia">x = 1//3
y = 2//5</code></pre><pre><code class="language-none">2//5</code></pre></div><p>In markdown sections we can use markdown syntax. For example, we can write <em>text in italic font</em>, <strong>text in bold font</strong> and use <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">links</a>.</p><p>It is possible to filter out lines depending on the output using the <code>#md</code>, <code>#nb</code>, <code>#jl</code> and <code>#src</code> tags (see <a href="../../fileformat/#Filtering-Lines-1">Filtering Lines</a>):</p><ul><li>This line starts with <code>#md</code> and is thus only visible in the markdown output.</li></ul><p>The source file is parsed in chunks of markdown and code. Starting a line with <code>#-</code> manually inserts a chunk break. For example, if we want to display the output of the following operations we may insert <code>#-</code> in between. These two code blocks will now end up in different <code>@example</code>-blocks in the markdown output, and two different notebook cells in the notebook output.</p><div><pre><code class="language-julia">x + y</code></pre><pre><code class="language-none">11//15</code></pre></div><div><pre><code class="language-julia">x * y</code></pre><pre><code class="language-none">2//15</code></pre></div><h3><a class="nav-anchor" href="#Output-Capturing-1" id="Output-Capturing-1">Output Capturing</a></h3><p>Code chunks are by default placed in Documenter <code>@example</code> blocks in the generated markdown. This means that the output will be captured in a block when Documenter is building the docs. In notebooks the output is captured in output cells, if the <code>execute</code> keyword argument is set to true. Output to <code>stdout</code>/<code>stderr</code> is also captured.</p><div><pre><code class="language-julia">function foo()
println("This string is printed to stdout.")
return [1, 2, 3, 4] return [1, 2, 3, 4]
end end
@ -10,126 +51,55 @@ foo()</code></pre><pre><code class="language-none">This string is printed to std
1 1
2 2
3 3
4</code></pre></div><p>Both Documenter&#39;s <code>@example</code> block and notebooks can display images. Here is an example where we generate a simple plot using the <a href="https://github.com/JuliaPlots/Plots.jl">Plots.jl</a> package</p><div><pre><code class="language-julia">using Plots 4</code></pre></div><p>Both Documenter's <code>@example</code> block and notebooks can display images. Here is an example where we generate a simple plot using the <a href="https://github.com/JuliaPlots/Plots.jl">Plots.jl</a> package</p><div><pre><code class="language-julia">using Plots
x = range(0, stop=6π, length=1000) x = range(0, stop=6π, length=1000)
y1 = sin.(x) y1 = sin.(x)
y2 = cos.(x) y2 = cos.(x)
plot(x, [y1, y2])</code></pre><?xml version="1.0" encoding="utf-8"?> plot(x, [y1, y2])</code></pre><svg height="400" viewBox="0 0 2400 1600" width="600" xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"><defs><clipPath id="clip7300"><rect height="2000" width="2000" x="0" y="0"></rect></clipPath></defs><defs><clipPath id="clip7301"><rect height="1600" width="2400" x="0" y="0"></rect></clipPath></defs><polygon clip-path="url(#clip7301)" fill="#ffffff" fill-opacity="1" fill-rule="evenodd" points="
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="600" height="400" viewBox="0 0 2400 1600">
<defs>
<clipPath id="clip7300">
<rect x="0" y="0" width="2000" height="2000"/>
</clipPath>
</defs>
<defs>
<clipPath id="clip7301">
<rect x="0" y="0" width="2400" height="1600"/>
</clipPath>
</defs>
<polygon clip-path="url(#clip7301)" points="
0,1600 2400,1600 2400,0 0,0 0,1600 2400,1600 2400,0 0,0
" fill="#ffffff" fill-rule="evenodd" fill-opacity="1"/> "></polygon><defs><clipPath id="clip7302"><rect height="1600" width="1681" x="480" y="0"></rect></clipPath></defs><polygon clip-path="url(#clip7301)" fill="#ffffff" fill-opacity="1" fill-rule="evenodd" points="
<defs>
<clipPath id="clip7302">
<rect x="480" y="0" width="1681" height="1600"/>
</clipPath>
</defs>
<polygon clip-path="url(#clip7301)" points="
94.4882,1537.01 2321.26,1537.01 2321.26,47.2441 94.4882,47.2441 94.4882,1537.01 2321.26,1537.01 2321.26,47.2441 94.4882,47.2441
" fill="#ffffff" fill-rule="evenodd" fill-opacity="1"/> "></polygon><defs><clipPath id="clip7303"><rect height="1491" width="2228" x="94" y="47"></rect></clipPath></defs><polyline clip-path="url(#clip7303)" points="
<defs>
<clipPath id="clip7303">
<rect x="94" y="47" width="2228" height="1491"/>
</clipPath>
</defs>
<polyline clip-path="url(#clip7303)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
157.51,1537.01 157.51,47.2441 157.51,1537.01 157.51,47.2441
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip7303)" points="
<polyline clip-path="url(#clip7303)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
714.745,1537.01 714.745,47.2441 714.745,1537.01 714.745,47.2441
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip7303)" points="
<polyline clip-path="url(#clip7303)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
1271.98,1537.01 1271.98,47.2441 1271.98,1537.01 1271.98,47.2441
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip7303)" points="
<polyline clip-path="url(#clip7303)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
1829.22,1537.01 1829.22,47.2441 1829.22,1537.01 1829.22,47.2441
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip7303)" points="
<polyline clip-path="url(#clip7303)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
94.4882,1494.85 2321.26,1494.85 94.4882,1494.85 2321.26,1494.85
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip7303)" points="
<polyline clip-path="url(#clip7303)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
94.4882,1143.49 2321.26,1143.49 94.4882,1143.49 2321.26,1143.49
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip7303)" points="
<polyline clip-path="url(#clip7303)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
94.4882,792.13 2321.26,792.13 94.4882,792.13 2321.26,792.13
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip7303)" points="
<polyline clip-path="url(#clip7303)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
94.4882,440.769 2321.26,440.769 94.4882,440.769 2321.26,440.769
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip7303)" points="
<polyline clip-path="url(#clip7303)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
94.4882,89.4072 2321.26,89.4072 94.4882,89.4072 2321.26,89.4072
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip7301)" points="
<polyline clip-path="url(#clip7301)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
94.4882,1537.01 2321.26,1537.01 94.4882,1537.01 2321.26,1537.01
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7301)" points="
<polyline clip-path="url(#clip7301)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
94.4882,1537.01 94.4882,47.2441 94.4882,1537.01 94.4882,47.2441
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7301)" points="
<polyline clip-path="url(#clip7301)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
157.51,1537.01 157.51,1514.66 157.51,1537.01 157.51,1514.66
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7301)" points="
<polyline clip-path="url(#clip7301)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
714.745,1537.01 714.745,1514.66 714.745,1537.01 714.745,1514.66
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7301)" points="
<polyline clip-path="url(#clip7301)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
1271.98,1537.01 1271.98,1514.66 1271.98,1537.01 1271.98,1514.66
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7301)" points="
<polyline clip-path="url(#clip7301)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
1829.22,1537.01 1829.22,1514.66 1829.22,1537.01 1829.22,1514.66
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7301)" points="
<polyline clip-path="url(#clip7301)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
94.4882,1494.85 127.89,1494.85 94.4882,1494.85 127.89,1494.85
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7301)" points="
<polyline clip-path="url(#clip7301)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
94.4882,1143.49 127.89,1143.49 94.4882,1143.49 127.89,1143.49
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7301)" points="
<polyline clip-path="url(#clip7301)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
94.4882,792.13 127.89,792.13 94.4882,792.13 127.89,792.13
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7301)" points="
<polyline clip-path="url(#clip7301)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
94.4882,440.769 127.89,440.769 94.4882,440.769 127.89,440.769
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7301)" points="
<polyline clip-path="url(#clip7301)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
94.4882,89.4072 127.89,89.4072 94.4882,89.4072 127.89,89.4072
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><g clip-path="url(#clip7301)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 157.51, 1591.01)" x="157.51" y="1591.01">0</text></g><g clip-path="url(#clip7301)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 714.745, 1591.01)" x="714.745" y="1591.01">5</text></g><g clip-path="url(#clip7301)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 1271.98, 1591.01)" x="1271.98" y="1591.01">10</text></g><g clip-path="url(#clip7301)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 1829.22, 1591.01)" x="1829.22" y="1591.01">15</text></g><g clip-path="url(#clip7301)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 1512.35)" x="70.4882" y="1512.35">-1.0</text></g><g clip-path="url(#clip7301)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 1160.99)" x="70.4882" y="1160.99">-0.5</text></g><g clip-path="url(#clip7301)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 809.63)" x="70.4882" y="809.63">0.0</text></g><g clip-path="url(#clip7301)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 458.269)" x="70.4882" y="458.269">0.5</text></g><g clip-path="url(#clip7301)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 106.907)" x="70.4882" y="106.907">1.0</text></g><polyline clip-path="url(#clip7303)" points="
<g clip-path="url(#clip7301)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 157.51, 1591.01)" x="157.51" y="1591.01">0</text>
</g>
<g clip-path="url(#clip7301)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 714.745, 1591.01)" x="714.745" y="1591.01">5</text>
</g>
<g clip-path="url(#clip7301)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 1271.98, 1591.01)" x="1271.98" y="1591.01">10</text>
</g>
<g clip-path="url(#clip7301)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 1829.22, 1591.01)" x="1829.22" y="1591.01">15</text>
</g>
<g clip-path="url(#clip7301)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 1512.35)" x="70.4882" y="1512.35">-1.0</text>
</g>
<g clip-path="url(#clip7301)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 1160.99)" x="70.4882" y="1160.99">-0.5</text>
</g>
<g clip-path="url(#clip7301)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 809.63)" x="70.4882" y="809.63">0.0</text>
</g>
<g clip-path="url(#clip7301)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 458.269)" x="70.4882" y="458.269">0.5</text>
</g>
<g clip-path="url(#clip7301)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 106.907)" x="70.4882" y="106.907">1.0</text>
</g>
<polyline clip-path="url(#clip7303)" style="stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none" points="
157.51,792.13 159.613,778.871 161.716,765.618 163.819,752.373 165.921,739.143 168.024,725.932 170.127,712.744 172.23,699.585 174.333,686.458 176.436,673.369 157.51,792.13 159.613,778.871 161.716,765.618 163.819,752.373 165.921,739.143 168.024,725.932 170.127,712.744 172.23,699.585 174.333,686.458 176.436,673.369
178.538,660.323 180.641,647.323 182.744,634.375 184.847,621.483 186.95,608.651 189.052,595.886 191.155,583.189 193.258,570.568 195.361,558.025 197.464,545.566 178.538,660.323 180.641,647.323 182.744,634.375 184.847,621.483 186.95,608.651 189.052,595.886 191.155,583.189 193.258,570.568 195.361,558.025 197.464,545.566
199.567,533.194 201.669,520.914 203.772,508.731 205.875,496.649 207.978,484.673 210.081,472.805 212.184,461.051 214.286,449.416 216.389,437.902 218.492,426.514 199.567,533.194 201.669,520.914 203.772,508.731 205.875,496.649 207.978,484.673 210.081,472.805 212.184,461.051 214.286,449.416 216.389,437.902 218.492,426.514
@ -231,8 +201,7 @@ plot(x, [y1, y2])</code></pre><?xml version="1.0" encoding="utf-8"?>
2218.28,1038.69 2220.39,1026.23 2222.49,1013.69 2224.59,1001.07 2226.7,988.374 2228.8,975.608 2230.9,962.777 2233,949.885 2235.11,936.937 2237.21,923.937 2218.28,1038.69 2220.39,1026.23 2222.49,1013.69 2224.59,1001.07 2226.7,988.374 2228.8,975.608 2230.9,962.777 2233,949.885 2235.11,936.937 2237.21,923.937
2239.31,910.891 2241.42,897.802 2243.52,884.675 2245.62,871.516 2247.72,858.328 2249.83,845.117 2251.93,831.886 2254.03,818.642 2256.14,805.388 2258.24,792.13 2239.31,910.891 2241.42,897.802 2243.52,884.675 2245.62,871.516 2247.72,858.328 2249.83,845.117 2251.93,831.886 2254.03,818.642 2256.14,805.388 2258.24,792.13
"/> " style="stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7303)" points="
<polyline clip-path="url(#clip7303)" style="stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none" points="
157.51,89.4072 159.613,89.5323 161.716,89.9075 163.819,90.5327 165.921,91.4077 168.024,92.5322 170.127,93.9057 172.23,95.5278 174.333,97.3978 176.436,99.5152 157.51,89.4072 159.613,89.5323 161.716,89.9075 163.819,90.5327 165.921,91.4077 168.024,92.5322 170.127,93.9057 172.23,95.5278 174.333,97.3978 176.436,99.5152
178.538,101.879 180.641,104.489 182.744,107.343 184.847,110.442 186.95,113.783 189.052,117.365 191.155,121.188 193.258,125.25 195.361,129.549 197.464,134.083 178.538,101.879 180.641,104.489 182.744,107.343 184.847,110.442 186.95,113.783 189.052,117.365 191.155,121.188 193.258,125.25 195.361,129.549 197.464,134.083
199.567,138.853 201.669,143.854 203.772,149.087 205.875,154.548 207.978,160.237 210.081,166.15 212.184,172.286 214.286,178.643 216.389,185.218 218.492,192.01 199.567,138.853 201.669,143.854 203.772,149.087 205.875,154.548 207.978,160.237 210.081,166.15 212.184,172.286 214.286,178.643 216.389,185.218 218.492,192.01
@ -334,24 +303,12 @@ plot(x, [y1, y2])</code></pre><?xml version="1.0" encoding="utf-8"?>
2218.28,134.083 2220.39,129.549 2222.49,125.25 2224.59,121.188 2226.7,117.365 2228.8,113.783 2230.9,110.442 2233,107.343 2235.11,104.489 2237.21,101.879 2218.28,134.083 2220.39,129.549 2222.49,125.25 2224.59,121.188 2226.7,117.365 2228.8,113.783 2230.9,110.442 2233,107.343 2235.11,104.489 2237.21,101.879
2239.31,99.5152 2241.42,97.3978 2243.52,95.5278 2245.62,93.9057 2247.72,92.5322 2249.83,91.4077 2251.93,90.5327 2254.03,89.9075 2256.14,89.5323 2258.24,89.4072 2239.31,99.5152 2241.42,97.3978 2243.52,95.5278 2245.62,93.9057 2247.72,92.5322 2249.83,91.4077 2251.93,90.5327 2254.03,89.9075 2256.14,89.5323 2258.24,89.4072
"/> " style="stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polygon clip-path="url(#clip7301)" fill="#ffffff" fill-opacity="1" fill-rule="evenodd" points="
<polygon clip-path="url(#clip7301)" points="
1958.43,312.204 2249.26,312.204 2249.26,130.764 1958.43,130.764 1958.43,312.204 2249.26,312.204 2249.26,130.764 1958.43,130.764
" fill="#ffffff" fill-rule="evenodd" fill-opacity="1"/> "></polygon><polyline clip-path="url(#clip7301)" points="
<polyline clip-path="url(#clip7301)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
1958.43,312.204 2249.26,312.204 2249.26,130.764 1958.43,130.764 1958.43,312.204 1958.43,312.204 2249.26,312.204 2249.26,130.764 1958.43,130.764 1958.43,312.204
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip7301)" points="
<polyline clip-path="url(#clip7301)" style="stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none" points="
1982.43,191.244 2126.43,191.244 1982.43,191.244 2126.43,191.244
"/> " style="stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none"></polyline><g clip-path="url(#clip7301)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;" transform="rotate(0, 2150.43, 208.744)" x="2150.43" y="208.744">y1</text></g><polyline clip-path="url(#clip7301)" points="
<g clip-path="url(#clip7301)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;" transform="rotate(0, 2150.43, 208.744)" x="2150.43" y="208.744">y1</text>
</g>
<polyline clip-path="url(#clip7301)" style="stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none" points="
1982.43,251.724 2126.43,251.724 1982.43,251.724 2126.43,251.724
"/> " style="stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none"></polyline><g clip-path="url(#clip7301)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;" transform="rotate(0, 2150.43, 269.224)" x="2150.43" y="269.224">y2</text></g></svg></div><h3><a class="nav-anchor" href="#Custom-processing-1" id="Custom-processing-1">Custom processing</a></h3><p>It is possible to give Literate custom pre- and post-processing functions. For example, here we insert two placeholders, which we will replace with something else at time of generation. We have here replaced our placeholders with <code>z</code> and <code>1.0 + 2.0im</code>:</p><div><pre><code class="language-julia">z = 1.0 + 2.0im</code></pre><pre><code class="language-none">1.0 + 2.0im</code></pre></div><h3><a class="nav-anchor" href="#documenter-interaction-1" id="documenter-interaction-1">Documenter.jl interaction</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, <a href="#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><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p><footer><hr/><a class="previous" href="../../documenter/"><span class="direction">Previous</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></HTML>
<g clip-path="url(#clip7301)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;" transform="rotate(0, 2150.43, 269.224)" x="2150.43" y="269.224">y2</text>
</g>
</svg>
</div><h3><a class="nav-anchor" id="Custom-processing-1" href="#Custom-processing-1">Custom processing</a></h3><p>It is possible to give Literate custom pre- and post-processing functions. For example, here we insert two placeholders, which we will replace with something else at time of generation. We have here replaced our placeholders with <code>z</code> and <code>1.0 + 2.0im</code>:</p><div><pre><code class="language-julia">z = 1.0 + 2.0im</code></pre><pre><code class="language-none">1.0 + 2.0im</code></pre></div><h3><a class="nav-anchor" id="documenter-interaction-1" href="#documenter-interaction-1">Documenter.jl interaction</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, <a href="#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><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p><footer><hr/><a class="previous" href="../../documenter/"><span class="direction">Previous</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></html>

45
v1.0.5/index.html

File diff suppressed because one or more lines are too long

53
v1.0.5/outputformats/index.html

File diff suppressed because one or more lines are too long

51
v1.0.5/pipeline/index.html

File diff suppressed because one or more lines are too long

45
v1.0.5/search/index.html

@ -1,2 +1,43 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>Search · Literate.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 data-main="../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Search · Literate.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"><a href="../index.html"><img class="logo" src="../assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.jl</h1><select id="version-selector" onChange="window.location.href=this.value" style="visibility: hidden"></select><form class="search" id="search-form" action><input id="search-query" name="q" type="text" placeholder="Search docs"/></form><ul><li><a class="toctext" href="../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><a class="toctext" href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article><header><nav><ul><li>Search</li></ul></nav><hr/><div id="topbar"><span>Search</span><a class="fa fa-bars" href="#"></a></div></header><h1>Search</h1><p id="search-info">Number of results: <span id="search-results-number">loading...</span></p><ul id="search-results"></ul></article></body><script src="../search_index.js"></script><script src="../assets/search.js"></script></html> const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="../index.html"><img alt="Literate.jl logo" class="logo" src="../assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><a class="toctext" href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article><header><nav><ul><li>Search</li></ul></nav><hr/><div id="topbar"><span>Search</span><a class="fa fa-bars" href="#"></a></div></header><h1>Search</h1><p id="search-info">Number of results: <span id="search-results-number">loading...</span></p><ul id="search-results"></ul></article><script src="../search_index.js"></script><script src="../assets/search.js"></script></body></HTML>

63
v1.1.0/customprocessing/index.html

@ -1,29 +1,70 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>5. Custom pre- and post-processing · Literate.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 data-main="../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>5. Custom pre- and post-processing · Literate.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"><a href="../index.html"><img class="logo" src="../assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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="../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li class="current"><a class="toctext" href><strong>5.</strong> Custom pre- and post-processing</a><ul class="internal"></ul></li><li><a class="toctext" href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href><strong>5.</strong> Custom pre- and post-processing</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/customprocessing.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>5. Custom pre- and post-processing</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Custom-pre-and-post-processing-1" href="#Custom-pre-and-post-processing-1"><strong>5.</strong> Custom pre- and post-processing</a></h1><p>Since all packages are different, and may have different demands on how to create a nice example for the documentation it is important that the package maintainer does not feel limited by the by default provided syntax that this package offers. While you can generally come a long way by utilizing <a href="../fileformat/#Filtering-Lines-1">line filtering</a> there might be situations where you need to manually hook into the generation and change things. In Literate this is done by letting the user supply custom pre- and post-processing functions that may do transformation of the content.</p><p>All of the generators (<a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <a href="../outputformats/#Literate.script"><code>Literate.script</code></a>) accepts <code>preprocess</code> and <code>postprocess</code> keyword arguments. The default &quot;transformation&quot; is the <code>identity</code> function. The input to the transformation functions is a <code>String</code>, and the output should be the transformed <code>String</code>.</p><p><code>preprocess</code> is sent the raw input that is read from the source file (<a href="../pipeline/#Pre-processing-1">modulo the default line ending transformation</a>). <code>postprocess</code> is given different things depending on the output: For markdown and script output <code>postprocess</code> is given the content <code>String</code> just before writing it to the output file, but for notebook output <code>postprocess</code> is given the dictionary representing the notebook, since, in general, this is more useful.</p><h3><a class="nav-anchor" id="Example:-Adding-current-date-1" href="#Example:-Adding-current-date-1">Example: Adding current date</a></h3><p>As an example, lets say we want to splice the date of generation into the output. We could of course update our source file before generating the docs, but we could instead use a <code>preprocess</code> function that splices the date into the source for us. Consider the following source file:</p><pre><code class="language-julia"># # Example const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="../index.html"><img alt="Literate.jl logo" class="logo" src="../assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="../search/" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li class="current"><a class="toctext" href=""><strong>5.</strong> Custom pre- and post-processing</a><ul class="internal"></ul></li><li><a class="toctext" href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href=""><strong>5.</strong> Custom pre- and post-processing</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/customprocessing.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>5. Custom pre- and post-processing</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#Custom-pre-and-post-processing-1" id="Custom-pre-and-post-processing-1"><strong>5.</strong> Custom pre- and post-processing</a></h1><p>Since all packages are different, and may have different demands on how to create a nice example for the documentation it is important that the package maintainer does not feel limited by the by default provided syntax that this package offers. While you can generally come a long way by utilizing <a href="../fileformat/#Filtering-Lines-1">line filtering</a> there might be situations where you need to manually hook into the generation and change things. In Literate this is done by letting the user supply custom pre- and post-processing functions that may do transformation of the content.</p><p>All of the generators (<a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <a href="../outputformats/#Literate.script"><code>Literate.script</code></a>) accepts <code>preprocess</code> and <code>postprocess</code> keyword arguments. The default "transformation" is the <code>identity</code> function. The input to the transformation functions is a <code>String</code>, and the output should be the transformed <code>String</code>.</p><p><code>preprocess</code> is sent the raw input that is read from the source file (<a href="../pipeline/#Pre-processing-1">modulo the default line ending transformation</a>). <code>postprocess</code> is given different things depending on the output: For markdown and script output <code>postprocess</code> is given the content <code>String</code> just before writing it to the output file, but for notebook output <code>postprocess</code> is given the dictionary representing the notebook, since, in general, this is more useful.</p><h3><a class="nav-anchor" href="#Example:-Adding-current-date-1" id="Example:-Adding-current-date-1">Example: Adding current date</a></h3><p>As an example, lets say we want to splice the date of generation into the output. We could of course update our source file before generating the docs, but we could instead use a <code>preprocess</code> function that splices the date into the source for us. Consider the following source file:</p><pre><code class="language-julia"># # Example
# This example was generated DATEOFTODAY # This example was generated DATEOFTODAY
x = 1 // 3</code></pre><p>where <code>DATEOFTODAY</code> is a placeholder, to make it easier for our <code>preprocess</code> function to find the location. Now, lets define the <code>preprocess</code> function, for example</p><pre><code class="language-julia">function update_date(content) x = 1 // 3</code></pre><p>where <code>DATEOFTODAY</code> is a placeholder, to make it easier for our <code>preprocess</code> function to find the location. Now, lets define the <code>preprocess</code> function, for example</p><pre><code class="language-julia">function update_date(content)
content = replace(content, &quot;DATEOFTODAY&quot; =&gt; Date(now())) content = replace(content, "DATEOFTODAY" =&gt; Date(now()))
return content return content
end</code></pre><p>which would replace every occurrence of <code>&quot;DATEOFTODAY&quot;</code> with the current date. We would now simply give this function to the generator, for example:</p><pre><code class="language-julia">Literate.markdown(&quot;input.jl&quot;, &quot;outputdir&quot;; preprocess = update_date)</code></pre><h3><a class="nav-anchor" id="Example:-Replacing-include-calls-with-included-code-1" href="#Example:-Replacing-include-calls-with-included-code-1">Example: Replacing <code>include</code> calls with included code</a></h3><p>Let&#39;s say that we have some individual example files <code>file1, file2, ...</code> etc. that are <em>runnable</em> and also following the style of Literate. These files could be for example used in the test suite of your package.</p><p>We want to group them all into a single page in our documentation, but we do not want to copy paste the content of <code>file1, ...</code> for robustness: the files are included in the test suite and some changes may occur to them. We want these changes to also be reflected in the documentation.</p><p>A very easy way to do this is using <code>preprocess</code> to interchange <code>include</code> statements with file content. First, create a runnable <code>.jl</code> following the format of Literate</p><pre><code class="language-julia"># # Replace includes end</code></pre><p>which would replace every occurrence of <code>"DATEOFTODAY"</code> with the current date. We would now simply give this function to the generator, for example:</p><pre><code class="language-julia">Literate.markdown("input.jl", "outputdir"; preprocess = update_date)</code></pre><h3><a class="nav-anchor" href="#Example:-Replacing-include-calls-with-included-code-1" id="Example:-Replacing-include-calls-with-included-code-1">Example: Replacing <code>include</code> calls with included code</a></h3><p>Let's say that we have some individual example files <code>file1, file2, ...</code> etc. that are <em>runnable</em> and also following the style of Literate. These files could be for example used in the test suite of your package.</p><p>We want to group them all into a single page in our documentation, but we do not want to copy paste the content of <code>file1, ...</code> for robustness: the files are included in the test suite and some changes may occur to them. We want these changes to also be reflected in the documentation.</p><p>A very easy way to do this is using <code>preprocess</code> to interchange <code>include</code> statements with file content. First, create a runnable <code>.jl</code> following the format of Literate</p><pre><code class="language-julia"># # Replace includes
# This is an example to replace `include` calls with the actual file content. # This is an example to replace `include` calls with the actual file content.
include(&quot;file1.jl&quot;) include("file1.jl")
# Cool, we just saw the result of the above code snippet. Here is one more: # Cool, we just saw the result of the above code snippet. Here is one more:
include(&quot;file2.jl&quot;)</code></pre><p>Let&#39;s say we have saved this file as <code>examples.jl</code>. Then, you want to properly define a pre-processing function:</p><pre><code class="language-julia">function replace_includes(str) include("file2.jl")</code></pre><p>Let's say we have saved this file as <code>examples.jl</code>. Then, you want to properly define a pre-processing function:</p><pre><code class="language-julia">function replace_includes(str)
included = [&quot;file1.jl&quot;, &quot;file2.jl&quot;] included = ["file1.jl", "file2.jl"]
# Here the path loads the files from their proper directory, # Here the path loads the files from their proper directory,
# which may not be the directory of the `examples.jl` file! # which may not be the directory of the `examples.jl` file!
path = &quot;directory/to/example/files/&quot; path = "directory/to/example/files/"
for ex in included for ex in included
content = read(path*ex, String) content = read(path*ex, String)
str = replace(str, &quot;include(\&quot;$(ex)\&quot;)&quot; =&gt; content) str = replace(str, "include(\"$(ex)\")" =&gt; content)
end end
return str 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. <a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a> as</p><pre><code class="language-julia">Literate.markdown(&quot;examples.jl&quot;, &quot;path/to/save/markdown&quot;; 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. <a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a> as</p><pre><code class="language-julia">Literate.markdown("examples.jl", "path/to/save/markdown";
name = &quot;markdown_file_name&quot;, 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 example in the documentation of the Julia package <a href="https://github.com/JuliaDynamics/TimeseriesPrediction.jl"><code>TimeseriesPrediction</code></a>, see <a href="https://github.com/JuliaDynamics/DynamicalSystems.jl/blob/master/docs/src/tsprediction/stexamples.jl">here</a> and <a href="https://github.com/JuliaDynamics/DynamicalSystems.jl/blob/master/docs/make.jl#L11-L29">here for the generating script</a></p><footer><hr/><a class="previous" href="../outputformats/"><span class="direction">Previous</span><span class="title"><strong>4.</strong> Output Formats</span></a><a class="next" href="../documenter/"><span class="direction">Next</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></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 example in the documentation of the Julia package <a href="https://github.com/JuliaDynamics/TimeseriesPrediction.jl"><code>TimeseriesPrediction</code></a>, see <a href="https://github.com/JuliaDynamics/DynamicalSystems.jl/blob/master/docs/src/tsprediction/stexamples.jl">here</a> and <a href="https://github.com/JuliaDynamics/DynamicalSystems.jl/blob/master/docs/make.jl#L11-L29">here for the generating script</a></p><footer><hr/><a class="previous" href="../outputformats/"><span class="direction">Previous</span><span class="title"><strong>4.</strong> Output Formats</span></a><a class="next" href="../documenter/"><span class="direction">Next</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></HTML>

53
v1.1.0/documenter/index.html

@ -1,12 +1,53 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>6. Interaction with Documenter.jl · Literate.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 data-main="../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>6. Interaction with Documenter.jl · Literate.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"><a href="../index.html"><img class="logo" src="../assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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="../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li class="current"><a class="toctext" href><strong>6.</strong> Interaction with Documenter.jl</a><ul class="internal"></ul></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href><strong>6.</strong> Interaction with Documenter.jl</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/documenter.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>6. Interaction with Documenter.jl</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Interaction-with-Documenter-1" href="#Interaction-with-Documenter-1"><strong>6.</strong> Interaction with Documenter.jl</a></h1><p>Literate can be used for any purpose, it spits out regular markdown files, and notebooks. Typically, though, these files will be used to render documentation for your package. The generators (<a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <a href="../outputformats/#Literate.script"><code>Literate.script</code></a>) supports a keyword argument <code>documenter</code> that lets the generator perform some extra things, keeping in mind that the source code have been written with Documenter.jl in mind. So lets take a look at what will happen if we set <code>documenter = true</code>:</p><h3><a class="nav-anchor" id="[Literate.markdown](@ref):-1" href="#[Literate.markdown](@ref):-1"><a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>:</a></h3><ul><li>The default code fence will change from<pre><code class="language-none">```julia const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="../index.html"><img alt="Literate.jl logo" class="logo" src="../assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="../search/" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li class="current"><a class="toctext" href=""><strong>6.</strong> Interaction with Documenter.jl</a><ul class="internal"></ul></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href=""><strong>6.</strong> Interaction with Documenter.jl</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/documenter.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>6. Interaction with Documenter.jl</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#Interaction-with-Documenter-1" id="Interaction-with-Documenter-1"><strong>6.</strong> Interaction with Documenter.jl</a></h1><p>Literate can be used for any purpose, it spits out regular markdown files, and notebooks. Typically, though, these files will be used to render documentation for your package. The generators (<a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <a href="../outputformats/#Literate.script"><code>Literate.script</code></a>) supports a keyword argument <code>documenter</code> that lets the generator perform some extra things, keeping in mind that the source code have been written with Documenter.jl in mind. So lets take a look at what will happen if we set <code>documenter = true</code>:</p><h3><a class="nav-anchor" href="#[Literate.markdown](@ref):-1" id="[Literate.markdown](@ref):-1"></a><a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>:</h3><ul><li>The default code fence will change from<pre><code class="language-none">```julia
# code # code
```</code></pre>to Documenters <code>@example</code> blocks:<pre><code class="language-none">```@examples $(name) ```</code></pre>to Documenters <code>@example</code> blocks:<pre><code class="language-none">```@examples $(name)
# code # code
```</code></pre></li><li>The following <code>@meta</code> block will be added to the top of the markdown page, which redirects the &quot;Edit on GitHub&quot; link on the top of the page to the <em>source file</em> rather than the generated <code>.md</code> file:<pre><code class="language-none">```@meta ```</code></pre></li><li>The following <code>@meta</code> block will be added to the top of the markdown page, which redirects the "Edit on GitHub" link on the top of the page to the <em>source file</em> rather than the generated <code>.md</code> file:<pre><code class="language-none">```@meta
EditURL = &quot;$(relpath(inputfile, outputdir))&quot; EditURL = "$(relpath(inputfile, outputdir))"
```</code></pre></li></ul><h3><a class="nav-anchor" id="[Literate.notebook](@ref):-1" href="#[Literate.notebook](@ref):-1"><a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a>:</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 notebook.</li><li>Documenter style markdown math<pre><code class="language-none">```math ```</code></pre></li></ul><h3><a class="nav-anchor" href="#[Literate.notebook](@ref):-1" id="[Literate.notebook](@ref):-1"></a><a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></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 notebook.</li><li>Documenter style markdown math<pre><code class="language-none">```math
\int f dx \int f dx
```</code></pre>is replaced with notebook compatible<pre><code class="language-none">\begin{equation} ```</code></pre>is replaced with notebook compatible<pre><code class="language-none">\begin{equation}
\int f dx \int f dx
\end{equation}</code></pre></li></ul><h3><a class="nav-anchor" id="[Literate.script](@ref):-1" href="#[Literate.script](@ref):-1"><a href="../outputformats/#Literate.script"><code>Literate.script</code></a>:</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><footer><hr/><a class="previous" href="../customprocessing/"><span class="direction">Previous</span><span class="title"><strong>5.</strong> Custom pre- and post-processing</span></a><a class="next" href="../generated/example/"><span class="direction">Next</span><span class="title"><strong>7.</strong> Example</span></a></footer></article></body></html> \end{equation}</code></pre></li></ul><h3><a class="nav-anchor" href="#[Literate.script](@ref):-1" id="[Literate.script](@ref):-1"></a><a href="../outputformats/#Literate.script"><code>Literate.script</code></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><footer><hr/><a class="previous" href="../customprocessing/"><span class="direction">Previous</span><span class="title"><strong>5.</strong> Custom pre- and post-processing</span></a><a class="next" href="../generated/example/"><span class="direction">Next</span><span class="title"><strong>7.</strong> Example</span></a></footer></article></body></HTML>

49
v1.1.0/fileformat/index.html

@ -1,5 +1,46 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>2. File Format · Literate.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 data-main="../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>2. File Format · Literate.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"><a href="../index.html"><img class="logo" src="../assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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="../"><strong>1.</strong> Introduction</a></li><li class="current"><a class="toctext" href><strong>2.</strong> File Format</a><ul class="internal"><li><a class="toctext" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></li><li><a class="toctext" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</a></li><li><a class="toctext" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></li></ul></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><a class="toctext" href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href><strong>2.</strong> File Format</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/fileformat.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>2. File Format</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="**2.**-File-Format-1" href="#**2.**-File-Format-1"><strong>2.</strong> File Format</a></h1><p>The source file format for Literate is a regular, commented, julia (<code>.jl</code>) scripts. The idea is that the scripts also serve as documentation on their own and it is also simple to include them in the test-suite, with e.g. <code>include</code>, to make sure the examples stay up do date with other changes in your package.</p><h2><a class="nav-anchor" id="Syntax-1" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></h2><p>The basic syntax is simple:</p><ul><li>lines starting with <code>#</code> are treated as markdown,</li><li>all other lines are treated as julia code.</li></ul><p>Leading whitespace is allowed before <code>#</code>, but it will be removed when generating the output. Since <code>#</code>-lines is treated as markdown we can not use that for regular julia comments, for this you can instead use <code>##</code>, which will render as <code>#</code> in the output.</p><p>Lets look at a simple example:</p><pre><code class="language-julia"># # Rational numbers const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="../index.html"><img alt="Literate.jl logo" class="logo" src="../assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="../search/" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="../"><strong>1.</strong> Introduction</a></li><li class="current"><a class="toctext" href=""><strong>2.</strong> File Format</a><ul class="internal"><li><a class="toctext" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></li><li><a class="toctext" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</a></li><li><a class="toctext" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></li></ul></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><a class="toctext" href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href=""><strong>2.</strong> File Format</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/fileformat.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>2. File Format</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#**2.**-File-Format-1" id="**2.**-File-Format-1"><strong>2.</strong> File Format</a></h1><p>The source file format for Literate is a regular, commented, julia (<code>.jl</code>) scripts. The idea is that the scripts also serve as documentation on their own and it is also simple to include them in the test-suite, with e.g. <code>include</code>, to make sure the examples stay up do date with other changes in your package.</p><h2><a class="nav-anchor" href="#Syntax-1" id="Syntax-1"><strong>2.1.</strong> Syntax</a></h2><p>The basic syntax is simple:</p><ul><li>lines starting with <code>#</code> are treated as markdown,</li><li>all other lines are treated as julia code.</li></ul><p>Leading whitespace is allowed before <code>#</code>, but it will be removed when generating the output. Since <code>#</code>-lines is treated as markdown we can not use that for regular julia comments, for this you can instead use <code>##</code>, which will render as <code>#</code> in the output.</p><p>Lets look at a simple example:</p><pre><code class="language-julia"># # Rational numbers
# #
# In julia rational numbers can be constructed with the `//` operator. # In julia rational numbers can be constructed with the `//` operator.
# Lets define two rational numbers, `x` and `y`: # Lets define two rational numbers, `x` and `y`:
@ -9,9 +50,9 @@ y = 2//5
# When adding `x` and `y` together we obtain a new rational number: # When adding `x` and `y` together we obtain a new rational number:
z = x + y</code></pre><p>In the lines starting with <code>#</code> we can use regular markdown syntax, for example the <code>#</code> used for the heading and the backticks for formatting code. The other lines are regular julia code. We note a couple of things:</p><ul><li>The script is valid julia, which means that we can <code>include</code> it and the example will run (for example in the <code>test/runtests.jl</code> script, to include the example in the test suite).</li><li>The script is &quot;self-explanatory&quot;, i.e. the markdown lines works as comments and thus serve as good documentation on its own.</li></ul><p>For simple use this is all you need to know. The following additional special syntax can also be used:</p><ul><li><code>#md</code>, <code>#nb</code>, <code>#jl</code>, <code>#src</code>: tags to filter lines, see <a href="#Filtering-Lines-1">Filtering Lines</a>,</li><li><code>#-</code>: tag to manually control chunk-splits, see <a href="../pipeline/#Custom-control-over-chunk-splits-1">Custom control over chunk splits</a>.</li></ul><p>There is also some default convenience replacements that will always be performed, see <a href="#Default-Replacements-1">Default Replacements</a>.</p><h2><a class="nav-anchor" id="Filtering-Lines-1" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</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 &quot;tokens&quot; 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> with one of these tokens are filtered out in the <a href="../pipeline/#Pre-processing-1">preprocessing step</a>.</p><p>Suppose, for example, that we want to include a docstring within a <code>@docs</code> block using Documenter. Obviously we don&#39;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><code class="language-julia">#md # ```@docs z = x + y</code></pre><p>In the lines starting with <code>#</code> we can use regular markdown syntax, for example the <code>#</code> used for the heading and the backticks for formatting code. The other lines are regular julia code. We note a couple of things:</p><ul><li>The script is valid julia, which means that we can <code>include</code> it and the example will run (for example in the <code>test/runtests.jl</code> script, to include the example in the test suite).</li><li>The script is "self-explanatory", i.e. the markdown lines works as comments and thus serve as good documentation on its own.</li></ul><p>For simple use this is all you need to know. The following additional special syntax can also be used:</p><ul><li><code>#md</code>, <code>#nb</code>, <code>#jl</code>, <code>#src</code>: tags to filter lines, see <a href="#Filtering-Lines-1">Filtering Lines</a>,</li><li><code>#-</code>: tag to manually control chunk-splits, see <a href="../pipeline/#Custom-control-over-chunk-splits-1">Custom control over chunk splits</a>.</li></ul><p>There is also some default convenience replacements that will always be performed, see <a href="#Default-Replacements-1">Default Replacements</a>.</p><h2><a class="nav-anchor" href="#Filtering-Lines-1" id="Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</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> with one of these tokens are filtered out in the <a href="../pipeline/#Pre-processing-1">preprocessing step</a>.</p><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><code class="language-julia">#md # ```@docs
#md # Literate.markdown #md # Literate.markdown
#md # Literate.notebook #md # Literate.notebook
#md # Literate.markdown #md # Literate.markdown
#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 simple 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><code class="language-julia">using Test #src #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 simple 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><code class="language-julia">using Test #src
@test result == expected_result #src</code></pre><h2><a class="nav-anchor" id="Default-Replacements-1" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></h2><p>The following convenience &quot;macros&quot; are always expanded:</p><ul><li><p><code>@__NAME__</code></p><p>expands to the <code>name</code> keyword argument to <a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <a href="../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>expands to <code>https://github.com/$(ENV[&quot;TRAVIS_REPO_SLUG&quot;])/blob/master/</code> and is a convenient way to use when you want to link to files outside the doc-build directory. For example <code>@__REPO__ROOT_URL__src/Literate.jl</code> would link to the source of the Literate module.</p></li><li><p><code>@__NBVIEWER_ROOT_URL__</code></p><p>expands to <code>https://nbviewer.jupyter.org/github/$(ENV[&quot;TRAVIS_REPO_SLUG&quot;])/blob/gh-pages/$(folder)/</code> where <code>folder</code> is the folder that <code>Documenter.deploydocs</code> deploys too. This can be used if you want a link that opens the generated notebook in <a href="http://nbviewer.jupyter.org/">http://nbviewer.jupyter.org/</a>.</p></li><li><p><code>@__BINDER_ROOT_URL__</code></p><p>expands to <code>https://mybinder.org/v2/gh/$(ENV[&quot;TRAVIS_REPO_SLUG&quot;])/$(branch)?filepath=$(folder)/</code> where <code>branch</code>/<code>folder</code> is the branch and folder where <code>Documenter.deploydocs</code> deploys too. This can be used if you want a link that opens the generated notebook in <a href="https://mybinder.org/">https://mybinder.org/</a>. To add a binder-badge in e.g. the HTML output you can use:</p><pre><code class="language-none">[![Binder](https://mybinder.org/badge_logo.svg)](@__BINDER_ROOT_URL__path/to/notebook.inpynb)</code></pre></li></ul><footer><hr/><a class="previous" href="../"><span class="direction">Previous</span><span class="title"><strong>1.</strong> Introduction</span></a><a class="next" href="../pipeline/"><span class="direction">Next</span><span class="title"><strong>3.</strong> Processing pipeline</span></a></footer></article></body></html> @test result == expected_result #src</code></pre><h2><a class="nav-anchor" href="#Default-Replacements-1" id="Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></h2><p>The following convenience "macros" are always expanded:</p><ul><li><p><code>@__NAME__</code></p><p>expands to the <code>name</code> keyword argument to <a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <a href="../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>expands to <code>https://github.com/$(ENV["TRAVIS_REPO_SLUG"])/blob/master/</code> and is a convenient way to use when you want to link to files outside the doc-build directory. For example <code>@__REPO__ROOT_URL__src/Literate.jl</code> would link to the source of the Literate module.</p></li><li><p><code>@__NBVIEWER_ROOT_URL__</code></p><p>expands to <code>https://nbviewer.jupyter.org/github/$(ENV["TRAVIS_REPO_SLUG"])/blob/gh-pages/$(folder)/</code> where <code>folder</code> is the folder that <code>Documenter.deploydocs</code> deploys too. This can be used if you want a link that opens the generated notebook in <a href="http://nbviewer.jupyter.org/">http://nbviewer.jupyter.org/</a>.</p></li><li><p><code>@__BINDER_ROOT_URL__</code></p><p>expands to <code>https://mybinder.org/v2/gh/$(ENV["TRAVIS_REPO_SLUG"])/$(branch)?filepath=$(folder)/</code> where <code>branch</code>/<code>folder</code> is the branch and folder where <code>Documenter.deploydocs</code> deploys too. This can be used if you want a link that opens the generated notebook in <a href="https://mybinder.org/">https://mybinder.org/</a>. To add a binder-badge in e.g. the HTML output you can use:</p><pre><code class="language-none">[![Binder](https://mybinder.org/badge_logo.svg)](@__BINDER_ROOT_URL__path/to/notebook.inpynb)</code></pre></li></ul><footer><hr/><a class="previous" href="../"><span class="direction">Previous</span><span class="title"><strong>1.</strong> Introduction</span></a><a class="next" href="../pipeline/"><span class="direction">Next</span><span class="title"><strong>3.</strong> Processing pipeline</span></a></footer></article></body></HTML>

188
v1.1.0/generated/example/index.html

@ -1,7 +1,48 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>7. Example · Literate.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 data-main="../../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../../siteinfo.js"></script><script src="../../../versions.js"></script><link href="../../assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>7. Example · Literate.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"><a href="../../index.html"><img class="logo" src="../../assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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="../../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><a class="toctext" href="../../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li class="current"><a class="toctext" href><strong>7.</strong> Example</a><ul class="internal"></ul></li></ul></nav><article id="docs"><header><nav><ul><li><a href><strong>7.</strong> Example</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>7. Example</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="**7.**-Example-1" href="#**7.**-Example-1"><strong>7.</strong> Example</a></h1><p><a href="https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=v1.1.0/generated/example.ipynb"><img src="https://mybinder.org/badge_logo.svg" alt/></a> <a href="https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v1.1.0/generated/example.ipynb"><img src="https://img.shields.io/badge/show-nbviewer-579ACA.svg" alt/></a></p><p>This is an example generated with Literate based on this source file: <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><code>example.jl</code></a>. You are seeing the HTML-output which Documenter have generated based on a markdown file generated with Literate. The corresponding notebook can be viewed in <a href="http://nbviewer.jupyter.org/">nbviewer</a> here: <a href="https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v1.1.0/generated/example.ipynb"><code>example.ipynb</code></a>, and opened in <a href="https://mybinder.org/">binder</a> here: <a href="https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=v1.1.0/generated/example.ipynb"><code>example.ipynb</code></a>, and the plain script output can be found here: <a href="../example.jl"><code>example.jl</code></a>.</p><p>It is recommended to have the <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl">source file</a> available when reading this, to better understand how the syntax in the source file corresponds to the output you are seeing.</p><h3><a class="nav-anchor" id="Basic-syntax-1" href="#Basic-syntax-1">Basic syntax</a></h3><p>The basic syntax for Literate is simple, lines starting with <code>#</code> is interpreted as markdown, and all the other lines are interpreted as code. Here is some code:</p><pre><code class="language-julia">x = 1//3 const head = document.getElementsByTagName('head')[0];
y = 2//5</code></pre><pre><code class="language-none">2//5</code></pre><p>In markdown sections we can use markdown syntax. For example, we can write <em>text in italic font</em>, <strong>text in bold font</strong> and use <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">links</a>.</p><p>It is possible to filter out lines depending on the output using the <code>#md</code>, <code>#nb</code>, <code>#jl</code> and <code>#src</code> tags (see <a href="../../fileformat/#Filtering-Lines-1">Filtering Lines</a>):</p><ul><li>This line starts with <code>#md</code> and is thus only visible in the markdown output.</li></ul><p>The source file is parsed in chunks of markdown and code. Starting a line with <code>#-</code> manually inserts a chunk break. For example, if we want to display the output of the following operations we may insert <code>#-</code> in between. These two code blocks will now end up in different <code>@example</code>-blocks in the markdown output, and two different notebook cells in the notebook output.</p><pre><code class="language-julia">x + y</code></pre><pre><code class="language-none">11//15</code></pre><pre><code class="language-julia">x * y</code></pre><pre><code class="language-none">2//15</code></pre><h3><a class="nav-anchor" id="Output-Capturing-1" href="#Output-Capturing-1">Output Capturing</a></h3><p>Code chunks are by default placed in Documenter <code>@example</code> blocks in the generated markdown. This means that the output will be captured in a block when Documenter is building the docs. In notebooks the output is captured in output cells, if the <code>execute</code> keyword argument is set to true. Output to <code>stdout</code>/<code>stderr</code> is also captured.</p><pre><code class="language-julia">function foo()
println(&quot;This string is printed to stdout.&quot;) // Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="../../index.html"><img alt="Literate.jl logo" class="logo" src="../../assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="../../search/" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="../../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><a class="toctext" href="../../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li class="current"><a class="toctext" href=""><strong>7.</strong> Example</a><ul class="internal"></ul></li></ul></nav><article id="docs"><header><nav><ul><li><a href=""><strong>7.</strong> Example</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>7. Example</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#**7.**-Example-1" id="**7.**-Example-1"><strong>7.</strong> Example</a></h1><p><a href="https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=v1.1.0/generated/example.ipynb"><img alt="" src="https://mybinder.org/badge_logo.svg"/></a><a href="https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v1.1.0/generated/example.ipynb"><img alt="" src="https://img.shields.io/badge/show-nbviewer-579ACA.svg"/></a></p><p>This is an example generated with Literate based on this source file: <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><code>example.jl</code></a>. You are seeing the HTML-output which Documenter have generated based on a markdown file generated with Literate. The corresponding notebook can be viewed in <a href="http://nbviewer.jupyter.org/">nbviewer</a> here: <a href="https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v1.1.0/generated/example.ipynb"><code>example.ipynb</code></a>, and opened in <a href="https://mybinder.org/">binder</a> here: <a href="https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=v1.1.0/generated/example.ipynb"><code>example.ipynb</code></a>, and the plain script output can be found here: <a href="../example.jl"><code>example.jl</code></a>.</p><p>It is recommended to have the <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl">source file</a> available when reading this, to better understand how the syntax in the source file corresponds to the output you are seeing.</p><h3><a class="nav-anchor" href="#Basic-syntax-1" id="Basic-syntax-1">Basic syntax</a></h3><p>The basic syntax for Literate is simple, lines starting with <code>#</code> is interpreted as markdown, and all the other lines are interpreted as code. Here is some code:</p><pre><code class="language-julia">x = 1//3
y = 2//5</code></pre><pre><code class="language-none">2//5</code></pre><p>In markdown sections we can use markdown syntax. For example, we can write <em>text in italic font</em>, <strong>text in bold font</strong> and use <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">links</a>.</p><p>It is possible to filter out lines depending on the output using the <code>#md</code>, <code>#nb</code>, <code>#jl</code> and <code>#src</code> tags (see <a href="../../fileformat/#Filtering-Lines-1">Filtering Lines</a>):</p><ul><li>This line starts with <code>#md</code> and is thus only visible in the markdown output.</li></ul><p>The source file is parsed in chunks of markdown and code. Starting a line with <code>#-</code> manually inserts a chunk break. For example, if we want to display the output of the following operations we may insert <code>#-</code> in between. These two code blocks will now end up in different <code>@example</code>-blocks in the markdown output, and two different notebook cells in the notebook output.</p><pre><code class="language-julia">x + y</code></pre><pre><code class="language-none">11//15</code></pre><pre><code class="language-julia">x * y</code></pre><pre><code class="language-none">2//15</code></pre><h3><a class="nav-anchor" href="#Output-Capturing-1" id="Output-Capturing-1">Output Capturing</a></h3><p>Code chunks are by default placed in Documenter <code>@example</code> blocks in the generated markdown. This means that the output will be captured in a block when Documenter is building the docs. In notebooks the output is captured in output cells, if the <code>execute</code> keyword argument is set to true. Output to <code>stdout</code>/<code>stderr</code> is also captured.</p><pre><code class="language-julia">function foo()
println("This string is printed to stdout.")
return [1, 2, 3, 4] return [1, 2, 3, 4]
end end
@ -9,121 +50,55 @@ foo()</code></pre><pre><code class="language-none">4-element Array{Int64,1}:
1 1
2 2
3 3
4</code></pre><p>Both Documenter&#39;s <code>@example</code> block and notebooks can display images. Here is an example where we generate a simple plot using the <a href="https://github.com/JuliaPlots/Plots.jl">Plots.jl</a> package</p><pre><code class="language-julia">using Plots 4</code></pre><p>Both Documenter's <code>@example</code> block and notebooks can display images. Here is an example where we generate a simple plot using the <a href="https://github.com/JuliaPlots/Plots.jl">Plots.jl</a> package</p><pre><code class="language-julia">using Plots
x = range(0, stop=6π, length=1000) x = range(0, stop=6π, length=1000)
y1 = sin.(x) y1 = sin.(x)
y2 = cos.(x) y2 = cos.(x)
plot(x, [y1, y2])</code></pre><?xml version="1.0" encoding="utf-8"?> plot(x, [y1, y2])</code></pre><svg height="400" viewBox="0 0 2400 1600" width="600" xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"><defs><clipPath id="clip5200"><rect height="1600" width="2400" x="0" y="0"></rect></clipPath></defs><polygon clip-path="url(#clip5200)" fill="#ffffff" fill-opacity="1" fill-rule="evenodd" points="
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="600" height="400" viewBox="0 0 2400 1600">
<defs>
<clipPath id="clip5200">
<rect x="0" y="0" width="2400" height="1600"/>
</clipPath>
</defs>
<polygon clip-path="url(#clip5200)" points="
0,1600 2400,1600 2400,0 0,0 0,1600 2400,1600 2400,0 0,0
" fill="#ffffff" fill-rule="evenodd" fill-opacity="1"/> "></polygon><defs><clipPath id="clip5201"><rect height="1600" width="1681" x="480" y="0"></rect></clipPath></defs><polygon clip-path="url(#clip5200)" fill="#ffffff" fill-opacity="1" fill-rule="evenodd" points="
<defs>
<clipPath id="clip5201">
<rect x="480" y="0" width="1681" height="1600"/>
</clipPath>
</defs>
<polygon clip-path="url(#clip5200)" points="
94.4882,1537.01 2321.26,1537.01 2321.26,47.2441 94.4882,47.2441 94.4882,1537.01 2321.26,1537.01 2321.26,47.2441 94.4882,47.2441
" fill="#ffffff" fill-rule="evenodd" fill-opacity="1"/> "></polygon><defs><clipPath id="clip5202"><rect height="1491" width="2228" x="94" y="47"></rect></clipPath></defs><polyline clip-path="url(#clip5202)" points="
<defs>
<clipPath id="clip5202">
<rect x="94" y="47" width="2228" height="1491"/>
</clipPath>
</defs>
<polyline clip-path="url(#clip5202)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
157.51,1537.01 157.51,47.2441 157.51,1537.01 157.51,47.2441
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip5202)" points="
<polyline clip-path="url(#clip5202)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
714.745,1537.01 714.745,47.2441 714.745,1537.01 714.745,47.2441
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip5202)" points="
<polyline clip-path="url(#clip5202)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
1271.98,1537.01 1271.98,47.2441 1271.98,1537.01 1271.98,47.2441
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip5202)" points="
<polyline clip-path="url(#clip5202)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
1829.22,1537.01 1829.22,47.2441 1829.22,1537.01 1829.22,47.2441
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip5202)" points="
<polyline clip-path="url(#clip5202)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
94.4882,1494.85 2321.26,1494.85 94.4882,1494.85 2321.26,1494.85
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip5202)" points="
<polyline clip-path="url(#clip5202)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
94.4882,1143.49 2321.26,1143.49 94.4882,1143.49 2321.26,1143.49
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip5202)" points="
<polyline clip-path="url(#clip5202)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
94.4882,792.13 2321.26,792.13 94.4882,792.13 2321.26,792.13
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip5202)" points="
<polyline clip-path="url(#clip5202)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
94.4882,440.769 2321.26,440.769 94.4882,440.769 2321.26,440.769
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip5202)" points="
<polyline clip-path="url(#clip5202)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
94.4882,89.4072 2321.26,89.4072 94.4882,89.4072 2321.26,89.4072
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip5200)" points="
<polyline clip-path="url(#clip5200)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
94.4882,1537.01 2321.26,1537.01 94.4882,1537.01 2321.26,1537.01
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5200)" points="
<polyline clip-path="url(#clip5200)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
94.4882,1537.01 94.4882,47.2441 94.4882,1537.01 94.4882,47.2441
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5200)" points="
<polyline clip-path="url(#clip5200)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
157.51,1537.01 157.51,1514.66 157.51,1537.01 157.51,1514.66
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5200)" points="
<polyline clip-path="url(#clip5200)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
714.745,1537.01 714.745,1514.66 714.745,1537.01 714.745,1514.66
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5200)" points="
<polyline clip-path="url(#clip5200)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
1271.98,1537.01 1271.98,1514.66 1271.98,1537.01 1271.98,1514.66
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5200)" points="
<polyline clip-path="url(#clip5200)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
1829.22,1537.01 1829.22,1514.66 1829.22,1537.01 1829.22,1514.66
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5200)" points="
<polyline clip-path="url(#clip5200)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
94.4882,1494.85 127.89,1494.85 94.4882,1494.85 127.89,1494.85
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5200)" points="
<polyline clip-path="url(#clip5200)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
94.4882,1143.49 127.89,1143.49 94.4882,1143.49 127.89,1143.49
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5200)" points="
<polyline clip-path="url(#clip5200)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
94.4882,792.13 127.89,792.13 94.4882,792.13 127.89,792.13
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5200)" points="
<polyline clip-path="url(#clip5200)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
94.4882,440.769 127.89,440.769 94.4882,440.769 127.89,440.769
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5200)" points="
<polyline clip-path="url(#clip5200)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
94.4882,89.4072 127.89,89.4072 94.4882,89.4072 127.89,89.4072
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><g clip-path="url(#clip5200)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 157.51, 1591.01)" x="157.51" y="1591.01">0</text></g><g clip-path="url(#clip5200)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 714.745, 1591.01)" x="714.745" y="1591.01">5</text></g><g clip-path="url(#clip5200)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 1271.98, 1591.01)" x="1271.98" y="1591.01">10</text></g><g clip-path="url(#clip5200)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 1829.22, 1591.01)" x="1829.22" y="1591.01">15</text></g><g clip-path="url(#clip5200)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 1512.35)" x="70.4882" y="1512.35">-1.0</text></g><g clip-path="url(#clip5200)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 1160.99)" x="70.4882" y="1160.99">-0.5</text></g><g clip-path="url(#clip5200)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 809.63)" x="70.4882" y="809.63">0.0</text></g><g clip-path="url(#clip5200)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 458.269)" x="70.4882" y="458.269">0.5</text></g><g clip-path="url(#clip5200)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 106.907)" x="70.4882" y="106.907">1.0</text></g><polyline clip-path="url(#clip5202)" points="
<g clip-path="url(#clip5200)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 157.51, 1591.01)" x="157.51" y="1591.01">0</text>
</g>
<g clip-path="url(#clip5200)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 714.745, 1591.01)" x="714.745" y="1591.01">5</text>
</g>
<g clip-path="url(#clip5200)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 1271.98, 1591.01)" x="1271.98" y="1591.01">10</text>
</g>
<g clip-path="url(#clip5200)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 1829.22, 1591.01)" x="1829.22" y="1591.01">15</text>
</g>
<g clip-path="url(#clip5200)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 1512.35)" x="70.4882" y="1512.35">-1.0</text>
</g>
<g clip-path="url(#clip5200)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 1160.99)" x="70.4882" y="1160.99">-0.5</text>
</g>
<g clip-path="url(#clip5200)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 809.63)" x="70.4882" y="809.63">0.0</text>
</g>
<g clip-path="url(#clip5200)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 458.269)" x="70.4882" y="458.269">0.5</text>
</g>
<g clip-path="url(#clip5200)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 70.4882, 106.907)" x="70.4882" y="106.907">1.0</text>
</g>
<polyline clip-path="url(#clip5202)" style="stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none" points="
157.51,792.13 159.613,778.871 161.716,765.618 163.819,752.373 165.921,739.143 168.024,725.932 170.127,712.744 172.23,699.585 174.333,686.458 176.436,673.369 157.51,792.13 159.613,778.871 161.716,765.618 163.819,752.373 165.921,739.143 168.024,725.932 170.127,712.744 172.23,699.585 174.333,686.458 176.436,673.369
178.538,660.323 180.641,647.323 182.744,634.375 184.847,621.483 186.95,608.651 189.052,595.886 191.155,583.189 193.258,570.568 195.361,558.025 197.464,545.566 178.538,660.323 180.641,647.323 182.744,634.375 184.847,621.483 186.95,608.651 189.052,595.886 191.155,583.189 193.258,570.568 195.361,558.025 197.464,545.566
199.567,533.194 201.669,520.914 203.772,508.731 205.875,496.649 207.978,484.673 210.081,472.805 212.184,461.051 214.286,449.416 216.389,437.902 218.492,426.514 199.567,533.194 201.669,520.914 203.772,508.731 205.875,496.649 207.978,484.673 210.081,472.805 212.184,461.051 214.286,449.416 216.389,437.902 218.492,426.514
@ -225,8 +200,7 @@ plot(x, [y1, y2])</code></pre><?xml version="1.0" encoding="utf-8"?>
2218.28,1038.69 2220.39,1026.23 2222.49,1013.69 2224.59,1001.07 2226.7,988.374 2228.8,975.608 2230.9,962.777 2233,949.885 2235.11,936.937 2237.21,923.937 2218.28,1038.69 2220.39,1026.23 2222.49,1013.69 2224.59,1001.07 2226.7,988.374 2228.8,975.608 2230.9,962.777 2233,949.885 2235.11,936.937 2237.21,923.937
2239.31,910.891 2241.42,897.802 2243.52,884.675 2245.62,871.516 2247.72,858.328 2249.83,845.117 2251.93,831.886 2254.03,818.642 2256.14,805.388 2258.24,792.13 2239.31,910.891 2241.42,897.802 2243.52,884.675 2245.62,871.516 2247.72,858.328 2249.83,845.117 2251.93,831.886 2254.03,818.642 2256.14,805.388 2258.24,792.13
"/> " style="stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5202)" points="
<polyline clip-path="url(#clip5202)" style="stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none" points="
157.51,89.4072 159.613,89.5323 161.716,89.9075 163.819,90.5327 165.921,91.4077 168.024,92.5322 170.127,93.9057 172.23,95.5278 174.333,97.3978 176.436,99.5152 157.51,89.4072 159.613,89.5323 161.716,89.9075 163.819,90.5327 165.921,91.4077 168.024,92.5322 170.127,93.9057 172.23,95.5278 174.333,97.3978 176.436,99.5152
178.538,101.879 180.641,104.489 182.744,107.343 184.847,110.442 186.95,113.783 189.052,117.365 191.155,121.188 193.258,125.25 195.361,129.549 197.464,134.083 178.538,101.879 180.641,104.489 182.744,107.343 184.847,110.442 186.95,113.783 189.052,117.365 191.155,121.188 193.258,125.25 195.361,129.549 197.464,134.083
199.567,138.853 201.669,143.854 203.772,149.087 205.875,154.548 207.978,160.237 210.081,166.15 212.184,172.286 214.286,178.643 216.389,185.218 218.492,192.01 199.567,138.853 201.669,143.854 203.772,149.087 205.875,154.548 207.978,160.237 210.081,166.15 212.184,172.286 214.286,178.643 216.389,185.218 218.492,192.01
@ -328,24 +302,12 @@ plot(x, [y1, y2])</code></pre><?xml version="1.0" encoding="utf-8"?>
2218.28,134.083 2220.39,129.549 2222.49,125.25 2224.59,121.188 2226.7,117.365 2228.8,113.783 2230.9,110.442 2233,107.343 2235.11,104.489 2237.21,101.879 2218.28,134.083 2220.39,129.549 2222.49,125.25 2224.59,121.188 2226.7,117.365 2228.8,113.783 2230.9,110.442 2233,107.343 2235.11,104.489 2237.21,101.879
2239.31,99.5152 2241.42,97.3978 2243.52,95.5278 2245.62,93.9057 2247.72,92.5322 2249.83,91.4077 2251.93,90.5327 2254.03,89.9075 2256.14,89.5323 2258.24,89.4072 2239.31,99.5152 2241.42,97.3978 2243.52,95.5278 2245.62,93.9057 2247.72,92.5322 2249.83,91.4077 2251.93,90.5327 2254.03,89.9075 2256.14,89.5323 2258.24,89.4072
"/> " style="stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polygon clip-path="url(#clip5200)" fill="#ffffff" fill-opacity="1" fill-rule="evenodd" points="
<polygon clip-path="url(#clip5200)" points="
1958.43,312.204 2249.26,312.204 2249.26,130.764 1958.43,130.764 1958.43,312.204 2249.26,312.204 2249.26,130.764 1958.43,130.764
" fill="#ffffff" fill-rule="evenodd" fill-opacity="1"/> "></polygon><polyline clip-path="url(#clip5200)" points="
<polyline clip-path="url(#clip5200)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
1958.43,312.204 2249.26,312.204 2249.26,130.764 1958.43,130.764 1958.43,312.204 1958.43,312.204 2249.26,312.204 2249.26,130.764 1958.43,130.764 1958.43,312.204
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip5200)" points="
<polyline clip-path="url(#clip5200)" style="stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none" points="
1982.43,191.244 2126.43,191.244 1982.43,191.244 2126.43,191.244
"/> " style="stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none"></polyline><g clip-path="url(#clip5200)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;" transform="rotate(0, 2150.43, 208.744)" x="2150.43" y="208.744">y1</text></g><polyline clip-path="url(#clip5200)" points="
<g clip-path="url(#clip5200)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;" transform="rotate(0, 2150.43, 208.744)" x="2150.43" y="208.744">y1</text>
</g>
<polyline clip-path="url(#clip5200)" style="stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none" points="
1982.43,251.724 2126.43,251.724 1982.43,251.724 2126.43,251.724
"/> " style="stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none"></polyline><g clip-path="url(#clip5200)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;" transform="rotate(0, 2150.43, 269.224)" x="2150.43" y="269.224">y2</text></g></svg><h3><a class="nav-anchor" href="#Custom-processing-1" id="Custom-processing-1">Custom processing</a></h3><p>It is possible to give Literate custom pre- and post-processing functions. For example, here we insert two placeholders, which we will replace with something else at time of generation. We have here replaced our placeholders with <code>z</code> and <code>1.0 + 2.0im</code>:</p><pre><code class="language-julia">z = 1.0 + 2.0im</code></pre><pre><code class="language-none">1.0 + 2.0im</code></pre><h3><a class="nav-anchor" href="#documenter-interaction-1" id="documenter-interaction-1">Documenter.jl interaction</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, <a href="#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><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p><footer><hr/><a class="previous" href="../../documenter/"><span class="direction">Previous</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></HTML>
<g clip-path="url(#clip5200)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;" transform="rotate(0, 2150.43, 269.224)" x="2150.43" y="269.224">y2</text>
</g>
</svg>
<h3><a class="nav-anchor" id="Custom-processing-1" href="#Custom-processing-1">Custom processing</a></h3><p>It is possible to give Literate custom pre- and post-processing functions. For example, here we insert two placeholders, which we will replace with something else at time of generation. We have here replaced our placeholders with <code>z</code> and <code>1.0 + 2.0im</code>:</p><pre><code class="language-julia">z = 1.0 + 2.0im</code></pre><pre><code class="language-none">1.0 + 2.0im</code></pre><h3><a class="nav-anchor" id="documenter-interaction-1" href="#documenter-interaction-1">Documenter.jl interaction</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, <a href="#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><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p><footer><hr/><a class="previous" href="../../documenter/"><span class="direction">Previous</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></html>

45
v1.1.0/index.html

File diff suppressed because one or more lines are too long

53
v1.1.0/outputformats/index.html

File diff suppressed because one or more lines are too long

51
v1.1.0/pipeline/index.html

File diff suppressed because one or more lines are too long

45
v1.1.0/search/index.html

@ -1,2 +1,43 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>Search · Literate.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 data-main="../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Search · Literate.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"><a href="../index.html"><img class="logo" src="../assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.jl</h1><select id="version-selector" onChange="window.location.href=this.value" style="visibility: hidden"></select><form class="search" id="search-form" action><input id="search-query" name="q" type="text" placeholder="Search docs"/></form><ul><li><a class="toctext" href="../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><a class="toctext" href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article><header><nav><ul><li>Search</li></ul></nav><hr/><div id="topbar"><span>Search</span><a class="fa fa-bars" href="#"></a></div></header><h1>Search</h1><p id="search-info">Number of results: <span id="search-results-number">loading...</span></p><ul id="search-results"></ul></article></body><script src="../search_index.js"></script><script src="../assets/search.js"></script></html> const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="../index.html"><img alt="Literate.jl logo" class="logo" src="../assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><a class="toctext" href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article><header><nav><ul><li>Search</li></ul></nav><hr/><div id="topbar"><span>Search</span><a class="fa fa-bars" href="#"></a></div></header><h1>Search</h1><p id="search-info">Number of results: <span id="search-results-number">loading...</span></p><ul id="search-results"></ul></article><script src="../search_index.js"></script><script src="../assets/search.js"></script></body></HTML>

63
v2.0.0/customprocessing/index.html

@ -1,29 +1,70 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>5. Custom pre- and post-processing · Literate.jl</title><link href="https://fredrikekre.github.io/Literate.jl/v2/" rel="canonical"/><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 data-main="../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/><link href="../assets/custom.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>5. Custom pre- and post-processing · Literate.jl</title><link rel="canonical" href="https://fredrikekre.github.io/Literate.jl/v2/"/><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"/><link href="../assets/custom.css" rel="stylesheet" type="text/css"/></head><body><nav class="toc"><a href="../"><img class="logo" src="../assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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="../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li class="current"><a class="toctext" href><strong>5.</strong> Custom pre- and post-processing</a><ul class="internal"></ul></li><li><a class="toctext" href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href><strong>5.</strong> Custom pre- and post-processing</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/customprocessing.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>5. Custom pre- and post-processing</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Custom-pre-and-post-processing-1" href="#Custom-pre-and-post-processing-1"><strong>5.</strong> Custom pre- and post-processing</a></h1><p>Since all packages are different, and may have different demands on how to create a nice example for the documentation it is important that the package maintainer does not feel limited by the by default provided syntax that this package offers. While you can generally come a long way by utilizing <a href="../fileformat/#Filtering-Lines-1">line filtering</a> there might be situations where you need to manually hook into the generation and change things. In Literate this is done by letting the user supply custom pre- and post-processing functions that may do transformation of the content.</p><p>All of the generators (<a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <a href="../outputformats/#Literate.script"><code>Literate.script</code></a>) accepts <code>preprocess</code> and <code>postprocess</code> keyword arguments. The default &quot;transformation&quot; is the <code>identity</code> function. The input to the transformation functions is a <code>String</code>, and the output should be the transformed <code>String</code>.</p><p><code>preprocess</code> is sent the raw input that is read from the source file (<a href="../pipeline/#Pre-processing-1">modulo the default line ending transformation</a>). <code>postprocess</code> is given different things depending on the output: For markdown and script output <code>postprocess</code> is given the content <code>String</code> just before writing it to the output file, but for notebook output <code>postprocess</code> is given the dictionary representing the notebook, since, in general, this is more useful.</p><h3><a class="nav-anchor" id="Example:-Adding-current-date-1" href="#Example:-Adding-current-date-1">Example: Adding current date</a></h3><p>As an example, lets say we want to splice the date of generation into the output. We could of course update our source file before generating the docs, but we could instead use a <code>preprocess</code> function that splices the date into the source for us. Consider the following source file:</p><pre><code class="language-julia"># # Example const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="../"><img alt="Literate.jl logo" class="logo" src="../assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="../search/" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li class="current"><a class="toctext" href=""><strong>5.</strong> Custom pre- and post-processing</a><ul class="internal"></ul></li><li><a class="toctext" href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href=""><strong>5.</strong> Custom pre- and post-processing</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/customprocessing.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>5. Custom pre- and post-processing</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#Custom-pre-and-post-processing-1" id="Custom-pre-and-post-processing-1"><strong>5.</strong> Custom pre- and post-processing</a></h1><p>Since all packages are different, and may have different demands on how to create a nice example for the documentation it is important that the package maintainer does not feel limited by the by default provided syntax that this package offers. While you can generally come a long way by utilizing <a href="../fileformat/#Filtering-Lines-1">line filtering</a> there might be situations where you need to manually hook into the generation and change things. In Literate this is done by letting the user supply custom pre- and post-processing functions that may do transformation of the content.</p><p>All of the generators (<a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <a href="../outputformats/#Literate.script"><code>Literate.script</code></a>) accepts <code>preprocess</code> and <code>postprocess</code> keyword arguments. The default "transformation" is the <code>identity</code> function. The input to the transformation functions is a <code>String</code>, and the output should be the transformed <code>String</code>.</p><p><code>preprocess</code> is sent the raw input that is read from the source file (<a href="../pipeline/#Pre-processing-1">modulo the default line ending transformation</a>). <code>postprocess</code> is given different things depending on the output: For markdown and script output <code>postprocess</code> is given the content <code>String</code> just before writing it to the output file, but for notebook output <code>postprocess</code> is given the dictionary representing the notebook, since, in general, this is more useful.</p><h3><a class="nav-anchor" href="#Example:-Adding-current-date-1" id="Example:-Adding-current-date-1">Example: Adding current date</a></h3><p>As an example, lets say we want to splice the date of generation into the output. We could of course update our source file before generating the docs, but we could instead use a <code>preprocess</code> function that splices the date into the source for us. Consider the following source file:</p><pre><code class="language-julia"># # Example
# This example was generated DATEOFTODAY # This example was generated DATEOFTODAY
x = 1 // 3</code></pre><p>where <code>DATEOFTODAY</code> is a placeholder, to make it easier for our <code>preprocess</code> function to find the location. Now, lets define the <code>preprocess</code> function, for example</p><pre><code class="language-julia">function update_date(content) x = 1 // 3</code></pre><p>where <code>DATEOFTODAY</code> is a placeholder, to make it easier for our <code>preprocess</code> function to find the location. Now, lets define the <code>preprocess</code> function, for example</p><pre><code class="language-julia">function update_date(content)
content = replace(content, &quot;DATEOFTODAY&quot; =&gt; Date(now())) content = replace(content, "DATEOFTODAY" =&gt; Date(now()))
return content return content
end</code></pre><p>which would replace every occurrence of <code>&quot;DATEOFTODAY&quot;</code> with the current date. We would now simply give this function to the generator, for example:</p><pre><code class="language-julia">Literate.markdown(&quot;input.jl&quot;, &quot;outputdir&quot;; preprocess = update_date)</code></pre><h3><a class="nav-anchor" id="Example:-Replacing-include-calls-with-included-code-1" href="#Example:-Replacing-include-calls-with-included-code-1">Example: Replacing <code>include</code> calls with included code</a></h3><p>Let&#39;s say that we have some individual example files <code>file1, file2, ...</code> etc. that are <em>runnable</em> and also following the style of Literate. These files could be for example used in the test suite of your package.</p><p>We want to group them all into a single page in our documentation, but we do not want to copy paste the content of <code>file1, ...</code> for robustness: the files are included in the test suite and some changes may occur to them. We want these changes to also be reflected in the documentation.</p><p>A very easy way to do this is using <code>preprocess</code> to interchange <code>include</code> statements with file content. First, create a runnable <code>.jl</code> following the format of Literate</p><pre><code class="language-julia"># # Replace includes end</code></pre><p>which would replace every occurrence of <code>"DATEOFTODAY"</code> with the current date. We would now simply give this function to the generator, for example:</p><pre><code class="language-julia">Literate.markdown("input.jl", "outputdir"; preprocess = update_date)</code></pre><h3><a class="nav-anchor" href="#Example:-Replacing-include-calls-with-included-code-1" id="Example:-Replacing-include-calls-with-included-code-1">Example: Replacing <code>include</code> calls with included code</a></h3><p>Let's say that we have some individual example files <code>file1, file2, ...</code> etc. that are <em>runnable</em> and also following the style of Literate. These files could be for example used in the test suite of your package.</p><p>We want to group them all into a single page in our documentation, but we do not want to copy paste the content of <code>file1, ...</code> for robustness: the files are included in the test suite and some changes may occur to them. We want these changes to also be reflected in the documentation.</p><p>A very easy way to do this is using <code>preprocess</code> to interchange <code>include</code> statements with file content. First, create a runnable <code>.jl</code> following the format of Literate</p><pre><code class="language-julia"># # Replace includes
# This is an example to replace `include` calls with the actual file content. # This is an example to replace `include` calls with the actual file content.
include(&quot;file1.jl&quot;) include("file1.jl")
# Cool, we just saw the result of the above code snippet. Here is one more: # Cool, we just saw the result of the above code snippet. Here is one more:
include(&quot;file2.jl&quot;)</code></pre><p>Let&#39;s say we have saved this file as <code>examples.jl</code>. Then, you want to properly define a pre-processing function:</p><pre><code class="language-julia">function replace_includes(str) include("file2.jl")</code></pre><p>Let's say we have saved this file as <code>examples.jl</code>. Then, you want to properly define a pre-processing function:</p><pre><code class="language-julia">function replace_includes(str)
included = [&quot;file1.jl&quot;, &quot;file2.jl&quot;] included = ["file1.jl", "file2.jl"]
# Here the path loads the files from their proper directory, # Here the path loads the files from their proper directory,
# which may not be the directory of the `examples.jl` file! # which may not be the directory of the `examples.jl` file!
path = &quot;directory/to/example/files/&quot; path = "directory/to/example/files/"
for ex in included for ex in included
content = read(path*ex, String) content = read(path*ex, String)
str = replace(str, &quot;include(\&quot;$(ex)\&quot;)&quot; =&gt; content) str = replace(str, "include(\"$(ex)\")" =&gt; content)
end end
return str 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. <a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a> as</p><pre><code class="language-julia">Literate.markdown(&quot;examples.jl&quot;, &quot;path/to/save/markdown&quot;; 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. <a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a> as</p><pre><code class="language-julia">Literate.markdown("examples.jl", "path/to/save/markdown";
name = &quot;markdown_file_name&quot;, 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 <a href="https://juliadynamics.github.io/TimeseriesPrediction.jl/latest/stexamples/">the examples</a> in the documentation of the <a href="https://github.com/JuliaDynamics/TimeseriesPrediction.jl">TimeseriesPrediction.jl</a> package. The <a href="https://github.com/JuliaDynamics/TimeseriesPrediction.jl/tree/dcb080376a7861716147c04e45c473f55bb9a078/examples">example files</a>, included together in the <a href="https://github.com/JuliaDynamics/TimeseriesPrediction.jl/blob/dcb080376a7861716147c04e45c473f55bb9a078/docs/src/stexamples.jl">stexamples.jl</a> file, are processed by literate via this <a href="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><footer><hr/><a class="previous" href="../outputformats/"><span class="direction">Previous</span><span class="title"><strong>4.</strong> Output Formats</span></a><a class="next" href="../documenter/"><span class="direction">Next</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></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 <a href="https://juliadynamics.github.io/TimeseriesPrediction.jl/latest/stexamples/">the examples</a> in the documentation of the <a href="https://github.com/JuliaDynamics/TimeseriesPrediction.jl">TimeseriesPrediction.jl</a> package. The <a href="https://github.com/JuliaDynamics/TimeseriesPrediction.jl/tree/dcb080376a7861716147c04e45c473f55bb9a078/examples">example files</a>, included together in the <a href="https://github.com/JuliaDynamics/TimeseriesPrediction.jl/blob/dcb080376a7861716147c04e45c473f55bb9a078/docs/src/stexamples.jl">stexamples.jl</a> file, are processed by literate via this <a href="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><footer><hr/><a class="previous" href="../outputformats/"><span class="direction">Previous</span><span class="title"><strong>4.</strong> Output Formats</span></a><a class="next" href="../documenter/"><span class="direction">Next</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></HTML>

53
v2.0.0/documenter/index.html

@ -1,12 +1,53 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>6. Interaction with Documenter.jl · Literate.jl</title><link href="https://fredrikekre.github.io/Literate.jl/v2/" rel="canonical"/><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 data-main="../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/><link href="../assets/custom.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>6. Interaction with Documenter.jl · Literate.jl</title><link rel="canonical" href="https://fredrikekre.github.io/Literate.jl/v2/"/><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"/><link href="../assets/custom.css" rel="stylesheet" type="text/css"/></head><body><nav class="toc"><a href="../"><img class="logo" src="../assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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="../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li class="current"><a class="toctext" href><strong>6.</strong> Interaction with Documenter.jl</a><ul class="internal"></ul></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href><strong>6.</strong> Interaction with Documenter.jl</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/documenter.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>6. Interaction with Documenter.jl</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Interaction-with-Documenter-1" href="#Interaction-with-Documenter-1"><strong>6.</strong> Interaction with Documenter.jl</a></h1><p>Literate can be used for any purpose, it spits out regular markdown files, and notebooks. Typically, though, these files will be used to render documentation for your package. The generators (<a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <a href="../outputformats/#Literate.script"><code>Literate.script</code></a>) supports a keyword argument <code>documenter</code> that lets the generator perform some extra things, keeping in mind that the source code have been written with Documenter.jl in mind. So lets take a look at what will happen if we set <code>documenter = true</code>:</p><h3><a class="nav-anchor" id="[Literate.markdown](@ref):-1" href="#[Literate.markdown](@ref):-1"><a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>:</a></h3><ul><li>The default code fence will change from<pre><code class="language-none">```julia const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="../"><img alt="Literate.jl logo" class="logo" src="../assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="../search/" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li class="current"><a class="toctext" href=""><strong>6.</strong> Interaction with Documenter.jl</a><ul class="internal"></ul></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href=""><strong>6.</strong> Interaction with Documenter.jl</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/documenter.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>6. Interaction with Documenter.jl</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#Interaction-with-Documenter-1" id="Interaction-with-Documenter-1"><strong>6.</strong> Interaction with Documenter.jl</a></h1><p>Literate can be used for any purpose, it spits out regular markdown files, and notebooks. Typically, though, these files will be used to render documentation for your package. The generators (<a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <a href="../outputformats/#Literate.script"><code>Literate.script</code></a>) supports a keyword argument <code>documenter</code> that lets the generator perform some extra things, keeping in mind that the source code have been written with Documenter.jl in mind. So lets take a look at what will happen if we set <code>documenter = true</code>:</p><h3><a class="nav-anchor" href="#[Literate.markdown](@ref):-1" id="[Literate.markdown](@ref):-1"></a><a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>:</h3><ul><li>The default code fence will change from<pre><code class="language-none">```julia
# code # code
```</code></pre>to Documenters <code>@example</code> blocks:<pre><code class="language-none">```@examples $(name) ```</code></pre>to Documenters <code>@example</code> blocks:<pre><code class="language-none">```@examples $(name)
# code # code
```</code></pre></li><li>The following <code>@meta</code> block will be added to the top of the markdown page, which redirects the &quot;Edit on GitHub&quot; link on the top of the page to the <em>source file</em> rather than the generated <code>.md</code> file:<pre><code class="language-none">```@meta ```</code></pre></li><li>The following <code>@meta</code> block will be added to the top of the markdown page, which redirects the "Edit on GitHub" link on the top of the page to the <em>source file</em> rather than the generated <code>.md</code> file:<pre><code class="language-none">```@meta
EditURL = &quot;$(relpath(inputfile, outputdir))&quot; EditURL = "$(relpath(inputfile, outputdir))"
```</code></pre></li></ul><h3><a class="nav-anchor" id="[Literate.notebook](@ref):-1" href="#[Literate.notebook](@ref):-1"><a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a>:</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 notebook.</li><li>Documenter style markdown math<pre><code class="language-none">```math ```</code></pre></li></ul><h3><a class="nav-anchor" href="#[Literate.notebook](@ref):-1" id="[Literate.notebook](@ref):-1"></a><a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></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 notebook.</li><li>Documenter style markdown math<pre><code class="language-none">```math
\int f dx \int f dx
```</code></pre>is replaced with notebook compatible<pre><code class="language-none">\begin{equation} ```</code></pre>is replaced with notebook compatible<pre><code class="language-none">\begin{equation}
\int f dx \int f dx
\end{equation}</code></pre></li></ul><h3><a class="nav-anchor" id="[Literate.script](@ref):-1" href="#[Literate.script](@ref):-1"><a href="../outputformats/#Literate.script"><code>Literate.script</code></a>:</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><footer><hr/><a class="previous" href="../customprocessing/"><span class="direction">Previous</span><span class="title"><strong>5.</strong> Custom pre- and post-processing</span></a><a class="next" href="../generated/example/"><span class="direction">Next</span><span class="title"><strong>7.</strong> Example</span></a></footer></article></body></html> \end{equation}</code></pre></li></ul><h3><a class="nav-anchor" href="#[Literate.script](@ref):-1" id="[Literate.script](@ref):-1"></a><a href="../outputformats/#Literate.script"><code>Literate.script</code></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><footer><hr/><a class="previous" href="../customprocessing/"><span class="direction">Previous</span><span class="title"><strong>5.</strong> Custom pre- and post-processing</span></a><a class="next" href="../generated/example/"><span class="direction">Next</span><span class="title"><strong>7.</strong> Example</span></a></footer></article></body></HTML>

49
v2.0.0/fileformat/index.html

@ -1,5 +1,46 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>2. File Format · Literate.jl</title><link href="https://fredrikekre.github.io/Literate.jl/v2/" rel="canonical"/><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 data-main="../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/><link href="../assets/custom.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>2. File Format · Literate.jl</title><link rel="canonical" href="https://fredrikekre.github.io/Literate.jl/v2/"/><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"/><link href="../assets/custom.css" rel="stylesheet" type="text/css"/></head><body><nav class="toc"><a href="../"><img class="logo" src="../assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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="../"><strong>1.</strong> Introduction</a></li><li class="current"><a class="toctext" href><strong>2.</strong> File Format</a><ul class="internal"><li><a class="toctext" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></li><li><a class="toctext" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</a></li><li><a class="toctext" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></li></ul></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><a class="toctext" href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href><strong>2.</strong> File Format</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/fileformat.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>2. File Format</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="**2.**-File-Format-1" href="#**2.**-File-Format-1"><strong>2.</strong> File Format</a></h1><p>The source file format for Literate is a regular, commented, julia (<code>.jl</code>) scripts. The idea is that the scripts also serve as documentation on their own and it is also simple to include them in the test-suite, with e.g. <code>include</code>, to make sure the examples stay up do date with other changes in your package.</p><h2><a class="nav-anchor" id="Syntax-1" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></h2><p>The basic syntax is simple:</p><ul><li>lines starting with <code>#</code> are treated as markdown,</li><li>all other lines are treated as julia code.</li></ul><p>Leading whitespace is allowed before <code>#</code>, but it will be removed when generating the output. Since <code>#</code>-lines is treated as markdown we can not use that for regular julia comments, for this you can instead use <code>##</code>, which will render as <code>#</code> in the output.</p><p>Lets look at a simple example:</p><pre><code class="language-julia"># # Rational numbers const head = document.getElementsByTagName('head')[0];
// Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="../"><img alt="Literate.jl logo" class="logo" src="../assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="../search/" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="../"><strong>1.</strong> Introduction</a></li><li class="current"><a class="toctext" href=""><strong>2.</strong> File Format</a><ul class="internal"><li><a class="toctext" href="#Syntax-1"><strong>2.1.</strong> Syntax</a></li><li><a class="toctext" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</a></li><li><a class="toctext" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></li></ul></li><li><a class="toctext" href="../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><a class="toctext" href="../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><a class="toctext" href="../generated/example/"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href=""><strong>2.</strong> File Format</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/fileformat.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>2. File Format</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#**2.**-File-Format-1" id="**2.**-File-Format-1"><strong>2.</strong> File Format</a></h1><p>The source file format for Literate is a regular, commented, julia (<code>.jl</code>) scripts. The idea is that the scripts also serve as documentation on their own and it is also simple to include them in the test-suite, with e.g. <code>include</code>, to make sure the examples stay up do date with other changes in your package.</p><h2><a class="nav-anchor" href="#Syntax-1" id="Syntax-1"><strong>2.1.</strong> Syntax</a></h2><p>The basic syntax is simple:</p><ul><li>lines starting with <code>#</code> are treated as markdown,</li><li>all other lines are treated as julia code.</li></ul><p>Leading whitespace is allowed before <code>#</code>, but it will be removed when generating the output. Since <code>#</code>-lines is treated as markdown we can not use that for regular julia comments, for this you can instead use <code>##</code>, which will render as <code>#</code> in the output.</p><p>Lets look at a simple example:</p><pre><code class="language-julia"># # Rational numbers
# #
# In julia rational numbers can be constructed with the `//` operator. # In julia rational numbers can be constructed with the `//` operator.
# Lets define two rational numbers, `x` and `y`: # Lets define two rational numbers, `x` and `y`:
@ -9,9 +50,9 @@ y = 2//5
# When adding `x` and `y` together we obtain a new rational number: # When adding `x` and `y` together we obtain a new rational number:
z = x + y</code></pre><p>In the lines starting with <code>#</code> we can use regular markdown syntax, for example the <code>#</code> used for the heading and the backticks for formatting code. The other lines are regular julia code. We note a couple of things:</p><ul><li>The script is valid julia, which means that we can <code>include</code> it and the example will run (for example in the <code>test/runtests.jl</code> script, to include the example in the test suite).</li><li>The script is &quot;self-explanatory&quot;, i.e. the markdown lines works as comments and thus serve as good documentation on its own.</li></ul><p>For simple use this is all you need to know. The following additional special syntax can also be used:</p><ul><li><code>#md</code>, <code>#nb</code>, <code>#jl</code>, <code>#src</code>: tags to filter lines, see <a href="#Filtering-Lines-1">Filtering Lines</a>,</li><li><code>#-</code> (<code>#+</code>): tag to manually control chunk-splits, see <a href="../pipeline/#Custom-control-over-chunk-splits-1">Custom control over chunk splits</a>.</li></ul><p>There is also some default convenience replacements that will always be performed, see <a href="#Default-Replacements-1">Default Replacements</a>.</p><h2><a class="nav-anchor" id="Filtering-Lines-1" href="#Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</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 &quot;tokens&quot; 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> with one of these tokens are filtered out in the <a href="../pipeline/#Pre-processing-1">preprocessing step</a>.</p><div class="admonition tip"><div class="admonition-title">Tip</div><div class="admonition-text"><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&#39;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><code class="language-julia">#md # ```@docs z = x + y</code></pre><p>In the lines starting with <code>#</code> we can use regular markdown syntax, for example the <code>#</code> used for the heading and the backticks for formatting code. The other lines are regular julia code. We note a couple of things:</p><ul><li>The script is valid julia, which means that we can <code>include</code> it and the example will run (for example in the <code>test/runtests.jl</code> script, to include the example in the test suite).</li><li>The script is "self-explanatory", i.e. the markdown lines works as comments and thus serve as good documentation on its own.</li></ul><p>For simple use this is all you need to know. The following additional special syntax can also be used:</p><ul><li><code>#md</code>, <code>#nb</code>, <code>#jl</code>, <code>#src</code>: tags to filter lines, see <a href="#Filtering-Lines-1">Filtering Lines</a>,</li><li><code>#-</code> (<code>#+</code>): tag to manually control chunk-splits, see <a href="../pipeline/#Custom-control-over-chunk-splits-1">Custom control over chunk splits</a>.</li></ul><p>There is also some default convenience replacements that will always be performed, see <a href="#Default-Replacements-1">Default Replacements</a>.</p><h2><a class="nav-anchor" href="#Filtering-Lines-1" id="Filtering-Lines-1"><strong>2.2.</strong> Filtering Lines</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> with one of these tokens are filtered out in the <a href="../pipeline/#Pre-processing-1">preprocessing step</a>.</p><div class="admonition tip"><div class="admonition-title">Tip</div><div class="admonition-text"><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><code class="language-julia">#md # ```@docs
#md # Literate.markdown #md # Literate.markdown
#md # Literate.notebook #md # Literate.notebook
#md # Literate.markdown #md # Literate.markdown
#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 simple 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><code class="language-julia">using Test #src #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 simple 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><code class="language-julia">using Test #src
@test result == expected_result #src</code></pre><h2><a class="nav-anchor" id="Default-Replacements-1" href="#Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></h2><p>The following convenience &quot;macros&quot; are always expanded:</p><ul><li><p><code>@__NAME__</code></p><p>expands to the <code>name</code> keyword argument to <a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <a href="../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>expands to <code>https://github.com/$(ENV[&quot;TRAVIS_REPO_SLUG&quot;])/blob/master/</code> and is a convenient way to use when you want to link to files outside the doc-build directory. For example <code>@__REPO__ROOT_URL__src/Literate.jl</code> would link to the source of the Literate module.</p></li><li><p><code>@__NBVIEWER_ROOT_URL__</code></p><p>expands to <code>https://nbviewer.jupyter.org/github/$(ENV[&quot;TRAVIS_REPO_SLUG&quot;])/blob/gh-pages/$(folder)/</code> where <code>folder</code> is the folder that <code>Documenter.deploydocs</code> deploys too. This can be used if you want a link that opens the generated notebook in <a href="http://nbviewer.jupyter.org/">http://nbviewer.jupyter.org/</a>.</p></li><li><p><code>@__BINDER_ROOT_URL__</code></p><p>expands to <code>https://mybinder.org/v2/gh/$(ENV[&quot;TRAVIS_REPO_SLUG&quot;])/$(branch)?filepath=$(folder)/</code> where <code>branch</code>/<code>folder</code> is the branch and folder where <code>Documenter.deploydocs</code> deploys too. This can be used if you want a link that opens the generated notebook in <a href="https://mybinder.org/">https://mybinder.org/</a>. To add a binder-badge in e.g. the HTML output you can use:</p><pre><code class="language-none">[![Binder](https://mybinder.org/badge_logo.svg)](@__BINDER_ROOT_URL__path/to/notebook.inpynb)</code></pre></li></ul><footer><hr/><a class="previous" href="../"><span class="direction">Previous</span><span class="title"><strong>1.</strong> Introduction</span></a><a class="next" href="../pipeline/"><span class="direction">Next</span><span class="title"><strong>3.</strong> Processing pipeline</span></a></footer></article></body></html> @test result == expected_result #src</code></pre><h2><a class="nav-anchor" href="#Default-Replacements-1" id="Default-Replacements-1"><strong>2.3.</strong> Default Replacements</a></h2><p>The following convenience "macros" are always expanded:</p><ul><li><p><code>@__NAME__</code></p><p>expands to the <code>name</code> keyword argument to <a href="../outputformats/#Literate.markdown"><code>Literate.markdown</code></a>, <a href="../outputformats/#Literate.notebook"><code>Literate.notebook</code></a> and <a href="../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>expands to <code>https://github.com/$(ENV["TRAVIS_REPO_SLUG"])/blob/master/</code> and is a convenient way to use when you want to link to files outside the doc-build directory. For example <code>@__REPO__ROOT_URL__src/Literate.jl</code> would link to the source of the Literate module.</p></li><li><p><code>@__NBVIEWER_ROOT_URL__</code></p><p>expands to <code>https://nbviewer.jupyter.org/github/$(ENV["TRAVIS_REPO_SLUG"])/blob/gh-pages/$(folder)/</code> where <code>folder</code> is the folder that <code>Documenter.deploydocs</code> deploys too. This can be used if you want a link that opens the generated notebook in <a href="http://nbviewer.jupyter.org/">http://nbviewer.jupyter.org/</a>.</p></li><li><p><code>@__BINDER_ROOT_URL__</code></p><p>expands to <code>https://mybinder.org/v2/gh/$(ENV["TRAVIS_REPO_SLUG"])/$(branch)?filepath=$(folder)/</code> where <code>branch</code>/<code>folder</code> is the branch and folder where <code>Documenter.deploydocs</code> deploys too. This can be used if you want a link that opens the generated notebook in <a href="https://mybinder.org/">https://mybinder.org/</a>. To add a binder-badge in e.g. the HTML output you can use:</p><pre><code class="language-none">[![Binder](https://mybinder.org/badge_logo.svg)](@__BINDER_ROOT_URL__path/to/notebook.inpynb)</code></pre></li></ul><footer><hr/><a class="previous" href="../"><span class="direction">Previous</span><span class="title"><strong>1.</strong> Introduction</span></a><a class="next" href="../pipeline/"><span class="direction">Next</span><span class="title"><strong>3.</strong> Processing pipeline</span></a></footer></article></body></HTML>

188
v2.0.0/generated/example/index.html

@ -1,7 +1,48 @@
<!DOCTYPE html> <!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>7. Example · Literate.jl</title><link href="https://fredrikekre.github.io/Literate.jl/v2/" rel="canonical"/><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 data-main="../../assets/documenter.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script><script src="../../siteinfo.js"></script><script src="../../../versions.js"></script><link href="../../assets/documenter.css" rel="stylesheet" type="text/css"/><link href="../../assets/custom.css" rel="stylesheet" type="text/css"/><script data-outdated-warner="">function maybeAddWarning () {
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>7. Example · Literate.jl</title><link rel="canonical" href="https://fredrikekre.github.io/Literate.jl/v2/"/><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"/><link href="../../assets/custom.css" rel="stylesheet" type="text/css"/></head><body><nav class="toc"><a href="../../"><img class="logo" src="../../assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.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="../../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><a class="toctext" href="../../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li class="current"><a class="toctext" href><strong>7.</strong> Example</a><ul class="internal"></ul></li></ul></nav><article id="docs"><header><nav><ul><li><a href><strong>7.</strong> Example</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>7. Example</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="**7.**-Example-1" href="#**7.**-Example-1"><strong>7.</strong> Example</a></h1><p><a href="https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=v2.0.0/generated/example.ipynb"><img src="https://mybinder.org/badge_logo.svg" alt/></a> <a href="https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v2.0.0/generated/example.ipynb"><img src="https://img.shields.io/badge/show-nbviewer-579ACA.svg" alt/></a></p><p>This is an example generated with Literate based on this source file: <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><code>example.jl</code></a>. You are seeing the HTML-output which Documenter have generated based on a markdown file generated with Literate. The corresponding notebook can be viewed in <a href="http://nbviewer.jupyter.org/">nbviewer</a> here: <a href="https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v2.0.0/generated/example.ipynb"><code>example.ipynb</code></a>, and opened in <a href="https://mybinder.org/">binder</a> here: <a href="https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=v2.0.0/generated/example.ipynb"><code>example.ipynb</code></a>, and the plain script output can be found here: <a href="../example.jl"><code>example.jl</code></a>.</p><p>It is recommended to have the <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl">source file</a> available when reading this, to better understand how the syntax in the source file corresponds to the output you are seeing.</p><h3><a class="nav-anchor" id="Basic-syntax-1" href="#Basic-syntax-1">Basic syntax</a></h3><p>The basic syntax for Literate is simple, lines starting with <code>#</code> is interpreted as markdown, and all the other lines are interpreted as code. Here is some code:</p><pre><code class="language-julia">x = 1//3 const head = document.getElementsByTagName('head')[0];
y = 2//5</code></pre><pre><code class="language-none">2//5</code></pre><p>In markdown sections we can use markdown syntax. For example, we can write <em>text in italic font</em>, <strong>text in bold font</strong> and use <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">links</a>.</p><p>It is possible to filter out lines depending on the output using the <code>#md</code>, <code>#nb</code>, <code>#jl</code> and <code>#src</code> tags (see <a href="../../fileformat/#Filtering-Lines-1">Filtering Lines</a>):</p><ul><li>This line starts with <code>#md</code> and is thus only visible in the markdown output.</li></ul><p>The source file is parsed in chunks of markdown and code. Starting a line with <code>#-</code> manually inserts a chunk break. For example, if we want to display the output of the following operations we may insert <code>#-</code> in between. These two code blocks will now end up in different <code>@example</code>-blocks in the markdown output, and two different notebook cells in the notebook output.</p><pre><code class="language-julia">x + y</code></pre><pre><code class="language-none">11//15</code></pre><pre><code class="language-julia">x * y</code></pre><pre><code class="language-none">2//15</code></pre><h3><a class="nav-anchor" id="Output-Capturing-1" href="#Output-Capturing-1">Output Capturing</a></h3><p>Code chunks are by default placed in Documenter <code>@example</code> blocks in the generated markdown. This means that the output will be captured in a block when Documenter is building the docs. In notebooks the output is captured in output cells, if the <code>execute</code> keyword argument is set to true. Output to <code>stdout</code>/<code>stderr</code> is also captured.</p><div class="admonition note"><div class="admonition-title">Note</div><div class="admonition-text"><p>Note that Documenter currently only displays output to <code>stdout</code>/<code>stderr</code> if there is no other result to show. Since the vector <code>[1, 2, 3, 4]</code> is returned from <code>foo</code>, the printing of <code>&quot;This string is printed to stdout.&quot;</code> is hidden.</p></div></div><pre><code class="language-julia">function foo()
println(&quot;This string is printed to stdout.&quot;) // Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs.
if (document.body.querySelector('meta[name="robots"]') === null) {
const meta = document.createElement('meta');
meta.name = 'robots';
meta.content = 'noindex';
head.appendChild(meta);
};
// Add a stylesheet to avoid inline styling
const style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode('.outdated-warning-overlay { position: fixed; top: 0; left: 0; right: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 999; background-color: #ffaba7; color: rgba(0, 0, 0, 0.7); border-bottom: 3px solid #da0b00; padding: 10px 35px; text-align: center; font-size: 15px; } .outdated-warning-overlay .outdated-warning-closer { position: absolute; top: calc(50% - 10px); right: 18px; cursor: pointer; width: 12px; } .outdated-warning-overlay a { color: #2e63b8; } .outdated-warning-overlay a:hover { color: #363636; }'));
head.appendChild(style);
const div = document.createElement('div');
div.classList.add('outdated-warning-overlay');
const closer = document.createElement('div');
closer.classList.add('outdated-warning-closer');
// Icon by font-awesome (license: https://fontawesome.com/license, link: https://fontawesome.com/icons/times?style=solid)
closer.innerHTML = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>';
closer.addEventListener('click', function () {
document.body.removeChild(div);
});
let href = '/stable';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../stable';
}
div.innerHTML = 'This is an old version of the documentation. <br> <a href="' + href + '">Go to the newest version</a>.';
div.appendChild(closer);
document.body.appendChild(div);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', maybeAddWarning);
} else {
maybeAddWarning();
};
</script></head><body><nav class="toc"><a href="../../"><img alt="Literate.jl logo" class="logo" src="../../assets/logo.png"/></a><h1>Literate.jl</h1><select id="version-selector" onchange="window.location.href=this.value" style="visibility: hidden"></select><form action="../../search/" class="search" id="search-form"><input id="search-query" name="q" placeholder="Search docs" type="text"/></form><ul><li><a class="toctext" href="../../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><a class="toctext" href="../../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li class="current"><a class="toctext" href=""><strong>7.</strong> Example</a><ul class="internal"></ul></li></ul></nav><article id="docs"><header><nav><ul><li><a href=""><strong>7.</strong> Example</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>7. Example</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" href="#**7.**-Example-1" id="**7.**-Example-1"><strong>7.</strong> Example</a></h1><p><a href="https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=v2.0.0/generated/example.ipynb"><img alt="" src="https://mybinder.org/badge_logo.svg"/></a><a href="https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v2.0.0/generated/example.ipynb"><img alt="" src="https://img.shields.io/badge/show-nbviewer-579ACA.svg"/></a></p><p>This is an example generated with Literate based on this source file: <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl"><code>example.jl</code></a>. You are seeing the HTML-output which Documenter have generated based on a markdown file generated with Literate. The corresponding notebook can be viewed in <a href="http://nbviewer.jupyter.org/">nbviewer</a> here: <a href="https://nbviewer.jupyter.org/github/fredrikekre/Literate.jl/blob/gh-pages/v2.0.0/generated/example.ipynb"><code>example.ipynb</code></a>, and opened in <a href="https://mybinder.org/">binder</a> here: <a href="https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=v2.0.0/generated/example.ipynb"><code>example.ipynb</code></a>, and the plain script output can be found here: <a href="../example.jl"><code>example.jl</code></a>.</p><p>It is recommended to have the <a href="https://github.com/fredrikekre/Literate.jl/blob/master/examples/example.jl">source file</a> available when reading this, to better understand how the syntax in the source file corresponds to the output you are seeing.</p><h3><a class="nav-anchor" href="#Basic-syntax-1" id="Basic-syntax-1">Basic syntax</a></h3><p>The basic syntax for Literate is simple, lines starting with <code>#</code> is interpreted as markdown, and all the other lines are interpreted as code. Here is some code:</p><pre><code class="language-julia">x = 1//3
y = 2//5</code></pre><pre><code class="language-none">2//5</code></pre><p>In markdown sections we can use markdown syntax. For example, we can write <em>text in italic font</em>, <strong>text in bold font</strong> and use <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">links</a>.</p><p>It is possible to filter out lines depending on the output using the <code>#md</code>, <code>#nb</code>, <code>#jl</code> and <code>#src</code> tags (see <a href="../../fileformat/#Filtering-Lines-1">Filtering Lines</a>):</p><ul><li>This line starts with <code>#md</code> and is thus only visible in the markdown output.</li></ul><p>The source file is parsed in chunks of markdown and code. Starting a line with <code>#-</code> manually inserts a chunk break. For example, if we want to display the output of the following operations we may insert <code>#-</code> in between. These two code blocks will now end up in different <code>@example</code>-blocks in the markdown output, and two different notebook cells in the notebook output.</p><pre><code class="language-julia">x + y</code></pre><pre><code class="language-none">11//15</code></pre><pre><code class="language-julia">x * y</code></pre><pre><code class="language-none">2//15</code></pre><h3><a class="nav-anchor" href="#Output-Capturing-1" id="Output-Capturing-1">Output Capturing</a></h3><p>Code chunks are by default placed in Documenter <code>@example</code> blocks in the generated markdown. This means that the output will be captured in a block when Documenter is building the docs. In notebooks the output is captured in output cells, if the <code>execute</code> keyword argument is set to true. Output to <code>stdout</code>/<code>stderr</code> is also captured.</p><div class="admonition note"><div class="admonition-title">Note</div><div class="admonition-text"><p>Note that Documenter currently only displays output to <code>stdout</code>/<code>stderr</code> if there is no other result to show. Since the vector <code>[1, 2, 3, 4]</code> is returned from <code>foo</code>, the printing of <code>"This string is printed to stdout."</code> is hidden.</p></div></div><pre><code class="language-julia">function foo()
println("This string is printed to stdout.")
return [1, 2, 3, 4] return [1, 2, 3, 4]
end end
@ -9,121 +50,55 @@ foo()</code></pre><pre><code class="language-none">4-element Array{Int64,1}:
1 1
2 2
3 3
4</code></pre><p>Both Documenter&#39;s <code>@example</code> block and notebooks can display images. Here is an example where we generate a simple plot using the <a href="https://github.com/JuliaPlots/Plots.jl">Plots.jl</a> package</p><pre><code class="language-julia">using Plots 4</code></pre><p>Both Documenter's <code>@example</code> block and notebooks can display images. Here is an example where we generate a simple plot using the <a href="https://github.com/JuliaPlots/Plots.jl">Plots.jl</a> package</p><pre><code class="language-julia">using Plots
x = range(0, stop=6π, length=1000) x = range(0, stop=6π, length=1000)
y1 = sin.(x) y1 = sin.(x)
y2 = cos.(x) y2 = cos.(x)
plot(x, [y1, y2])</code></pre><?xml version="1.0" encoding="utf-8"?> plot(x, [y1, y2])</code></pre><svg height="400" viewBox="0 0 2400 1600" width="600" xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"><defs><clipPath id="clip1700"><rect height="1600" width="2400" x="0" y="0"></rect></clipPath></defs><polygon clip-path="url(#clip1700)" fill="#ffffff" fill-opacity="1" fill-rule="evenodd" points="
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="600" height="400" viewBox="0 0 2400 1600">
<defs>
<clipPath id="clip1700">
<rect x="0" y="0" width="2400" height="1600"/>
</clipPath>
</defs>
<polygon clip-path="url(#clip1700)" points="
0,1600 2400,1600 2400,0 0,0 0,1600 2400,1600 2400,0 0,0
" fill="#ffffff" fill-rule="evenodd" fill-opacity="1"/> "></polygon><defs><clipPath id="clip1701"><rect height="1600" width="1681" x="480" y="0"></rect></clipPath></defs><polygon clip-path="url(#clip1700)" fill="#ffffff" fill-opacity="1" fill-rule="evenodd" points="
<defs>
<clipPath id="clip1701">
<rect x="480" y="0" width="1681" height="1600"/>
</clipPath>
</defs>
<polygon clip-path="url(#clip1700)" points="
86.9921,1521.01 2352.76,1521.01 2352.76,47.2441 86.9921,47.2441 86.9921,1521.01 2352.76,1521.01 2352.76,47.2441 86.9921,47.2441
" fill="#ffffff" fill-rule="evenodd" fill-opacity="1"/> "></polygon><defs><clipPath id="clip1702"><rect height="1475" width="2267" x="86" y="47"></rect></clipPath></defs><polyline clip-path="url(#clip1702)" points="
<defs>
<clipPath id="clip1702">
<rect x="86" y="47" width="2267" height="1475"/>
</clipPath>
</defs>
<polyline clip-path="url(#clip1702)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
151.118,1521.01 151.118,47.2441 151.118,1521.01 151.118,47.2441
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip1702)" points="
<polyline clip-path="url(#clip1702)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
718.11,1521.01 718.11,47.2441 718.11,1521.01 718.11,47.2441
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip1702)" points="
<polyline clip-path="url(#clip1702)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
1285.1,1521.01 1285.1,47.2441 1285.1,1521.01 1285.1,47.2441
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip1702)" points="
<polyline clip-path="url(#clip1702)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
1852.1,1521.01 1852.1,47.2441 1852.1,1521.01 1852.1,47.2441
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip1702)" points="
<polyline clip-path="url(#clip1702)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
86.9921,1479.31 2352.76,1479.31 86.9921,1479.31 2352.76,1479.31
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip1702)" points="
<polyline clip-path="url(#clip1702)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
86.9921,1131.72 2352.76,1131.72 86.9921,1131.72 2352.76,1131.72
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip1702)" points="
<polyline clip-path="url(#clip1702)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
86.9921,784.13 2352.76,784.13 86.9921,784.13 2352.76,784.13
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip1702)" points="
<polyline clip-path="url(#clip1702)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
86.9921,436.542 2352.76,436.542 86.9921,436.542 2352.76,436.542
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip1702)" points="
<polyline clip-path="url(#clip1702)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
86.9921,88.9544 2352.76,88.9544 86.9921,88.9544 2352.76,88.9544
"/> " style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none"></polyline><polyline clip-path="url(#clip1700)" points="
<polyline clip-path="url(#clip1700)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
86.9921,1521.01 2352.76,1521.01 86.9921,1521.01 2352.76,1521.01
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip1700)" points="
<polyline clip-path="url(#clip1700)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
86.9921,1521.01 86.9921,47.2441 86.9921,1521.01 86.9921,47.2441
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip1700)" points="
<polyline clip-path="url(#clip1700)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
151.118,1521.01 151.118,1498.9 151.118,1521.01 151.118,1498.9
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip1700)" points="
<polyline clip-path="url(#clip1700)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
718.11,1521.01 718.11,1498.9 718.11,1521.01 718.11,1498.9
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip1700)" points="
<polyline clip-path="url(#clip1700)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
1285.1,1521.01 1285.1,1498.9 1285.1,1521.01 1285.1,1498.9
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip1700)" points="
<polyline clip-path="url(#clip1700)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
1852.1,1521.01 1852.1,1498.9 1852.1,1521.01 1852.1,1498.9
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip1700)" points="
<polyline clip-path="url(#clip1700)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
86.9921,1479.31 120.979,1479.31 86.9921,1479.31 120.979,1479.31
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip1700)" points="
<polyline clip-path="url(#clip1700)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
86.9921,1131.72 120.979,1131.72 86.9921,1131.72 120.979,1131.72
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip1700)" points="
<polyline clip-path="url(#clip1700)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
86.9921,784.13 120.979,784.13 86.9921,784.13 120.979,784.13
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip1700)" points="
<polyline clip-path="url(#clip1700)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
86.9921,436.542 120.979,436.542 86.9921,436.542 120.979,436.542
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip1700)" points="
<polyline clip-path="url(#clip1700)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
86.9921,88.9544 120.979,88.9544 86.9921,88.9544 120.979,88.9544
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><g clip-path="url(#clip1700)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 151.118, 1575.01)" x="151.118" y="1575.01">0</text></g><g clip-path="url(#clip1700)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 718.11, 1575.01)" x="718.11" y="1575.01">5</text></g><g clip-path="url(#clip1700)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 1285.1, 1575.01)" x="1285.1" y="1575.01">10</text></g><g clip-path="url(#clip1700)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 1852.1, 1575.01)" x="1852.1" y="1575.01">15</text></g><g clip-path="url(#clip1700)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 62.9921, 1496.81)" x="62.9921" y="1496.81">-1.0</text></g><g clip-path="url(#clip1700)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 62.9921, 1149.22)" x="62.9921" y="1149.22">-0.5</text></g><g clip-path="url(#clip1700)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 62.9921, 801.63)" x="62.9921" y="801.63">0.0</text></g><g clip-path="url(#clip1700)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 62.9921, 454.042)" x="62.9921" y="454.042">0.5</text></g><g clip-path="url(#clip1700)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 62.9921, 106.454)" x="62.9921" y="106.454">1.0</text></g><polyline clip-path="url(#clip1702)" points="
<g clip-path="url(#clip1700)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 151.118, 1575.01)" x="151.118" y="1575.01">0</text>
</g>
<g clip-path="url(#clip1700)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 718.11, 1575.01)" x="718.11" y="1575.01">5</text>
</g>
<g clip-path="url(#clip1700)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 1285.1, 1575.01)" x="1285.1" y="1575.01">10</text>
</g>
<g clip-path="url(#clip1700)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 1852.1, 1575.01)" x="1852.1" y="1575.01">15</text>
</g>
<g clip-path="url(#clip1700)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 62.9921, 1496.81)" x="62.9921" y="1496.81">-1.0</text>
</g>
<g clip-path="url(#clip1700)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 62.9921, 1149.22)" x="62.9921" y="1149.22">-0.5</text>
</g>
<g clip-path="url(#clip1700)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 62.9921, 801.63)" x="62.9921" y="801.63">0.0</text>
</g>
<g clip-path="url(#clip1700)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 62.9921, 454.042)" x="62.9921" y="454.042">0.5</text>
</g>
<g clip-path="url(#clip1700)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 62.9921, 106.454)" x="62.9921" y="106.454">1.0</text>
</g>
<polyline clip-path="url(#clip1702)" style="stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none" points="
151.118,784.13 153.257,771.014 155.397,757.902 157.536,744.8 159.676,731.712 161.816,718.643 163.955,705.597 166.095,692.579 168.235,679.593 170.374,666.645 151.118,784.13 153.257,771.014 155.397,757.902 157.536,744.8 159.676,731.712 161.816,718.643 163.955,705.597 166.095,692.579 168.235,679.593 170.374,666.645
172.514,653.738 174.654,640.878 176.793,628.069 178.933,615.315 181.073,602.622 183.212,589.993 185.352,577.433 187.492,564.947 189.631,552.539 191.771,540.214 172.514,653.738 174.654,640.878 176.793,628.069 178.933,615.315 181.073,602.622 183.212,589.993 185.352,577.433 187.492,564.947 189.631,552.539 191.771,540.214
193.911,527.975 196.05,515.827 198.19,503.775 200.33,491.823 202.469,479.975 204.609,468.235 206.748,456.607 208.888,445.096 211.028,433.706 213.167,422.441 193.911,527.975 196.05,515.827 198.19,503.775 200.33,491.823 202.469,479.975 204.609,468.235 206.748,456.607 208.888,445.096 211.028,433.706 213.167,422.441
@ -225,8 +200,7 @@ plot(x, [y1, y2])</code></pre><?xml version="1.0" encoding="utf-8"?>
2247.98,1028.05 2250.12,1015.72 2252.26,1003.31 2254.4,990.826 2256.54,978.267 2258.68,965.638 2260.82,952.944 2262.95,940.191 2265.09,927.382 2267.23,914.522 2247.98,1028.05 2250.12,1015.72 2252.26,1003.31 2254.4,990.826 2256.54,978.267 2258.68,965.638 2260.82,952.944 2262.95,940.191 2265.09,927.382 2267.23,914.522
2269.37,901.615 2271.51,888.667 2273.65,875.681 2275.79,862.663 2277.93,849.617 2280.07,836.548 2282.21,823.459 2284.35,810.357 2286.49,797.246 2288.63,784.13 2269.37,901.615 2271.51,888.667 2273.65,875.681 2275.79,862.663 2277.93,849.617 2280.07,836.548 2282.21,823.459 2284.35,810.357 2286.49,797.246 2288.63,784.13
"/> " style="stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip1702)" points="
<polyline clip-path="url(#clip1702)" style="stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none" points="
151.118,88.9544 153.257,89.0781 155.397,89.4493 157.536,90.0678 159.676,90.9334 161.816,92.0458 163.955,93.4045 166.095,95.0092 168.235,96.8592 170.374,98.9539 151.118,88.9544 153.257,89.0781 155.397,89.4493 157.536,90.0678 159.676,90.9334 161.816,92.0458 163.955,93.4045 166.095,95.0092 168.235,96.8592 170.374,98.9539
172.514,101.292 174.654,103.874 176.793,106.698 178.933,109.763 181.073,113.068 183.212,116.612 185.352,120.394 187.492,124.412 189.631,128.665 191.771,133.151 172.514,101.292 174.654,103.874 176.793,106.698 178.933,109.763 181.073,113.068 183.212,116.612 185.352,120.394 187.492,124.412 189.631,128.665 191.771,133.151
193.911,137.869 196.05,142.817 198.19,147.993 200.33,153.396 202.469,159.023 204.609,164.873 206.748,170.943 208.888,177.232 211.028,183.737 213.167,190.455 193.911,137.869 196.05,142.817 198.19,147.993 200.33,153.396 202.469,159.023 204.609,164.873 206.748,170.943 208.888,177.232 211.028,183.737 213.167,190.455
@ -328,24 +302,12 @@ plot(x, [y1, y2])</code></pre><?xml version="1.0" encoding="utf-8"?>
2247.98,133.151 2250.12,128.665 2252.26,124.412 2254.4,120.394 2256.54,116.612 2258.68,113.068 2260.82,109.763 2262.95,106.698 2265.09,103.874 2267.23,101.292 2247.98,133.151 2250.12,128.665 2252.26,124.412 2254.4,120.394 2256.54,116.612 2258.68,113.068 2260.82,109.763 2262.95,106.698 2265.09,103.874 2267.23,101.292
2269.37,98.9539 2271.51,96.8592 2273.65,95.0092 2275.79,93.4045 2277.93,92.0458 2280.07,90.9334 2282.21,90.0678 2284.35,89.4493 2286.49,89.0781 2288.63,88.9544 2269.37,98.9539 2271.51,96.8592 2273.65,95.0092 2275.79,93.4045 2277.93,92.0458 2280.07,90.9334 2282.21,90.0678 2284.35,89.4493 2286.49,89.0781 2288.63,88.9544
"/> " style="stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polygon clip-path="url(#clip1700)" fill="#ffffff" fill-opacity="1" fill-rule="evenodd" points="
<polygon clip-path="url(#clip1700)" points="
1989.93,312.204 2280.76,312.204 2280.76,130.764 1989.93,130.764 1989.93,312.204 2280.76,312.204 2280.76,130.764 1989.93,130.764
" fill="#ffffff" fill-rule="evenodd" fill-opacity="1"/> "></polygon><polyline clip-path="url(#clip1700)" points="
<polyline clip-path="url(#clip1700)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
1989.93,312.204 2280.76,312.204 2280.76,130.764 1989.93,130.764 1989.93,312.204 1989.93,312.204 2280.76,312.204 2280.76,130.764 1989.93,130.764 1989.93,312.204
"/> " style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none"></polyline><polyline clip-path="url(#clip1700)" points="
<polyline clip-path="url(#clip1700)" style="stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none" points="
2013.93,191.244 2157.93,191.244 2013.93,191.244 2157.93,191.244
"/> " style="stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none"></polyline><g clip-path="url(#clip1700)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;" transform="rotate(0, 2181.93, 208.744)" x="2181.93" y="208.744">y1</text></g><polyline clip-path="url(#clip1700)" points="
<g clip-path="url(#clip1700)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;" transform="rotate(0, 2181.93, 208.744)" x="2181.93" y="208.744">y1</text>
</g>
<polyline clip-path="url(#clip1700)" style="stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none" points="
2013.93,251.724 2157.93,251.724 2013.93,251.724 2157.93,251.724
"/> " style="stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none"></polyline><g clip-path="url(#clip1700)"><text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;" transform="rotate(0, 2181.93, 269.224)" x="2181.93" y="269.224">y2</text></g></svg><h3><a class="nav-anchor" href="#Custom-processing-1" id="Custom-processing-1">Custom processing</a></h3><p>It is possible to give Literate custom pre- and post-processing functions. For example, here we insert two placeholders, which we will replace with something else at time of generation. We have here replaced our placeholders with <code>z</code> and <code>1.0 + 2.0im</code>:</p><pre><code class="language-julia">z = 1.0 + 2.0im</code></pre><pre><code class="language-none">1.0 + 2.0im</code></pre><h3><a class="nav-anchor" href="#documenter-interaction-1" id="documenter-interaction-1">Documenter.jl interaction</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, <a href="#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><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p><footer><hr/><a class="previous" href="../../documenter/"><span class="direction">Previous</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></HTML>
<g clip-path="url(#clip1700)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;" transform="rotate(0, 2181.93, 269.224)" x="2181.93" y="269.224">y2</text>
</g>
</svg>
<h3><a class="nav-anchor" id="Custom-processing-1" href="#Custom-processing-1">Custom processing</a></h3><p>It is possible to give Literate custom pre- and post-processing functions. For example, here we insert two placeholders, which we will replace with something else at time of generation. We have here replaced our placeholders with <code>z</code> and <code>1.0 + 2.0im</code>:</p><pre><code class="language-julia">z = 1.0 + 2.0im</code></pre><pre><code class="language-none">1.0 + 2.0im</code></pre><h3><a class="nav-anchor" id="documenter-interaction-1" href="#documenter-interaction-1">Documenter.jl interaction</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, <a href="#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><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p><footer><hr/><a class="previous" href="../../documenter/"><span class="direction">Previous</span><span class="title"><strong>6.</strong> Interaction with Documenter.jl</span></a></footer></article></body></html>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save