Franklin + Literate

You can write tutorials using Literate.jl and simply plug them in Franklin where they will be (re)evaluated and the output of code blocks shown assuming you've written @def showall = true on the page. Here's an example:

Literate example

Whatever is in comment can be Franklin-markdown, so for instance you can write maths in much the same way:

exp(iτ)=1 \exp(i\tau) = 1

This is Euler's identity following the τ\tau day manifesto.

Code:

a = 5
a^2
25

Any valid code basically:

v = ["Thom", "Martha", "Smith", "John"]
f = first.(v)
4-element Array{Char,1}:
 'T': ASCII/Unicode U+0054 (category Lu: Letter, uppercase)
 'M': ASCII/Unicode U+004D (category Lu: Letter, uppercase)
 'S': ASCII/Unicode U+0053 (category Lu: Letter, uppercase)
 'J': ASCII/Unicode U+004A (category Lu: Letter, uppercase)

So the workflow is to just write a standard Literate document using Franklin markdown in the comments and normal code. You can also hide lines:

randn()
0.2972879845354616

Or hide everything (note that for the line to be taken as comment for the code block there should be no whitespace between the # and the h).

2.046609693639258

It still shows the result though since showall = true! If you want to suppress it, just use a ; on the last line:

That's basically it.

println("done!")
done!

CC BY-SA 4.0 The Oracle. Last modified: September 13, 2023. Website built with Franklin.jl and the Julia programming language.