|
|
|
@ -1,51 +1,48 @@ |
|
|
|
# **1.** Introduction |
|
|
|
# **1.** Introduction |
|
|
|
|
|
|
|
|
|
|
|
Welcome to the documentation for `Literate.jl`. A simplistic package |
|
|
|
Welcome to the documentation for Literate -- a simplistic package |
|
|
|
to help you organize examples for you package documentation. |
|
|
|
for [Literate Programming](https://en.wikipedia.org/wiki/Literate_programming). |
|
|
|
|
|
|
|
|
|
|
|
### What? |
|
|
|
### What? |
|
|
|
|
|
|
|
|
|
|
|
`Literate.jl` is a package that, based on a single source file, generates markdown, |
|
|
|
Literate is a package that generate markdown pages |
|
|
|
for e.g. [Documenter.jl](https://github.com/JuliaDocs/Documenter.jl), |
|
|
|
(for e.g. [Documenter.jl](https://github.com/JuliaDocs/Documenter.jl)), and |
|
|
|
[Jupyter notebooks](http://jupyter.org/) and uncommented scripts for documentation |
|
|
|
[Jupyter notebooks](http://jupyter.org/), from the same source file. There is also |
|
|
|
of your package. |
|
|
|
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 |
|
|
|
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! |
|
|
|
be simple. In short, all you have to do is to write a commented julia script! |
|
|
|
|
|
|
|
|
|
|
|
The package consists mainly of three functions, which all takes the same script file |
|
|
|
The public interface consists mainly of three functions, which all takes the same script file |
|
|
|
as input, but generates different output: |
|
|
|
as input, but generates different output: |
|
|
|
- [`Literate.markdown`](@ref): generates a markdown file |
|
|
|
- [`Literate.markdown`](@ref): generates a markdown file |
|
|
|
- [`Literate.notebook`](@ref): generates an (optionally executed) notebook |
|
|
|
- [`Literate.notebook`](@ref): generates an (optionally executed) notebook |
|
|
|
- [`Literate.script`](@ref): generates a plain script file, removing everything |
|
|
|
- [`Literate.script`](@ref): generates a plain script file, removing all metadata |
|
|
|
that is not code |
|
|
|
and special syntax. |
|
|
|
|
|
|
|
|
|
|
|
### Why? |
|
|
|
### Why? |
|
|
|
|
|
|
|
|
|
|
|
Literate are (probably) the best way to showcase your awesome package, and examples |
|
|
|
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 |
|
|
|
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. |
|
|
|
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 |
|
|
|
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, |
|
|
|
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 |
|
|
|
for example, a notebook, and some people wants to study the source code. The aim of |
|
|
|
`Literate.jl` is to make it easy to give the user all of these options, while still |
|
|
|
Literate is to make it easy to give the user all of these options, while still |
|
|
|
keeping maintenance to a minimum. |
|
|
|
keeping maintenance to a minimum. |
|
|
|
|
|
|
|
|
|
|
|
It is quite common that packages have "example notebooks" to showcase the package. |
|
|
|
It is quite common that packages have "example notebooks" to showcase the package. |
|
|
|
Notebooks are great for this, but they are not so great with version control, like git. |
|
|
|
Notebooks are great for showcasing a package, but they are not so great with version |
|
|
|
The reason is that a notebook is a very "rich" format since it contains output and other |
|
|
|
control, like git. The reason being that a notebook is a very "rich" format since it |
|
|
|
metadata. Changes to the notebook thus result in large diffs, which makes it harder to |
|
|
|
contains output and other metadata. Changes to the notebook thus result in large diffs, |
|
|
|
review the actual changes. |
|
|
|
which makes it harder to review the actual changes. |
|
|
|
|
|
|
|
|
|
|
|
It is also common that packages include examples in the documentation, for example |
|
|
|
It is also common that packages include examples in the documentation, for example |
|
|
|
by using [Documenter.jl](https://github.com/JuliaDocs/Documenter.jl) `@example`-blocks. |
|
|
|
by using [Documenter.jl](https://github.com/JuliaDocs/Documenter.jl) `@example`-blocks. |
|
|
|
This is also great, but it is not quite as interactive as a notebook, for the users |
|
|
|
This is also great, but it is not quite as interactive as a notebook, for the users |
|
|
|
who prefer that. |
|
|
|
who prefer that. |
|
|
|
|
|
|
|
|
|
|
|
`Literate.jl` tries to solve the problems above by creating the output as a part of the doc |
|
|
|
Literate tries to solve the problems above by creating the output as a part of the doc |
|
|
|
build. `Literate.jl` generates the output from a single source file which makes it easier to |
|
|
|
build. Literate generates the output based on a single source file which makes it |
|
|
|
maintain, test, and keep the manual and your example notebooks in sync. |
|
|
|
easier to maintain, test, and keep the manual and your example notebooks in sync. |
|
|
|
|
|
|
|
|
|
|
|
### How? |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TBD |
|
|
|
|
|
|
|
|