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

43 lines
11 KiB

<!DOCTYPE html><HTML lang="en"><head><meta charset="UTF-8"/><meta content="width=device-width, initial-scale=1.0" name="viewport"/><title>1. Introduction · Literate.jl</title><link href="https://fredrikekre.github.io/Literate.jl/v2/" rel="canonical"/><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/5.11.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/katex.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.3.6/require.min.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/custom.css" rel="stylesheet" type="text/css"/><link href="assets/favicon.ico" rel="icon" type="image/x-icon"/><link class="docs-theme-link" data-theme-name="documenter-dark" href="assets/themes/documenter-dark.css" rel="stylesheet" type="text/css"/><link class="docs-theme-link" data-theme-name="documenter-light" data-theme-primary="" href="assets/themes/documenter-light.css" rel="stylesheet" type="text/css"/><script src="assets/themeswap.js"></script><script data-outdated-warner="">function maybeAddWarning () {
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 = '/';
if (window.documenterBaseURL) {
href = window.documenterBaseURL + '/../';
}
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><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href=""><img alt="Literate.jl logo" src="assets/logo.png"/></a><div class="docs-package-name"><span class="docs-autofit">Literate.jl</span></div><form action="search/" class="docs-search"><input class="docs-search-query" id="documenter-search-query" name="q" placeholder="Search docs" type="text"/></form><ul class="docs-menu"><li class="is-active"><a class="tocitem" href=""><strong>1.</strong> Introduction</a></li><li><a class="tocitem" href="fileformat/"><strong>2.</strong> File Format</a></li><li><a class="tocitem" href="pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="tocitem" href="outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="tocitem" href="customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><a class="tocitem" href="documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><a class="tocitem" href="tips/"><strong>7.</strong> Tips and Tricks</a></li><li><a class="tocitem" href="generated/example/"><strong>8.</strong> Example</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href=""><strong>1.</strong> Introduction</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href=""><strong>1.</strong> Introduction</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/index.md" title="Edit on GitHub"><span class="docs-icon fab"></span><span class="docs-label is-hidden-touch">Edit on GitHub</span></a><a class="docs-settings-button fas fa-cog" href="#" id="documenter-settings-button" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" href="#" id="documenter-sidebar-button"></a></div></header><article class="content" id="documenter-page"><h1 id="Introduction"><a class="docs-heading-anchor" href="#Introduction"><strong>1.</strong> Introduction</a><a id="Introduction-1"></a><a class="docs-heading-anchor-permalink" href="#Introduction" title="Permalink"></a></h1><p>Welcome to the documentation for Literate – a simplistic package for <a href="https://en.wikipedia.org/wiki/Literate_programming">Literate Programming</a>.</p><h3 id="What?"><a class="docs-heading-anchor" href="#What?">What?</a><a id="What?-1"></a><a class="docs-heading-anchor-permalink" href="#What?" title="Permalink"></a></h3><p>Literate is a package that generates markdown pages (for e.g. <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a>), and <a href="http://jupyter.org/">Jupyter notebooks</a>, from the same source file. There is also an option to "clean" the source from all metadata, and produce a pure Julia script.</p><p>The main design goal is simplicity. It should be simple to use, and the syntax should be simple. In short, all you have to do is to write a commented julia script!</p><p>The public interface consists of three functions, all of which take the same script file as input, but generate different output:</p><ul><li><a href="outputformats/#Literate.markdown"><code>Literate.markdown</code></a> generates a markdown file. Code snippets can be executed and the results included in the output.</li><li><a href="outputformats/#Literate.notebook"><code>Literate.notebook</code></a> generates a notebook. Code snippets can be executed and the results included in the output.</li><li><a href="outputformats/#Literate.script"><code>Literate.script</code></a> generates a plain script file scrubbed from all metadata and special syntax.</li></ul><h3 id="Why?"><a class="docs-heading-anchor" href="#Why?">Why?</a><a id="Why?-1"></a><a class="docs-heading-anchor-permalink" href="#Why?" title="Permalink"></a></h3><p>Examples are (probably) the best way to showcase your awesome package, and examples are often the best way for a new user to learn how to use it. It is therefore important that the documentation of your package contains examples for users to read and study. However, people are different, and we all prefer different ways of trying out a new package. Some people wants to RTFM, others want to explore the package interactively in, for example, a notebook, and some people wants to study the source code. The aim of Literate is to make it easy to give the user all of these options, while still keeping maintenance to a minimum.</p><p>It is quite common that packages have "example notebooks" to showcase the package. Notebooks are great for showcasing a package, but they are not so great with version control, like git. The reason being that a notebook is a very "rich" format since it contains output and other metadata. Changes to the notebook thus result in large diffs, which makes it harder to review the actual changes.</p><p>It is also common that packages include examples in the documentation, for example by using <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a><code>@example</code>-blocks. This is also great, but it is not quite as interactive as a notebook, for the users who prefer that.</p><p>Literate tries to solve the problems above by creating the output as a part of the doc build. Literate generates the output based on a single source file which makes it easier to maintain, test, and keep the manual and your example notebooks in sync.</p></article><nav class="docs-footer"><a class="docs-footer-nextpage" href="fileformat/"><strong>2.</strong> File Format »</a></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label></p><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div><p></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Thursday 14 May 2020 11:37">Thursday 14 May 2020</span>. Using Julia version 1.4.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></HTML>