block style of highligh.js.
+ * We have to override the padding and the background-color, since we style this
+ * part ourselves. Specifically, we style the surrounding the , while
+ * highlight.js applies the .hljs style directly to the tag.
+ */
+.hljs {
+ background-color: transparent;
+ padding: 0;
+}
+
+@media only screen and (max-width: 768px) {
+ nav.toc {
+ position: fixed;
+ width: 16em;
+ left: -16em;
+ -webkit-overflow-scrolling: touch;
+ -webkit-transition-property: left; /* Safari */
+ -webkit-transition-duration: 0.3s; /* Safari */
+ transition-property: left;
+ transition-duration: 0.3s;
+ -webkit-transition-timing-function: ease-out; /* Safari */
+ transition-timing-function: ease-out;
+ z-index: 2;
+ box-shadow: 5px 0px 5px 0px rgb(210,210,210);
+ }
+
+ nav.toc.show {
+ left: 0;
+ }
+
+ article {
+ margin-left: 0;
+ padding: 3em 0.9em 0 0.9em; /* top right bottom left */
+ overflow-wrap: break-word;
+ }
+
+ article > header {
+ position: fixed;
+ left: 0;
+ z-index: 1;
+ }
+
+ article > header nav, hr {
+ display: none;
+ }
+
+ article > header div#topbar {
+ display: block; /* is mobile */
+ position: fixed;
+ width: 100%;
+ height: 1.5em;
+ padding-top: 1em;
+ padding-bottom: 1em;
+ background-color: #fcfcfc;
+ box-shadow: 0 1px 3px rgba(0,0,0,.26);
+ top: 0;
+ -webkit-transition-property: top; /* Safari */
+ -webkit-transition-duration: 0.3s; /* Safari */
+ transition-property: top;
+ transition-duration: 0.3s;
+ }
+
+ article > header div#topbar.headroom--unpinned.headroom--not-top.headroom--not-bottom {
+ top: -4em;
+ -webkit-transition-property: top; /* Safari */
+ -webkit-transition-duration: 0.7s; /* Safari */
+ transition-property: top;
+ transition-duration: 0.7s;
+ }
+
+ article > header div#topbar span {
+ width: 80%;
+ height: 1.5em;
+ margin-top: -0.1em;
+ margin-left: 0.9em;
+ font-size: 1.2em;
+ overflow: hidden;
+ }
+
+ article > header div#topbar a.fa-bars {
+ float: right;
+ padding: 0.6em;
+ margin-top: -0.6em;
+ margin-right: 0.3em;
+ font-size: 1.5em;
+ }
+
+ article > header div#topbar a.fa-bars:visited {
+ color: #3091d1;
+ }
+
+ article table {
+ overflow-x: auto;
+ display: block;
+ }
+
+ article div.MathJax_Display {
+ overflow: scroll;
+ }
+
+ article span.MathJax {
+ overflow: hidden;
+ }
+}
+
+@media only screen and (max-width: 320px) {
+ body {
+ font-size: 15px;
+ }
+}
diff --git a/v2.0.4/assets/documenter.js b/v2.0.4/assets/documenter.js
new file mode 100644
index 0000000..761ae29
--- /dev/null
+++ b/v2.0.4/assets/documenter.js
@@ -0,0 +1,132 @@
+/*
+ * Part of Documenter.jl
+ * https://github.com/JuliaDocs/Documenter.jl
+ *
+ * License: MIT
+ */
+
+requirejs.config({
+ paths: {
+ 'jquery': 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min',
+ 'jqueryui': 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.0/jquery-ui.min',
+ 'headroom': 'https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.3/headroom.min',
+ 'mathjax': 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS_HTML',
+ 'highlight': 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min',
+ 'highlight-julia': 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/languages/julia.min',
+ 'highlight-julia-repl': 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/languages/julia-repl.min',
+ },
+ shim: {
+ 'mathjax' : {
+ exports: "MathJax"
+ },
+ 'highlight-julia': ['highlight'],
+ 'highlight-julia-repl': ['highlight'],
+ }
+});
+
+// Load MathJax
+require(['mathjax'], function(MathJax) {
+ MathJax.Hub.Config({
+ "tex2jax": {
+ inlineMath: [['$','$'], ['\\(','\\)']],
+ processEscapes: true
+ }
+ });
+ MathJax.Hub.Config({
+ config: ["MMLorHTML.js"],
+ jax: [
+ "input/TeX",
+ "output/HTML-CSS",
+ "output/NativeMML"
+ ],
+ extensions: [
+ "MathMenu.js",
+ "MathZoom.js",
+ "TeX/AMSmath.js",
+ "TeX/AMSsymbols.js",
+ "TeX/autobold.js",
+ "TeX/autoload-all.js"
+ ]
+ });
+ MathJax.Hub.Config({
+ TeX: { equationNumbers: { autoNumber: "AMS" } }
+ });
+})
+
+require(['jquery', 'highlight', 'highlight-julia', 'highlight-julia-repl'], function($, hljs) {
+ $(document).ready(function() {
+ hljs.initHighlighting();
+ })
+
+})
+
+// update the version selector with info from the siteinfo.js and ../versions.js files
+require(['jquery'], function($) {
+ $(document).ready(function() {
+ var version_selector = $("#version-selector");
+
+ // add the current version to the selector based on siteinfo.js, but only if the selector is empty
+ if (typeof DOCUMENTER_CURRENT_VERSION !== 'undefined' && $('#version-selector > option').length == 0) {
+ var option = $("");
+ version_selector.append(option);
+ }
+
+ if (typeof DOC_VERSIONS !== 'undefined') {
+ var existing_versions = $('#version-selector > option');
+ var existing_versions_texts = existing_versions.map(function(i,x){return x.text});
+ DOC_VERSIONS.forEach(function(each) {
+ var version_url = documenterBaseURL + "/../" + each;
+ var existing_id = $.inArray(each, existing_versions_texts);
+ // if not already in the version selector, add it as a new option,
+ // otherwise update the old option with the URL and enable it
+ if (existing_id == -1) {
+ var option = $("");
+ version_selector.append(option);
+ } else {
+ var option = existing_versions[existing_id];
+ option.value = version_url;
+ option.disabled = false;
+ }
+ });
+ }
+
+ // only show the version selector if the selector has been populated
+ if ($('#version-selector > option').length > 0) {
+ version_selector.css("visibility", "visible");
+ }
+
+ // Scroll the navigation bar to the currently selected menu item
+ $("nav.toc > ul").get(0).scrollTop = $(".current").get(0).offsetTop - $("nav.toc > ul").get(0).offsetTop;
+ })
+
+})
+
+// mobile
+require(['jquery', 'headroom'], function($, Headroom) {
+ $(document).ready(function() {
+ var navtoc = $("nav.toc");
+ $("nav.toc li.current a.toctext").click(function() {
+ navtoc.toggleClass('show');
+ });
+ $("article > header div#topbar a.fa-bars").click(function(ev) {
+ ev.preventDefault();
+ navtoc.toggleClass('show');
+ if (navtoc.hasClass('show')) {
+ var title = $("article > header div#topbar span").text();
+ $("nav.toc ul li a:contains('" + title + "')").focus();
+ }
+ });
+ $("article#docs").bind('click', function(ev) {
+ if ($(ev.target).is('div#topbar a.fa-bars')) {
+ return;
+ }
+ if (navtoc.hasClass('show')) {
+ navtoc.removeClass('show');
+ }
+ });
+ if ($("article > header div#topbar").css('display') == 'block') {
+ var headroom = new Headroom(document.querySelector("article > header div#topbar"), {"tolerance": {"up": 10, "down": 10}});
+ headroom.init();
+ }
+ })
+})
diff --git a/v2.0.4/assets/logo.png b/v2.0.4/assets/logo.png
new file mode 100644
index 0000000..73e1c94
Binary files /dev/null and b/v2.0.4/assets/logo.png differ
diff --git a/v2.0.4/assets/search.js b/v2.0.4/assets/search.js
new file mode 100644
index 0000000..5d32c3a
--- /dev/null
+++ b/v2.0.4/assets/search.js
@@ -0,0 +1,250 @@
+/*
+ * Part of Documenter.jl
+ * https://github.com/JuliaDocs/Documenter.jl
+ *
+ * License: MIT
+ */
+
+// parseUri 1.2.2
+// (c) Steven Levithan
+// MIT License
+function parseUri (str) {
+ var o = parseUri.options,
+ m = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
+ uri = {},
+ i = 14;
+
+ while (i--) uri[o.key[i]] = m[i] || "";
+
+ uri[o.q.name] = {};
+ uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {
+ if ($1) uri[o.q.name][$1] = $2;
+ });
+
+ return uri;
+};
+parseUri.options = {
+ strictMode: false,
+ key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],
+ q: {
+ name: "queryKey",
+ parser: /(?:^|&)([^&=]*)=?([^&]*)/g
+ },
+ parser: {
+ strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
+ loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
+ }
+};
+
+requirejs.config({
+ paths: {
+ 'jquery': 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min',
+ 'lunr': 'https://cdnjs.cloudflare.com/ajax/libs/lunr.js/2.3.5/lunr.min',
+ 'lodash': 'https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.min',
+ }
+});
+
+var currentScript = document.currentScript;
+
+require(["jquery", "lunr", "lodash"], function($, lunr, _) {
+ $("#search-form").submit(function(e) {
+ e.preventDefault()
+ })
+
+ // list below is the lunr 2.1.3 list minus the intersect with names(Base)
+ // (all, any, get, in, is, which) and (do, else, for, let, where, while, with)
+ // ideally we'd just filter the original list but it's not available as a variable
+ lunr.stopWordFilter = lunr.generateStopWordFilter([
+ 'a',
+ 'able',
+ 'about',
+ 'across',
+ 'after',
+ 'almost',
+ 'also',
+ 'am',
+ 'among',
+ 'an',
+ 'and',
+ 'are',
+ 'as',
+ 'at',
+ 'be',
+ 'because',
+ 'been',
+ 'but',
+ 'by',
+ 'can',
+ 'cannot',
+ 'could',
+ 'dear',
+ 'did',
+ 'does',
+ 'either',
+ 'ever',
+ 'every',
+ 'from',
+ 'got',
+ 'had',
+ 'has',
+ 'have',
+ 'he',
+ 'her',
+ 'hers',
+ 'him',
+ 'his',
+ 'how',
+ 'however',
+ 'i',
+ 'if',
+ 'into',
+ 'it',
+ 'its',
+ 'just',
+ 'least',
+ 'like',
+ 'likely',
+ 'may',
+ 'me',
+ 'might',
+ 'most',
+ 'must',
+ 'my',
+ 'neither',
+ 'no',
+ 'nor',
+ 'not',
+ 'of',
+ 'off',
+ 'often',
+ 'on',
+ 'only',
+ 'or',
+ 'other',
+ 'our',
+ 'own',
+ 'rather',
+ 'said',
+ 'say',
+ 'says',
+ 'she',
+ 'should',
+ 'since',
+ 'so',
+ 'some',
+ 'than',
+ 'that',
+ 'the',
+ 'their',
+ 'them',
+ 'then',
+ 'there',
+ 'these',
+ 'they',
+ 'this',
+ 'tis',
+ 'to',
+ 'too',
+ 'twas',
+ 'us',
+ 'wants',
+ 'was',
+ 'we',
+ 'were',
+ 'what',
+ 'when',
+ 'who',
+ 'whom',
+ 'why',
+ 'will',
+ 'would',
+ 'yet',
+ 'you',
+ 'your'
+ ])
+
+ // add . as a separator, because otherwise "title": "Documenter.Anchors.add!"
+ // would not find anything if searching for "add!", only for the entire qualification
+ lunr.tokenizer.separator = /[\s\-\.]+/
+
+ // custom trimmer that doesn't strip @ and !, which are used in julia macro and function names
+ lunr.trimmer = function (token) {
+ return token.update(function (s) {
+ return s.replace(/^[^a-zA-Z0-9@!]+/, '').replace(/[^a-zA-Z0-9@!]+$/, '')
+ })
+ }
+
+ lunr.Pipeline.registerFunction(lunr.stopWordFilter, 'juliaStopWordFilter')
+ lunr.Pipeline.registerFunction(lunr.trimmer, 'juliaTrimmer')
+
+ var index = lunr(function () {
+ this.ref('location')
+ this.field('title')
+ this.field('text')
+ documenterSearchIndex['docs'].forEach(function(e) {
+ this.add(e)
+ }, this)
+ })
+ var store = {}
+
+ documenterSearchIndex['docs'].forEach(function(e) {
+ store[e.location] = {title: e.title, category: e.category}
+ })
+
+ $(function(){
+ function update_search(querystring) {
+ tokens = lunr.tokenizer(querystring)
+ results = index.query(function (q) {
+ tokens.forEach(function (t) {
+ q.term(t.toString(), {
+ fields: ["title"],
+ boost: 100,
+ usePipeline: false,
+ editDistance: 0,
+ wildcard: lunr.Query.wildcard.NONE
+ })
+ q.term(t.toString(), {
+ fields: ["title"],
+ boost: 10,
+ usePipeline: false,
+ editDistance: 2,
+ wildcard: lunr.Query.wildcard.NONE
+ })
+ q.term(t.toString(), {
+ fields: ["text"],
+ boost: 1,
+ usePipeline: true,
+ editDistance: 0,
+ wildcard: lunr.Query.wildcard.NONE
+ })
+ })
+ })
+ $('#search-info').text("Number of results: " + results.length)
+ $('#search-results').empty()
+ results.forEach(function(result) {
+ data = store[result.ref]
+ link = $('')
+ link.text(data.title)
+ link.attr('href', documenterBaseURL+'/'+result.ref)
+ cat = $('('+data.category+')')
+ li = $('').append(link).append(" ").append(cat)
+ $('#search-results').append(li)
+ })
+ }
+
+ function update_search_box() {
+ querystring = $('#search-query').val()
+ update_search(querystring)
+ }
+
+ $('#search-query').keyup(_.debounce(update_search_box, 250))
+ $('#search-query').change(update_search_box)
+
+ search_query_uri = parseUri(window.location).queryKey["q"]
+ if(search_query_uri !== undefined) {
+ search_query = decodeURIComponent(search_query_uri.replace(/\+/g, '%20'))
+ $("#search-query").val(search_query)
+ }
+ update_search_box();
+ })
+})
diff --git a/v2.0.4/customprocessing/index.html b/v2.0.4/customprocessing/index.html
new file mode 100644
index 0000000..faf5449
--- /dev/null
+++ b/v2.0.4/customprocessing/index.html
@@ -0,0 +1,29 @@
+
+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)
+ content = replace(content, "DATEOFTODAY" => Date(now()))
+ return content
+end
which would replace every occurrence of "DATEOFTODAY" with the current date. We would now simply give this function to the generator, for example:
Literate.markdown("input.jl", "outputdir"; preprocess = update_date)
Example: Replacing include calls with included code
Let's say that we have some individual example files file1, file2, ... etc. that are runnable and also following the style of Literate. These files could be for example used in the test suite of your package.
We want to group them all into a single page in our documentation, but we do not want to copy paste the content of file1, ... 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.
A very easy way to do this is using preprocess to interchange include statements with file content. First, create a runnable .jl following the format of Literate
# # Replace includes
+# This is an example to replace `include` calls with the actual file content.
+
+include("file1.jl")
+
+# Cool, we just saw the result of the above code snippet. Here is one more:
+
+include("file2.jl")
Let's say we have saved this file as examples.jl. Then, you want to properly define a pre-processing function:
function replace_includes(str)
+
+ included = ["file1.jl", "file2.jl"]
+
+ # Here the path loads the files from their proper directory,
+ # which may not be the directory of the `examples.jl` file!
+ path = "directory/to/example/files/"
+
+ for ex in included
+ content = read(path*ex, String)
+ str = replace(str, "include(\"$(ex)\")" => content)
+ 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.
diff --git a/v2.0.4/documenter/index.html b/v2.0.4/documenter/index.html
new file mode 100644
index 0000000..5afaf52
--- /dev/null
+++ b/v2.0.4/documenter/index.html
@@ -0,0 +1,12 @@
+
+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:
- The default code fence will change from
```julia
+# code
+```
to Documenters @example blocks:```@examples $(name)
+# code
+```
- The following
@meta 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 source file rather than the generated .md file:```@meta
+EditURL = "$(relpath(inputfile, outputdir))"
+```
Literate.notebook:
- 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 notebook. - Documenter style markdown math
```math
+\int f dx
+```
is replaced with notebook compatible$$
+\int f dx
+$$
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.