From cee6cf1a3a3c1287d669aab06c0ac38a84ed3f85 Mon Sep 17 00:00:00 2001 From: zeptodoctor <44736852+zeptodoctor@users.noreply.github.com> Date: Sat, 16 Nov 2019 00:17:22 +0000 Subject: [PATCH] build based on 4d9270e --- dev/assets/documenter.js | 6 +- dev/assets/themes/documenter-dark.css | 55 ++++-- dev/assets/themes/documenter-light.css | 259 ++++++++----------------- dev/customprocessing.html | 4 +- dev/documenter.html | 4 +- dev/fileformat.html | 4 +- dev/generated/example.html | 88 ++++----- dev/generated/example.ipynb | 168 ++++++++-------- dev/generated/name.html | 2 +- dev/index.html | 2 +- dev/outputformats.html | 6 +- dev/pipeline.html | 4 +- dev/search.html | 2 +- 13 files changed, 265 insertions(+), 339 deletions(-) diff --git a/dev/assets/documenter.js b/dev/assets/documenter.js index 8370e15..a497303 100644 --- a/dev/assets/documenter.js +++ b/dev/assets/documenter.js @@ -1,15 +1,15 @@ // Generated by Documenter.jl requirejs.config({ paths: { - 'highlight-julia': 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.10/languages/julia.min', + 'highlight-julia': 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.9/languages/julia.min', 'headroom': 'https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min', 'jqueryui': 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.0/jquery-ui.min', 'katex-auto-render': 'https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.10.2/contrib/auto-render.min', 'jquery': 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min', 'headroom-jquery': 'https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min', 'katex': 'https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.10.2/katex.min', - 'highlight': 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.10/highlight.min', - 'highlight-julia-repl': 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.10/languages/julia-repl.min', + 'highlight': 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.9/highlight.min', + 'highlight-julia-repl': 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.9/languages/julia-repl.min', }, shim: { "highlight-julia": { diff --git a/dev/assets/themes/documenter-dark.css b/dev/assets/themes/documenter-dark.css index 301d4ef..123a465 100644 --- a/dev/assets/themes/documenter-dark.css +++ b/dev/assets/themes/documenter-dark.css @@ -1070,9 +1070,38 @@ html.theme--documenter-dark { * * The main container is
that is identified by id #documenter. */ - /* a11y-dark theme */ - /* Based on the Tomorrow Night Eighties theme: https://github.com/isagalaev/highlight.js/blob/master/src/styles/tomorrow-night-eighties.css */ - /* @author: ericwbailey */ + /* a11y-dark theme + * Based on the Tomorrow Night Eighties theme: + * https://github.com/isagalaev/highlight.js/blob/master/src/styles/tomorrow-night-eighties.css + * @author: ericwbailey + * + * Copied from: https://github.com/highlightjs/highlight.js + * + * Copyright (c) 2006, Ivan Sagalaev + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of highlight.js nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ /* Comment */ /* Red */ /* Orange */ @@ -1127,7 +1156,7 @@ html.theme--documenter-dark { color: #e74c3c; font-size: 0.875em; font-weight: normal; - padding: 0.1em; } + padding: 0.25em 0.5em 0.25em; } html.theme--documenter-dark hr { background-color: #282f2f; border: none; @@ -7253,12 +7282,6 @@ html.theme--documenter-dark { box-shadow: 0 1px 2px rgba(10, 10, 10, 0.1); box-shadow: none; border-bottom: 1px solid #5e6d6f; } - html.theme--documenter-dark .docstring > header code { - background-color: transparent; } - html.theme--documenter-dark .docstring > header .docstring-binding { - margin-right: 0.3em; } - html.theme--documenter-dark .docstring > header .docstring-category { - margin-left: 0.3em; } html.theme--documenter-dark .docstring > section { position: relative; padding: 1.5rem; @@ -7280,15 +7303,11 @@ html.theme--documenter-dark { html.theme--documenter-dark .content code { font-weight: inherit; word-break: break-word; } - html.theme--documenter-dark .content a code { - color: #1abc9c; } html.theme--documenter-dark .content table { display: block; width: initial; max-width: 100%; overflow-x: auto; } - html.theme--documenter-dark .content blockquote > ul:first-child, html.theme--documenter-dark .content blockquote > ol:first-child, html.theme--documenter-dark .content .admonition-body > ul:first-child, html.theme--documenter-dark .content .admonition-body > ol:first-child { - margin-top: 0; } html.theme--documenter-dark .breadcrumb a.is-disabled { cursor: default; pointer-events: none; } @@ -7300,9 +7319,6 @@ html.theme--documenter-dark { html.theme--documenter-dark .katex .katex-mathml { top: 0; right: 0; } - html.theme--documenter-dark html { - -moz-osx-font-smoothing: auto; - -webkit-font-smoothing: auto; } @media screen and (min-width: 1056px) { html.theme--documenter-dark #documenter .docs-main { max-width: 52rem; @@ -7499,6 +7515,7 @@ html.theme--documenter-dark { margin-top: 0.5rem; } html.theme--documenter-dark #documenter .docs-sidebar ul.docs-menu ul.internal .tocitem { width: 100%; + color: gray; padding: 0; } html.theme--documenter-dark #documenter .docs-sidebar ul.docs-menu ul.internal .tocitem::before { content: "⚬"; @@ -7545,6 +7562,8 @@ html.theme--documenter-dark { html.theme--documenter-dark { background-color: #1f2424; font-size: 16px; + -moz-osx-font-smoothing: grayscale; + -webkit-font-smoothing: antialiased; min-width: 300px; overflow-x: auto; overflow-y: scroll; @@ -7614,5 +7633,3 @@ html.theme--documenter-dark { html.theme--documenter-dark .hljs-keyword, html.theme--documenter-dark .hljs-selector-tag { font-weight: bold; } } - html.theme--documenter-dark .hljs-subst { - color: #f8f8f2; } diff --git a/dev/assets/themes/documenter-light.css b/dev/assets/themes/documenter-light.css index 7516299..c51d518 100644 --- a/dev/assets/themes/documenter-light.css +++ b/dev/assets/themes/documenter-light.css @@ -325,7 +325,7 @@ body { line-height: 1.5; } a { - color: #2e63b8; + color: #0b5bda; cursor: pointer; text-decoration: none; } a strong { @@ -338,7 +338,7 @@ code { color: #da0b00; font-size: 0.875em; font-weight: normal; - padding: 0.1em; } + padding: 0.25em 0.5em 0.25em; } hr { background-color: whitesmoke; @@ -739,13 +739,13 @@ a.has-text-primary:hover, a.has-text-primary:focus { background-color: #4eb5de !important; } .has-text-link { - color: #2e63b8 !important; } + color: #0b5bda !important; } a.has-text-link:hover, a.has-text-link:focus { - color: #244d8f !important; } + color: #0947a9 !important; } .has-background-link { - background-color: #2e63b8 !important; } + background-color: #0b5bda !important; } .has-text-info { color: #209cee !important; } @@ -1174,10 +1174,10 @@ a.has-text-danger:hover, a.has-text-danger:focus { padding: 1.25rem; } a.box:hover, a.box:focus { - box-shadow: 0 2px 3px rgba(10, 10, 10, 0.1), 0 0 0 1px #2e63b8; } + box-shadow: 0 2px 3px rgba(10, 10, 10, 0.1), 0 0 0 1px #0b5bda; } a.box:active { - box-shadow: inset 0 1px 2px rgba(10, 10, 10, 0.2), 0 0 0 1px #2e63b8; } + box-shadow: inset 0 1px 2px rgba(10, 10, 10, 0.2), 0 0 0 1px #0b5bda; } .button { background-color: white; @@ -1210,10 +1210,10 @@ a.box:active { border-color: #b5b5b5; color: #363636; } .button:focus, .button.is-focused { - border-color: #2e63b8; + border-color: #0b5bda; color: #363636; } .button:focus:not(:active), .button.is-focused:not(:active) { - box-shadow: 0 0 0 0.125em rgba(46, 99, 184, 0.25); } + box-shadow: 0 0 0 0.125em rgba(11, 91, 218, 0.25); } .button:active, .button.is-active { border-color: #4a4a4a; color: #363636; } @@ -1586,30 +1586,30 @@ a.box:active { box-shadow: none; color: #fff; } .button.is-link { - background-color: #2e63b8; + background-color: #0b5bda; border-color: transparent; color: #fff; } .button.is-link:hover, .button.is-link.is-hovered { - background-color: #2b5eae; + background-color: #0a56ce; border-color: transparent; color: #fff; } .button.is-link:focus, .button.is-link.is-focused { border-color: transparent; color: #fff; } .button.is-link:focus:not(:active), .button.is-link.is-focused:not(:active) { - box-shadow: 0 0 0 0.125em rgba(46, 99, 184, 0.25); } + box-shadow: 0 0 0 0.125em rgba(11, 91, 218, 0.25); } .button.is-link:active, .button.is-link.is-active { - background-color: #2958a4; + background-color: #0a51c2; border-color: transparent; color: #fff; } .button.is-link[disabled], fieldset[disabled] .button.is-link { - background-color: #2e63b8; + background-color: #0b5bda; border-color: transparent; box-shadow: none; } .button.is-link.is-inverted { background-color: #fff; - color: #2e63b8; } + color: #0b5bda; } .button.is-link.is-inverted:hover, .button.is-link.is-inverted.is-hovered { background-color: #f2f2f2; } .button.is-link.is-inverted[disabled], @@ -1617,36 +1617,36 @@ a.box:active { background-color: #fff; border-color: transparent; box-shadow: none; - color: #2e63b8; } + color: #0b5bda; } .button.is-link.is-loading::after { border-color: transparent transparent #fff #fff !important; } .button.is-link.is-outlined { background-color: transparent; - border-color: #2e63b8; - color: #2e63b8; } + border-color: #0b5bda; + color: #0b5bda; } .button.is-link.is-outlined:hover, .button.is-link.is-outlined.is-hovered, .button.is-link.is-outlined:focus, .button.is-link.is-outlined.is-focused { - background-color: #2e63b8; - border-color: #2e63b8; + background-color: #0b5bda; + border-color: #0b5bda; color: #fff; } .button.is-link.is-outlined.is-loading::after { - border-color: transparent transparent #2e63b8 #2e63b8 !important; } + border-color: transparent transparent #0b5bda #0b5bda !important; } .button.is-link.is-outlined.is-loading:hover::after, .button.is-link.is-outlined.is-loading.is-hovered::after, .button.is-link.is-outlined.is-loading:focus::after, .button.is-link.is-outlined.is-loading.is-focused::after { border-color: transparent transparent #fff #fff !important; } .button.is-link.is-outlined[disabled], fieldset[disabled] .button.is-link.is-outlined { background-color: transparent; - border-color: #2e63b8; + border-color: #0b5bda; box-shadow: none; - color: #2e63b8; } + color: #0b5bda; } .button.is-link.is-inverted.is-outlined { background-color: transparent; border-color: #fff; color: #fff; } .button.is-link.is-inverted.is-outlined:hover, .button.is-link.is-inverted.is-outlined.is-hovered, .button.is-link.is-inverted.is-outlined:focus, .button.is-link.is-inverted.is-outlined.is-focused { background-color: #fff; - color: #2e63b8; } + color: #0b5bda; } .button.is-link.is-inverted.is-outlined.is-loading:hover::after, .button.is-link.is-inverted.is-outlined.is-loading.is-hovered::after, .button.is-link.is-inverted.is-outlined.is-loading:focus::after, .button.is-link.is-inverted.is-outlined.is-loading.is-focused::after { - border-color: transparent transparent #2e63b8 #2e63b8 !important; } + border-color: transparent transparent #0b5bda #0b5bda !important; } .button.is-link.is-inverted.is-outlined[disabled], fieldset[disabled] .button.is-link.is-inverted.is-outlined { background-color: transparent; @@ -2332,7 +2332,7 @@ a.box:active { background-color: #4eb5de; color: #fff; } .notification.is-link { - background-color: #2e63b8; + background-color: #0b5bda; color: #fff; } .notification.is-info { background-color: #209cee; @@ -2407,13 +2407,13 @@ a.box:active { .progress.is-primary:indeterminate, .docstring > section > a.progress.docs-sourcelink:indeterminate { background-image: linear-gradient(to right, #4eb5de 30%, #dbdbdb 30%); } .progress.is-link::-webkit-progress-value { - background-color: #2e63b8; } + background-color: #0b5bda; } .progress.is-link::-moz-progress-bar { - background-color: #2e63b8; } + background-color: #0b5bda; } .progress.is-link::-ms-fill { - background-color: #2e63b8; } + background-color: #0b5bda; } .progress.is-link:indeterminate { - background-image: linear-gradient(to right, #2e63b8 30%, #dbdbdb 30%); } + background-image: linear-gradient(to right, #0b5bda 30%, #dbdbdb 30%); } .progress.is-info::-webkit-progress-value { background-color: #209cee; } .progress.is-info::-moz-progress-bar { @@ -2509,8 +2509,8 @@ a.box:active { color: #fff; } .table td.is-link, .table th.is-link { - background-color: #2e63b8; - border-color: #2e63b8; + background-color: #0b5bda; + border-color: #0b5bda; color: #fff; } .table td.is-info, .table th.is-info { @@ -2672,7 +2672,7 @@ a.box:active { background-color: #4eb5de; color: #fff; } .tag:not(body).is-link, .docstring > section > a.docs-sourcelink:not(body).is-link, .content kbd:not(body).is-link { - background-color: #2e63b8; + background-color: #0b5bda; color: #fff; } .tag:not(body).is-info, .docstring > section > a.docs-sourcelink:not(body).is-info, .content kbd:not(body).is-info { background-color: #209cee; @@ -2850,8 +2850,8 @@ a.tag:hover, .docstring > section > a.docs-sourcelink:hover { .input:hover, #documenter .docs-sidebar form.docs-search > input:hover, .textarea:hover, .select select:hover, .is-hovered.input, #documenter .docs-sidebar form.docs-search > input.is-hovered, .is-hovered.textarea, .select select.is-hovered { border-color: #b5b5b5; } .input:focus, #documenter .docs-sidebar form.docs-search > input:focus, .textarea:focus, .select select:focus, .is-focused.input, #documenter .docs-sidebar form.docs-search > input.is-focused, .is-focused.textarea, .select select.is-focused, .input:active, #documenter .docs-sidebar form.docs-search > input:active, .textarea:active, .select select:active, .is-active.input, #documenter .docs-sidebar form.docs-search > input.is-active, .is-active.textarea, .select select.is-active { - border-color: #2e63b8; - box-shadow: 0 0 0 0.125em rgba(46, 99, 184, 0.25); } + border-color: #0b5bda; + box-shadow: 0 0 0 0.125em rgba(11, 91, 218, 0.25); } .input[disabled], #documenter .docs-sidebar form.docs-search > input[disabled], .textarea[disabled], .select select[disabled], fieldset[disabled] .input, fieldset[disabled] #documenter .docs-sidebar form.docs-search > input, @@ -2923,9 +2923,9 @@ a.tag:hover, .docstring > section > a.docs-sourcelink:hover { .is-primary.input:focus, .docstring > section > a.input.docs-sourcelink:focus, #documenter .docs-sidebar form.docs-search > input.is-primary:focus, .is-primary.textarea:focus, .docstring > section > a.textarea.docs-sourcelink:focus, .is-primary.is-focused.input, .docstring > section > a.is-focused.input.docs-sourcelink, #documenter .docs-sidebar form.docs-search > input.is-primary.is-focused, .is-primary.is-focused.textarea, .docstring > section > a.is-focused.textarea.docs-sourcelink, .is-primary.input:active, .docstring > section > a.input.docs-sourcelink:active, #documenter .docs-sidebar form.docs-search > input.is-primary:active, .is-primary.textarea:active, .docstring > section > a.textarea.docs-sourcelink:active, .is-primary.is-active.input, .docstring > section > a.is-active.input.docs-sourcelink, #documenter .docs-sidebar form.docs-search > input.is-primary.is-active, .is-primary.is-active.textarea, .docstring > section > a.is-active.textarea.docs-sourcelink { box-shadow: 0 0 0 0.125em rgba(78, 181, 222, 0.25); } .is-link.input, #documenter .docs-sidebar form.docs-search > input.is-link, .is-link.textarea { - border-color: #2e63b8; } + border-color: #0b5bda; } .is-link.input:focus, #documenter .docs-sidebar form.docs-search > input.is-link:focus, .is-link.textarea:focus, .is-link.is-focused.input, #documenter .docs-sidebar form.docs-search > input.is-link.is-focused, .is-link.is-focused.textarea, .is-link.input:active, #documenter .docs-sidebar form.docs-search > input.is-link:active, .is-link.textarea:active, .is-link.is-active.input, #documenter .docs-sidebar form.docs-search > input.is-link.is-active, .is-link.is-active.textarea { - box-shadow: 0 0 0 0.125em rgba(46, 99, 184, 0.25); } + box-shadow: 0 0 0 0.125em rgba(11, 91, 218, 0.25); } .is-info.input, #documenter .docs-sidebar form.docs-search > input.is-info, .is-info.textarea { border-color: #209cee; } .is-info.input:focus, #documenter .docs-sidebar form.docs-search > input.is-info:focus, .is-info.textarea:focus, .is-info.is-focused.input, #documenter .docs-sidebar form.docs-search > input.is-info.is-focused, .is-info.is-focused.textarea, .is-info.input:active, #documenter .docs-sidebar form.docs-search > input.is-info:active, .is-info.textarea:active, .is-info.is-active.input, #documenter .docs-sidebar form.docs-search > input.is-info.is-active, .is-info.is-active.textarea { @@ -3008,7 +3008,7 @@ a.tag:hover, .docstring > section > a.docs-sourcelink:hover { .select:not(.is-multiple) { height: 2.25em; } .select:not(.is-multiple):not(.is-loading)::after { - border-color: #2e63b8; + border-color: #0b5bda; right: 1.125em; z-index: 4; } .select.is-rounded select, #documenter .docs-sidebar form.docs-search > input.select select { @@ -3075,13 +3075,13 @@ a.tag:hover, .docstring > section > a.docs-sourcelink:hover { .select.is-primary select:focus, .docstring > section > a.select.docs-sourcelink select:focus, .select.is-primary select.is-focused, .docstring > section > a.select.docs-sourcelink select.is-focused, .select.is-primary select:active, .docstring > section > a.select.docs-sourcelink select:active, .select.is-primary select.is-active, .docstring > section > a.select.docs-sourcelink select.is-active { box-shadow: 0 0 0 0.125em rgba(78, 181, 222, 0.25); } .select.is-link:not(:hover)::after { - border-color: #2e63b8; } + border-color: #0b5bda; } .select.is-link select { - border-color: #2e63b8; } + border-color: #0b5bda; } .select.is-link select:hover, .select.is-link select.is-hovered { - border-color: #2958a4; } + border-color: #0a51c2; } .select.is-link select:focus, .select.is-link select.is-focused, .select.is-link select:active, .select.is-link select.is-active { - box-shadow: 0 0 0 0.125em rgba(46, 99, 184, 0.25); } + box-shadow: 0 0 0 0.125em rgba(11, 91, 218, 0.25); } .select.is-info:not(:hover)::after { border-color: #209cee; } .select.is-info select { @@ -3226,19 +3226,19 @@ a.tag:hover, .docstring > section > a.docs-sourcelink:hover { border-color: transparent; color: #fff; } .file.is-link .file-cta { - background-color: #2e63b8; + background-color: #0b5bda; border-color: transparent; color: #fff; } .file.is-link:hover .file-cta, .file.is-link.is-hovered .file-cta { - background-color: #2b5eae; + background-color: #0a56ce; border-color: transparent; color: #fff; } .file.is-link:focus .file-cta, .file.is-link.is-focused .file-cta { border-color: transparent; - box-shadow: 0 0 0.5em rgba(46, 99, 184, 0.25); + box-shadow: 0 0 0.5em rgba(11, 91, 218, 0.25); color: #fff; } .file.is-link:active .file-cta, .file.is-link.is-active .file-cta { - background-color: #2958a4; + background-color: #0a51c2; border-color: transparent; color: #fff; } .file.is-info .file-cta { @@ -3454,7 +3454,7 @@ a.tag:hover, .docstring > section > a.docs-sourcelink:hover { .help.is-primary, .docstring > section > a.help.docs-sourcelink { color: #4eb5de; } .help.is-link { - color: #2e63b8; } + color: #0b5bda; } .help.is-info { color: #209cee; } .help.is-success { @@ -3682,7 +3682,7 @@ a.tag:hover, .docstring > section > a.docs-sourcelink:hover { white-space: nowrap; } .breadcrumb a { align-items: center; - color: #2e63b8; + color: #0b5bda; display: flex; justify-content: center; padding: 0 0.75em; } @@ -3840,7 +3840,7 @@ button.dropdown-item { color: #0a0a0a; } a.dropdown-item.is-active, button.dropdown-item.is-active { - background-color: #2e63b8; + background-color: #0b5bda; color: #fff; } .dropdown-divider { @@ -3939,7 +3939,7 @@ button.dropdown-item { .list-item:not(:last-child) { border-bottom: 1px solid #dbdbdb; } .list-item.is-active { - background-color: #2e63b8; + background-color: #0b5bda; color: #fff; } a.list-item { @@ -4013,7 +4013,7 @@ a.list-item { background-color: whitesmoke; color: #222222; } .menu-list a.is-active { - background-color: #2e63b8; + background-color: #0b5bda; color: #fff; } .menu-list li ul { border-left: 1px solid #dbdbdb; @@ -4086,13 +4086,13 @@ a.list-item { border-color: #4eb5de; color: #1f556a; } .message.is-link { - background-color: #f7f9fd; } + background-color: #f5f9ff; } .message.is-link .message-header { - background-color: #2e63b8; + background-color: #0b5bda; color: #fff; } .message.is-link .message-body { - border-color: #2e63b8; - color: #264981; } + border-color: #0b5bda; + color: #0c459e; } .message.is-info { background-color: #f6fbfe; } .message.is-info .message-header { @@ -4508,7 +4508,7 @@ a.list-item { background-color: #4eb5de; color: #fff; } } .navbar.is-link { - background-color: #2e63b8; + background-color: #0b5bda; color: #fff; } .navbar.is-link .navbar-brand > .navbar-item, .navbar.is-link .navbar-brand .navbar-link { @@ -4517,7 +4517,7 @@ a.list-item { .navbar.is-link .navbar-brand .navbar-link:focus, .navbar.is-link .navbar-brand .navbar-link:hover, .navbar.is-link .navbar-brand .navbar-link.is-active { - background-color: #2958a4; + background-color: #0a51c2; color: #fff; } .navbar.is-link .navbar-brand .navbar-link::after { border-color: #fff; } @@ -4539,7 +4539,7 @@ a.list-item { .navbar.is-link .navbar-end .navbar-link:focus, .navbar.is-link .navbar-end .navbar-link:hover, .navbar.is-link .navbar-end .navbar-link.is-active { - background-color: #2958a4; + background-color: #0a51c2; color: #fff; } .navbar.is-link .navbar-start .navbar-link::after, .navbar.is-link .navbar-end .navbar-link::after { @@ -4547,10 +4547,10 @@ a.list-item { .navbar.is-link .navbar-item.has-dropdown:focus .navbar-link, .navbar.is-link .navbar-item.has-dropdown:hover .navbar-link, .navbar.is-link .navbar-item.has-dropdown.is-active .navbar-link { - background-color: #2958a4; + background-color: #0a51c2; color: #fff; } .navbar.is-link .navbar-dropdown a.navbar-item.is-active { - background-color: #2e63b8; + background-color: #0b5bda; color: #fff; } } .navbar.is-info { background-color: #209cee; @@ -4833,7 +4833,7 @@ a.navbar-item, .navbar-link:hover, .navbar-link.is-active { background-color: #fafafa; - color: #2e63b8; } + color: #0b5bda; } .navbar-item { display: block; @@ -4852,13 +4852,13 @@ a.navbar-item, padding-bottom: calc(0.5rem - 1px); } .navbar-item.is-tab:focus, .navbar-item.is-tab:hover { background-color: transparent; - border-bottom-color: #2e63b8; } + border-bottom-color: #0b5bda; } .navbar-item.is-tab.is-active { background-color: transparent; - border-bottom-color: #2e63b8; + border-bottom-color: #0b5bda; border-bottom-style: solid; border-bottom-width: 3px; - color: #2e63b8; + color: #0b5bda; padding-bottom: calc(0.5rem - 3px); } .navbar-content { @@ -4868,7 +4868,7 @@ a.navbar-item, .navbar-link:not(.is-arrowless) { padding-right: 2.5em; } .navbar-link:not(.is-arrowless)::after { - border-color: #2e63b8; + border-color: #0b5bda; margin-top: -0.375em; right: 1.125em; } @@ -4953,7 +4953,7 @@ a.navbar-item, color: #0a0a0a; } .navbar.is-transparent .navbar-dropdown a.navbar-item.is-active { background-color: whitesmoke; - color: #2e63b8; } + color: #0b5bda; } .navbar-burger { display: none; } .navbar-item, @@ -5011,7 +5011,7 @@ a.navbar-item, color: #0a0a0a; } .navbar-dropdown a.navbar-item.is-active { background-color: whitesmoke; - color: #2e63b8; } + color: #0b5bda; } .navbar.is-spaced .navbar-dropdown, .navbar-dropdown.is-boxed { border-radius: 6px; border-top: none; @@ -5119,7 +5119,7 @@ a.navbar-item, .pagination-previous:focus, .pagination-next:focus, .pagination-link:focus { - border-color: #2e63b8; } + border-color: #0b5bda; } .pagination-previous:active, .pagination-next:active, .pagination-link:active { @@ -5140,8 +5140,8 @@ a.navbar-item, white-space: nowrap; } .pagination-link.is-current { - background-color: #2e63b8; - border-color: #2e63b8; + background-color: #0b5bda; + border-color: #0b5bda; color: #fff; } .pagination-ellipsis { @@ -5230,7 +5230,7 @@ a.navbar-item, .panel-list a { color: #222222; } .panel-list a:hover { - color: #2e63b8; } + color: #0b5bda; } .panel-block { align-items: center; @@ -5247,10 +5247,10 @@ a.navbar-item, .panel-block.is-wrapped { flex-wrap: wrap; } .panel-block.is-active { - border-left-color: #2e63b8; + border-left-color: #0b5bda; color: #363636; } .panel-block.is-active .panel-icon { - color: #2e63b8; } + color: #0b5bda; } a.panel-block, label.panel-block { @@ -5299,8 +5299,8 @@ label.panel-block { .tabs li { display: block; } .tabs li.is-active a { - border-bottom-color: #2e63b8; - color: #2e63b8; } + border-bottom-color: #0b5bda; + color: #0b5bda; } .tabs ul { align-items: center; border-bottom-color: #dbdbdb; @@ -5358,8 +5358,8 @@ label.panel-block { .tabs.is-toggle li:last-child a { border-radius: 0 4px 4px 0; } .tabs.is-toggle li.is-active a { - background-color: #2e63b8; - border-color: #2e63b8; + background-color: #0b5bda; + border-color: #0b5bda; color: #fff; z-index: 1; } .tabs.is-toggle ul { @@ -6803,7 +6803,7 @@ label.panel-block { .hero.is-primary.is-bold .navbar-menu, .docstring > section > a.hero.is-bold.docs-sourcelink .navbar-menu { background-image: linear-gradient(141deg, #1bc7de 0%, #4eb5de 71%, #5fa9e7 100%); } } .hero.is-link { - background-color: #2e63b8; + background-color: #0b5bda; color: #fff; } .hero.is-link a:not(.button):not(.dropdown-item):not(.tag):not(.pagination-link.is-current), .hero.is-link strong { @@ -6817,14 +6817,14 @@ label.panel-block { color: #fff; } @media screen and (max-width: 1055px) { .hero.is-link .navbar-menu { - background-color: #2e63b8; } } + background-color: #0b5bda; } } .hero.is-link .navbar-item, .hero.is-link .navbar-link { color: rgba(255, 255, 255, 0.7); } .hero.is-link a.navbar-item:hover, .hero.is-link a.navbar-item.is-active, .hero.is-link .navbar-link:hover, .hero.is-link .navbar-link.is-active { - background-color: #2958a4; + background-color: #0a51c2; color: #fff; } .hero.is-link .tabs a { color: #fff; @@ -6840,12 +6840,12 @@ label.panel-block { .hero.is-link .tabs.is-boxed li.is-active a, .hero.is-link .tabs.is-boxed li.is-active a:hover, .hero.is-link .tabs.is-toggle li.is-active a, .hero.is-link .tabs.is-toggle li.is-active a:hover { background-color: #fff; border-color: #fff; - color: #2e63b8; } + color: #0b5bda; } .hero.is-link.is-bold { - background-image: linear-gradient(141deg, #1b6098 0%, #2e63b8 71%, #2d51d2 100%); } + background-image: linear-gradient(141deg, #0062b2 0%, #0b5bda 71%, #063bf9 100%); } @media screen and (max-width: 768px) { .hero.is-link.is-bold .navbar-menu { - background-image: linear-gradient(141deg, #1b6098 0%, #2e63b8 71%, #2d51d2 100%); } } + background-image: linear-gradient(141deg, #0062b2 0%, #0b5bda 71%, #063bf9 100%); } } .hero.is-info { background-color: #209cee; color: #fff; } @@ -7213,12 +7213,6 @@ h1:hover .docs-heading-anchor, h2:hover .docs-heading-anchor, h3:hover .docs-hea box-shadow: 0 1px 2px rgba(10, 10, 10, 0.1); box-shadow: none; border-bottom: 1px solid #dbdbdb; } - .docstring > header code { - background-color: transparent; } - .docstring > header .docstring-binding { - margin-right: 0.3em; } - .docstring > header .docstring-category { - margin-left: 0.3em; } .docstring > section { position: relative; padding: 1.5rem; @@ -7243,18 +7237,12 @@ h1:hover .docs-heading-anchor, h2:hover .docs-heading-anchor, h3:hover .docs-hea font-weight: inherit; word-break: break-word; } -.content a code { - color: #2e63b8; } - .content table { display: block; width: initial; max-width: 100%; overflow-x: auto; } -.content blockquote > ul:first-child, .content blockquote > ol:first-child, .content .admonition-body > ul:first-child, .content .admonition-body > ol:first-child { - margin-top: 0; } - .breadcrumb a.is-disabled { cursor: default; pointer-events: none; } @@ -7269,10 +7257,6 @@ h1:hover .docs-heading-anchor, h2:hover .docs-heading-anchor, h3:hover .docs-hea top: 0; right: 0; } -html { - -moz-osx-font-smoothing: auto; - -webkit-font-smoothing: auto; } - /* This file contain the overall layout. * * The main container is
that is identified by id #documenter. @@ -7478,6 +7462,7 @@ html { margin-top: 0.5rem; } #documenter .docs-sidebar ul.docs-menu ul.internal .tocitem { width: 100%; + color: gray; padding: 0; } #documenter .docs-sidebar ul.docs-menu ul.internal .tocitem::before { content: "⚬"; @@ -7523,79 +7508,3 @@ html { margin-left: 2rem; } #documenter .docs-main #documenter-search-results .docs-highlight { background-color: yellow; } - -/* - -Original highlight.js style (c) Ivan Sagalaev - -*/ -.hljs { - display: block; - overflow-x: auto; - padding: 0.5em; - background: #F0F0F0; } - -/* Base color: saturation 0; */ -.hljs, -.hljs-subst { - color: #444; } - -.hljs-comment { - color: #888888; } - -.hljs-keyword, -.hljs-attribute, -.hljs-selector-tag, -.hljs-meta-keyword, -.hljs-doctag, -.hljs-name { - font-weight: bold; } - -/* User color: hue: 0 */ -.hljs-type, -.hljs-string, -.hljs-number, -.hljs-selector-id, -.hljs-selector-class, -.hljs-quote, -.hljs-template-tag, -.hljs-deletion { - color: #880000; } - -.hljs-title, -.hljs-section { - color: #880000; - font-weight: bold; } - -.hljs-regexp, -.hljs-symbol, -.hljs-variable, -.hljs-template-variable, -.hljs-link, -.hljs-selector-attr, -.hljs-selector-pseudo { - color: #BC6060; } - -/* Language color: hue: 90; */ -.hljs-literal { - color: #78A960; } - -.hljs-built_in, -.hljs-bullet, -.hljs-code, -.hljs-addition { - color: #397300; } - -/* Meta color: hue: 200 */ -.hljs-meta { - color: #1f7199; } - -.hljs-meta-string { - color: #4d99bf; } - -/* Misc effects */ -.hljs-emphasis { - font-style: italic; } - -.hljs-strong { - font-weight: bold; } diff --git a/dev/customprocessing.html b/dev/customprocessing.html index 3aeb0ae..b391b22 100644 --- a/dev/customprocessing.html +++ b/dev/customprocessing.html @@ -1,5 +1,5 @@ -5. Custom pre- and post-processing · Literate.jl

5. Custom pre- and post-processing

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 line filtering 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.

All of the generators (Literate.markdown, Literate.notebook and Literate.script) accepts preprocess and postprocess keyword arguments. The default "transformation" is the identity function. The input to the transformation functions is a String, and the output should be the transformed String.

preprocess is sent the raw input that is read from the source file (modulo the default line ending transformation). postprocess is given different things depending on the output: For markdown and script output postprocess is given the content String just before writing it to the output file, but for notebook output postprocess is given the dictionary representing the notebook, since, in general, this is more useful.

Example: Adding current date

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 preprocess function that splices the date into the source for us. Consider the following source file:

# # Example
+5. Custom pre- and post-processing · Literate.jl

5. Custom pre- and post-processing

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 line filtering 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.

All of the generators (Literate.markdown, Literate.notebook and Literate.script) accepts preprocess and postprocess keyword arguments. The default "transformation" is the identity function. The input to the transformation functions is a String, and the output should be the transformed String.

preprocess is sent the raw input that is read from the source file (modulo the default line ending transformation). postprocess is given different things depending on the output: For markdown and script output postprocess is given the content String just before writing it to the output file, but for notebook output postprocess is given the dictionary representing the notebook, since, in general, this is more useful.

Example: Adding current date

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 preprocess function that splices the date into the source for us. Consider the following source file:

# # Example
 # This example was generated DATEOFTODAY
 
 x = 1 // 3

where DATEOFTODAY is a placeholder, to make it easier for our preprocess function to find the location. Now, lets define the preprocess function, for example

function update_date(content)
@@ -26,4 +26,4 @@ include("file2.jl")

Let's say we have saved this fi end return str end

(of course replace included with your respective files)

Finally, you simply pass this function to e.g. Literate.markdown as

Literate.markdown("examples.jl", "path/to/save/markdown";
-                  name = "markdown_file_name", preprocess = replace_includes)

and you will see that in the final output file (here markdown_file_name.md) the include statements are replaced with the actual code to be included!

This approach is used for generating the examples in the documentation of the TimeseriesPrediction.jl package. The example files, included together in the stexamples.jl file, are processed by literate via this make.jl file to generate the markdown and code cells of the documentation.

+ name = "markdown_file_name", preprocess = replace_includes)

and you will see that in the final output file (here markdown_file_name.md) the include statements are replaced with the actual code to be included!

This approach is used for generating the examples in the documentation of the TimeseriesPrediction.jl package. The example files, included together in the stexamples.jl file, are processed by literate via this make.jl file to generate the markdown and code cells of the documentation.

diff --git a/dev/documenter.html b/dev/documenter.html index 5886bfb..8fc1532 100644 --- a/dev/documenter.html +++ b/dev/documenter.html @@ -1,5 +1,5 @@ -6. Interaction with Documenter.jl · Literate.jl

6. Interaction with Documenter.jl

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 (Literate.markdown, Literate.notebook and Literate.script) supports a keyword argument documenter 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 documenter = true:

Literate.markdown:

Literate.script:

  • Documenter style @refs and @id will be removed. This means that you can use @ref and @id in the source file without them leaking to the script.
diff --git a/dev/fileformat.html b/dev/fileformat.html index 35cabcc..a820b48 100644 --- a/dev/fileformat.html +++ b/dev/fileformat.html @@ -1,5 +1,5 @@ -2. File Format · Literate.jl

2. File Format

The source file format for Literate is a regular, commented, julia (.jl) 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. include, to make sure the examples stay up do date with other changes in your package.

2.1. Syntax

The basic syntax is simple:

  • lines starting with # are treated as markdown,
  • all other lines are treated as julia code.

Leading whitespace is allowed before #, but it will be removed when generating the output. Since #-lines is treated as markdown we can not use that for regular julia comments, for this you can instead use ##, which will render as # in the output.

Lets look at a simple example:

# # Rational numbers
+2. File Format · Literate.jl

2. File Format

The source file format for Literate is a regular, commented, julia (.jl) 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. include, to make sure the examples stay up do date with other changes in your package.

2.1. Syntax

The basic syntax is simple:

  • lines starting with # are treated as markdown,
  • all other lines are treated as julia code.

Leading whitespace is allowed before #, but it will be removed when generating the output. Since #-lines is treated as markdown we can not use that for regular julia comments, for this you can instead use ##, which will render as # in the output.

Lets look at a simple example:

# # Rational numbers
 #
 # In julia rational numbers can be constructed with the `//` operator.
 # Lets define two rational numbers, `x` and `y`:
@@ -15,4 +15,4 @@ z = x + y

In the lines starting with # we can use re #md # Literate.notebook #md # Literate.markdown #md # ```

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 #md from the lines. Beware that the space after the tag is also removed.

The #src token can also be placed at the end 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 @test at the end without this showing up in the outputs:

using Test                      #src
-@test result == expected_result #src

2.3. Default Replacements

The following convenience "macros" are always expanded:

  • @__NAME__

    expands to the name keyword argument to Literate.markdown, Literate.notebook and Literate.script (defaults to the filename of the input file).

  • @__REPO_ROOT_URL__

    expands to https://github.com/$(ENV["TRAVIS_REPO_SLUG"])/blob/master and is a convenient way to use when you want to link to files outside the doc-build directory. For example @__REPO_ROOT_URL__/src/Literate.jl would link to the source of the Literate module.

  • @__NBVIEWER_ROOT_URL__

    expands to https://nbviewer.jupyter.org/github/$(ENV["TRAVIS_REPO_SLUG"])/blob/gh-pages/$(folder) where folder is the folder that Documenter.deploydocs deploys too. This can be used if you want a link that opens the generated notebook in http://nbviewer.jupyter.org/.

  • @__BINDER_ROOT_URL__

    expands to https://mybinder.org/v2/gh/$(ENV["TRAVIS_REPO_SLUG"])/$(branch)?filepath=$(folder) where branch/folder is the branch and folder where Documenter.deploydocs deploys too. This can be used if you want a link that opens the generated notebook in https://mybinder.org/. To add a binder-badge in e.g. the HTML output you can use:

    [![Binder](https://mybinder.org/badge_logo.svg)](@__BINDER_ROOT_URL__/path/to/notebook.inpynb)
Note

@__REPO_ROOT_URL__ and @__NBVIEWER_ROOT_URL__ works for documentation built with DocumentationGenerator.jl but @__BINDER_ROOT_URL__ does not, since mybinder.org requires the files to be located inside a git repository.

+@test result == expected_result #src

2.3. Default Replacements

The following convenience "macros" are always expanded:

Note

@__REPO_ROOT_URL__ and @__NBVIEWER_ROOT_URL__ works for documentation built with DocumentationGenerator.jl but @__BINDER_ROOT_URL__ does not, since mybinder.org requires the files to be located inside a git repository.

diff --git a/dev/generated/example.html b/dev/generated/example.html index 31c804c..8ad0e3c 100644 --- a/dev/generated/example.html +++ b/dev/generated/example.html @@ -1,5 +1,5 @@ -7. Example · Literate.jl

7. Example

This is an example generated with Literate based on this source file: example.jl. 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 nbviewer here: example.ipynb, and opened in binder here: example.ipynb, and the plain script output can be found here: example.jl.

It is recommended to have the source file available when reading this, to better understand how the syntax in the source file corresponds to the output you are seeing.

Basic syntax

The basic syntax for Literate is simple, lines starting with # is interpreted as markdown, and all the other lines are interpreted as code. Here is some code:

x = 1//3
+7. Example · Literate.jl

7. Example

This is an example generated with Literate based on this source file: example.jl. 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 nbviewer here: example.ipynb, and opened in binder here: example.ipynb, and the plain script output can be found here: example.jl.

It is recommended to have the source file available when reading this, to better understand how the syntax in the source file corresponds to the output you are seeing.

Basic syntax

The basic syntax for Literate is simple, lines starting with # is interpreted as markdown, and all the other lines are interpreted as code. Here is some code:

x = 1//3
 y = 2//5
2//5

In markdown sections we can use markdown syntax. For example, we can write text in italic font, text in bold font and use links.

It is possible to filter out lines depending on the output using the #md, #nb, #jl and #src tags (see Filtering Lines):

  • This line starts with #md and is thus only visible in the markdown output.

The source file is parsed in chunks of markdown and code. Starting a line with #- manually inserts a chunk break. For example, if we want to display the output of the following operations we may insert #- in between. These two code blocks will now end up in different @example-blocks in the markdown output, and two different notebook cells in the notebook output.

x + y
11//15
x * y
2//15

Output Capturing

Code chunks are by default placed in Documenter @example 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 execute keyword argument is set to true. Output to stdout/stderr is also captured.

Note

Note that Documenter currently only displays output to stdout/stderr if there is no other result to show. Since the vector [1, 2, 3, 4] is returned from foo, the printing of "This string is printed to stdout." is hidden.

function foo()
     println("This string is printed to stdout.")
     return [1, 2, 3, 4]
@@ -16,114 +16,114 @@ y2 = cos.(x)
 plot(x, [y1, y2])
- + - - + - - + - - - - - - - - - - - - - - - - - - - - - + 0 - + 5 - + 10 - + 15 - + -1.0 - + -0.5 - + 0.0 - + 0.5 - + 1.0 - - - - - - + y1 - - + y2 -

Custom processing

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 z and 1.0 + 2.0im:

z = 1.0 + 2.0im
1.0 + 2.0im

Documenter.jl interaction

In the source file it is possible to use Documenter.jl style references, such as @ref and @id. These will be filtered out in the notebook output. For example, here is a link, but it is only visible as a link if you are reading the markdown output. We can also use equations:

\[\int_\Omega \nabla v \cdot \nabla u\ \mathrm{d}\Omega = \int_\Omega v f\ \mathrm{d}\Omega\]

using Documenters math syntax. Documenters syntax is automatically changed to \begin{equation} ... \end{equation} in the notebook output to display correctly.

This page was generated using Literate.jl.

+

Custom processing

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 z and 1.0 + 2.0im:

z = 1.0 + 2.0im
1.0 + 2.0im

Documenter.jl interaction

In the source file it is possible to use Documenter.jl style references, such as @ref and @id. These will be filtered out in the notebook output. For example, here is a link, but it is only visible as a link if you are reading the markdown output. We can also use equations:

\[\int_\Omega \nabla v \cdot \nabla u\ \mathrm{d}\Omega = \int_\Omega v f\ \mathrm{d}\Omega\]

using Documenters math syntax. Documenters syntax is automatically changed to \begin{equation} ... \end{equation} in the notebook output to display correctly.

This page was generated using Literate.jl.

diff --git a/dev/generated/example.ipynb b/dev/generated/example.ipynb index 27986f2..2f7c090 100644 --- a/dev/generated/example.ipynb +++ b/dev/generated/example.ipynb @@ -188,114 +188,114 @@ "\n", "\n", "\n", - " \n", + " \n", " \n", " \n", "\n", - "\n", "\n", - " \n", + " \n", " \n", " \n", "\n", - "\n", "\n", - " \n", + " \n", " \n", " \n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "\n", "0\n", "\n", - "\n", + "\n", "5\n", "\n", - "\n", + "\n", "10\n", "\n", - "\n", + "\n", "15\n", "\n", - "\n", + "\n", "-1.0\n", "\n", - "\n", + "\n", "-0.5\n", "\n", - "\n", + "\n", "0.0\n", "\n", - "\n", + "\n", "0.5\n", "\n", - "\n", + "\n", "1.0\n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "\n", "y1\n", "\n", - "\n", - "\n", + "\n", "y2\n", "\n", "\n" @@ -525,114 +525,114 @@ "\n", "\n", "\n", - " \n", + " \n", " \n", " \n", "\n", - "\n", "\n", - " \n", + " \n", " \n", " \n", "\n", - "\n", "\n", - " \n", + " \n", " \n", " \n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "\n", "0\n", "\n", - "\n", + "\n", "5\n", "\n", - "\n", + "\n", "10\n", "\n", - "\n", + "\n", "15\n", "\n", - "\n", + "\n", "-1.0\n", "\n", - "\n", + "\n", "-0.5\n", "\n", - "\n", + "\n", "0.0\n", "\n", - "\n", + "\n", "0.5\n", "\n", - "\n", + "\n", "1.0\n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", + "\n", "y1\n", "\n", - "\n", - "\n", + "\n", "y2\n", "\n", "\n" diff --git a/dev/generated/name.html b/dev/generated/name.html index 64cacff..2542d92 100644 --- a/dev/generated/name.html +++ b/dev/generated/name.html @@ -1,2 +1,2 @@ -Rational numbers · Literate.jl

Rational numbers

In julia rational numbers can be constructed with the // operator. Lets define two rational numbers, x and y:

x = 1//3
1//3
y = 2//5
2//5

When adding x and y together we obtain a new rational number:

z = x + y
11//15
+Rational numbers · Literate.jl

Rational numbers

In julia rational numbers can be constructed with the // operator. Lets define two rational numbers, x and y:

x = 1//3
1//3
y = 2//5
2//5

When adding x and y together we obtain a new rational number:

z = x + y
11//15
diff --git a/dev/index.html b/dev/index.html index 2afec14..7efe64c 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,2 +1,2 @@ -1. Introduction · Literate.jl

1. Introduction

Welcome to the documentation for Literate – a simplistic package for Literate Programming.

What?

Literate is a package that generates markdown pages (for e.g. Documenter.jl), and Jupyter notebooks, from the same source file. There is also an option to "clean" the source from all metadata, and produce a pure Julia script.

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!

The public interface consists mainly of three functions, all of which take the same script file as input, but generate different output:

Why?

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.

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.

It is also common that packages include examples in the documentation, for example by using Documenter.jl @example-blocks. This is also great, but it is not quite as interactive as a notebook, for the users who prefer that.

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.

+1. Introduction · Literate.jl

1. Introduction

Welcome to the documentation for Literate – a simplistic package for Literate Programming.

What?

Literate is a package that generates markdown pages (for e.g. Documenter.jl), and Jupyter notebooks, from the same source file. There is also an option to "clean" the source from all metadata, and produce a pure Julia script.

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!

The public interface consists mainly of three functions, all of which take the same script file as input, but generate different output:

Why?

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.

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.

It is also common that packages include examples in the documentation, for example by using Documenter.jl @example-blocks. This is also great, but it is not quite as interactive as a notebook, for the users who prefer that.

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.

diff --git a/dev/outputformats.html b/dev/outputformats.html index 0d1c00b..df93513 100644 --- a/dev/outputformats.html +++ b/dev/outputformats.html @@ -1,5 +1,5 @@ -4. Output Formats · Literate.jl

4. Output Formats

When the source is parsed, and have been processed it is time to render the output. We will consider the following source snippet:

# # Rational numbers
+4. Output Formats · Literate.jl

4. Output Formats

When the source is parsed, and have been processed it is time to render the output. We will consider the following source snippet:

# # Rational numbers
 #
 # In julia rational numbers can be constructed with the `//` operator.
 # Lets define two rational numbers, `x` and `y`:
@@ -31,8 +31,8 @@ When adding `x` and `y` together we obtain a new rational number:
 
 ```@example name
 z = x + y
-```

We note that lines starting with # are printed as regular markdown, and the code lines have been wrapped in @example blocks. We also note that an @meta block have been added, that sets the EditURL variable. This is used by Documenter to redirect the "Edit on GitHub" link for the page, see Interaction with Documenter.

Some of the output rendering can be controlled with keyword arguments to Literate.markdown:

Literate.markdownFunction
Literate.markdown(inputfile, outputdir; kwargs...)

Generate a markdown file from inputfile and write the result to the directory outputdir.

Keyword arguments:

  • name: name of the output file, excluding .md; name is also used to name all the @example blocks, and to replace @__NAME__. Defaults to the filename of inputfile.
  • preprocess, postprocess: custom pre- and post-processing functions, see the Custom pre- and post-processing section of the manual. Defaults to identity.
  • documenter: boolean that tells if the output is intended to use with Documenter.jl. Defaults to true. See the manual section on Interaction with Documenter.
  • codefence: A Pair of opening and closing code fence. Defaults to
    "```@example $(name)" => "```"
    if documenter = true and
    "```julia" => "```"
    if documenter = false.
  • credit: boolean that controls the addition of This file was generated with Literate.jl ... to the bottom of the page. If you find Literate.jl useful then feel free to keep this to the default, which is true.
source

4.2. Notebook Output

The (default) notebook output of the source snippet can be seen here: notebook.ipynb.

We note that lines starting with # are placed in markdown cells, and the code lines have been placed 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 Literate.notebook:

Literate.notebookFunction
Literate.notebook(inputfile, outputdir; kwargs...)

Generate a notebook from inputfile and write the result to outputdir.

Keyword arguments:

  • name: name of the output file, excluding .ipynb. name is also used to replace @__NAME__. Defaults to the filename of inputfile.
  • preprocess, postprocess: custom pre- and post-processing functions, see the Custom pre- and post-processing section of the manual. Defaults to identity.
  • execute: a boolean deciding if the generated notebook should also be executed or not. Defaults to true. The current working directory is set to outputdir when executing the notebook.
  • documenter: boolean that says if the source contains Documenter.jl specific things to filter out during notebook generation. Defaults to true. See the the manual section on Interaction with Documenter.
  • credit: boolean that controls the addition of This file was generated with Literate.jl ... to the bottom of the page. If you find Literate.jl useful then feel free to keep this to the default, which is true.
source

Notebook metadata

Jupyter notebook cells (both code cells and markdown cells) can contain metadata. This is enabled in Literate by the %% token, similar to Jupytext. The format is as follows

%% optional ignored text [type] {optional metadata JSON}

Cell metadata can, for example, be used for nbgrader and the reveal.js notebook extension RISE.

4.3. Script Output

The (default) script output of the source snippet above is as follows

x = 1//3
+```

We note that lines starting with # are printed as regular markdown, and the code lines have been wrapped in @example blocks. We also note that an @meta block have been added, that sets the EditURL variable. This is used by Documenter to redirect the "Edit on GitHub" link for the page, see Interaction with Documenter.

Some of the output rendering can be controlled with keyword arguments to Literate.markdown:

Literate.markdownFunction.
Literate.markdown(inputfile, outputdir; kwargs...)

Generate a markdown file from inputfile and write the result to the directory outputdir.

Keyword arguments:

  • name: name of the output file, excluding .md; name is also used to name all the @example blocks, and to replace @__NAME__. Defaults to the filename of inputfile.
  • preprocess, postprocess: custom pre- and post-processing functions, see the Custom pre- and post-processing section of the manual. Defaults to identity.
  • documenter: boolean that tells if the output is intended to use with Documenter.jl. Defaults to true. See the manual section on Interaction with Documenter.
  • codefence: A Pair of opening and closing code fence. Defaults to
    "```@example $(name)" => "```"
    if documenter = true and
    "```julia" => "```"
    if documenter = false.
  • credit: boolean that controls the addition of This file was generated with Literate.jl ... to the bottom of the page. If you find Literate.jl useful then feel free to keep this to the default, which is true.
source

4.2. Notebook Output

The (default) notebook output of the source snippet can be seen here: notebook.ipynb.

We note that lines starting with # are placed in markdown cells, and the code lines have been placed 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 Literate.notebook:

Literate.notebookFunction.
Literate.notebook(inputfile, outputdir; kwargs...)

Generate a notebook from inputfile and write the result to outputdir.

Keyword arguments:

  • name: name of the output file, excluding .ipynb. name is also used to replace @__NAME__. Defaults to the filename of inputfile.
  • preprocess, postprocess: custom pre- and post-processing functions, see the Custom pre- and post-processing section of the manual. Defaults to identity.
  • execute: a boolean deciding if the generated notebook should also be executed or not. Defaults to true. The current working directory is set to outputdir when executing the notebook.
  • documenter: boolean that says if the source contains Documenter.jl specific things to filter out during notebook generation. Defaults to true. See the the manual section on Interaction with Documenter.
  • credit: boolean that controls the addition of This file was generated with Literate.jl ... to the bottom of the page. If you find Literate.jl useful then feel free to keep this to the default, which is true.
source

Notebook metadata

Jupyter notebook cells (both code cells and markdown cells) can contain metadata. This is enabled in Literate by the %% token, similar to Jupytext. The format is as follows

%% optional ignored text [type] {optional metadata JSON}

Cell metadata can, for example, be used for nbgrader and the reveal.js notebook extension RISE.

4.3. Script Output

The (default) script output of the source snippet above is as follows

x = 1//3
 
 y = 2//5
 
-z = x + y

We note that lines starting with # are removed and only the code lines have been kept. Some of the output rendering can be controlled with keyword arguments to Literate.script:

Literate.scriptFunction
Literate.script(inputfile, outputdir; kwargs...)

Generate a plain script file from inputfile and write the result to outputdir.

Keyword arguments:

  • name: name of the output file, excluding .jl. name is also used to replace @__NAME__. Defaults to the filename of inputfile.
  • preprocess, postprocess: custom pre- and post-processing functions, see the Custom pre- and post-processing section of the manual. Defaults to identity.
  • documenter: boolean that says if the source contains Documenter.jl specific things to filter out during script generation. Defaults to true. See the the manual section on Interaction with Documenter.
  • keep_comments: boolean that, if set to true, keeps markdown lines as comments in the output script. Defaults to false.
  • credit: boolean that controls the addition of This file was generated with Literate.jl ... to the bottom of the page. If you find Literate.jl useful then feel free to keep this to the default, which is true.
source
+z = x + y

We note that lines starting with # are removed and only the code lines have been kept. Some of the output rendering can be controlled with keyword arguments to Literate.script:

Literate.scriptFunction.
Literate.script(inputfile, outputdir; kwargs...)

Generate a plain script file from inputfile and write the result to outputdir.

Keyword arguments:

  • name: name of the output file, excluding .jl. name is also used to replace @__NAME__. Defaults to the filename of inputfile.
  • preprocess, postprocess: custom pre- and post-processing functions, see the Custom pre- and post-processing section of the manual. Defaults to identity.
  • documenter: boolean that says if the source contains Documenter.jl specific things to filter out during script generation. Defaults to true. See the the manual section on Interaction with Documenter.
  • keep_comments: boolean that, if set to true, keeps markdown lines as comments in the output script. Defaults to false.
  • credit: boolean that controls the addition of This file was generated with Literate.jl ... to the bottom of the page. If you find Literate.jl useful then feel free to keep this to the default, which is true.
source
diff --git a/dev/pipeline.html b/dev/pipeline.html index 8b5f6e7..3827a58 100644 --- a/dev/pipeline.html +++ b/dev/pipeline.html @@ -1,5 +1,5 @@ -3. Processing pipeline · Literate.jl

3. Processing pipeline

The generation of output follows the same pipeline for all output formats:

  1. Pre-processing
  2. Parsing
  3. Document generation
  4. Post-processing
  5. Writing to file

3.1. Pre-processing

The first step is pre-processing of the input file. The file is read to a String. The first processing step is to apply the user specified pre-processing function, see Custom pre- and post-processing.

The next step is to perform all of the built-in default replacements. CRLF style line endings ("\r\n") are replaced with LF line endings ("\n") to simplify internal processing. Next, line filtering is performed, see Filtering Lines, meaning that lines starting with #md, #nb or #jl are handled (either just the token itself is removed, or the full line, depending on the output target). The last pre-processing step is to expand the convenience "macros" described in Default Replacements is expanded.

3.2. Parsing

After the preprocessing the file is parsed. The first step is to categorize each line and mark them as either markdown or code according to the rules described in the Syntax section. Lets consider the example from the previous section with each line categorized:

# # Rational numbers                                                     <- markdown
+3. Processing pipeline · Literate.jl

3. Processing pipeline

The generation of output follows the same pipeline for all output formats:

  1. Pre-processing
  2. Parsing
  3. Document generation
  4. Post-processing
  5. Writing to file

3.1. Pre-processing

The first step is pre-processing of the input file. The file is read to a String. The first processing step is to apply the user specified pre-processing function, see Custom pre- and post-processing.

The next step is to perform all of the built-in default replacements. CRLF style line endings ("\r\n") are replaced with LF line endings ("\n") to simplify internal processing. Next, line filtering is performed, see Filtering Lines, meaning that lines starting with #md, #nb or #jl are handled (either just the token itself is removed, or the full line, depending on the output target). The last pre-processing step is to expand the convenience "macros" described in Default Replacements is expanded.

3.2. Parsing

After the preprocessing the file is parsed. The first step is to categorize each line and mark them as either markdown or code according to the rules described in the Syntax section. Lets consider the example from the previous section with each line categorized:

# # Rational numbers                                                     <- markdown
 #                                                                        <- markdown
 # In julia rational numbers can be constructed with the `//` operator.   <- markdown
 # Lets define two rational numbers, `x` and `y`:                         <- markdown
@@ -29,4 +29,4 @@ x = 1 // 3
 y = 2 // 5

Chunk #3:

When adding `x` and `y` together we obtain a new rational number:

Chunk #4:

z = x + y

It is then up to the Document generation step to decide how these chunks should be treated.

Custom control over chunk splits

Sometimes it is convenient to be able to manually control how the chunks are split. For example, if you want to split a block of code into two, such that they end up in two different @example blocks or notebook cells. The #- token can be used for this purpose. All lines starting with #- are used as "chunk-splitters":

x = 1 // 3
 y = 2 // 5
 #-
-z = x + y

The example above would result in two consecutive code-chunks.

Tip

The rest of the line, after #-, is discarded, so it is possible to use e.g. #------------- as a chunk splitter, which may make the source code more readable.

It is also possible to use #+ as a chunk splitter. The difference between #+ and #- is that #+ enables Documenter's "continued"-blocks, see the Documenter manual.

3.3. Document generation

After the parsing it is time to generate the output. What is done in this step is very different depending on the output target, and it is describe in more detail in the Output format sections: Markdown Output, Notebook Output and Script Output. Using the default settings, the following is happening:

  • Markdown output: markdown chunks are printed as-is, code chunks are put inside a code fence (defaults to @example-blocks),
  • Notebook output: markdown chunks are printed in markdown cells, code chunks are put in code cells,
  • Script output: markdown chunks are discarded, code chunks are printed as-is.

3.4. Post-processing

When the document is generated the user, again, has the option to hook-into the generation with a custom post-processing function. The reason is that one might want to change things that are only visible in the rendered document. See Custom pre- and post-processing.

3.5. Writing to file

The last step of the generation is writing to file. The result is written to $(outputdir)/$(name)(.md|.ipynb|.jl) where outputdir is the output directory supplied by the user (for example docs/generated), and name is a user supplied filename. It is recommended to add the output directory to .gitignore since the idea is that the generated documents will be generated as part of the build process rather than beeing files in the repo.

+z = x + y

The example above would result in two consecutive code-chunks.

Tip

The rest of the line, after #-, is discarded, so it is possible to use e.g. #------------- as a chunk splitter, which may make the source code more readable.

It is also possible to use #+ as a chunk splitter. The difference between #+ and #- is that #+ enables Documenter's "continued"-blocks, see the Documenter manual.

3.3. Document generation

After the parsing it is time to generate the output. What is done in this step is very different depending on the output target, and it is describe in more detail in the Output format sections: Markdown Output, Notebook Output and Script Output. Using the default settings, the following is happening:

  • Markdown output: markdown chunks are printed as-is, code chunks are put inside a code fence (defaults to @example-blocks),
  • Notebook output: markdown chunks are printed in markdown cells, code chunks are put in code cells,
  • Script output: markdown chunks are discarded, code chunks are printed as-is.

3.4. Post-processing

When the document is generated the user, again, has the option to hook-into the generation with a custom post-processing function. The reason is that one might want to change things that are only visible in the rendered document. See Custom pre- and post-processing.

3.5. Writing to file

The last step of the generation is writing to file. The result is written to $(outputdir)/$(name)(.md|.ipynb|.jl) where outputdir is the output directory supplied by the user (for example docs/generated), and name is a user supplied filename. It is recommended to add the output directory to .gitignore since the idea is that the generated documents will be generated as part of the build process rather than beeing files in the repo.

diff --git a/dev/search.html b/dev/search.html index 058ffbe..0d8e508 100644 --- a/dev/search.html +++ b/dev/search.html @@ -1,2 +1,2 @@ -Search · Literate.jl

Loading search...

    +Search · Literate.jl

    Loading search...