Skip to content

piever/Remark.jl

Repository files navigation

Remark

CI codecov.io

A simple Julia package to create presentations from markdown using Remark.

Example use

To install type the following command in the Julia Pkg REPL

(v1.0) pkg> add Remark

Check out the Remark docs on how to write the markdown for a Remark slideshow. The most important thing is to use --- to separate slides; an example markdown file can be found here.

import Remark

# Generate a presentation (html+markdown) from the markdown template
# and save it in the folder "presentation", which should not exist when this is called.
Remark.generate("presentation")
slideshowdir = Remark.slideshow("presentation",
                                options = Dict("ratio" => "16:9"),
                                title = "My beautiful slides")

# Open presentation in default browser.
Remark.open(slideshowdir)

The presentation folder will also include a make.jl file that can be used to automatically rebuild the presentation (it is enough to include it). Of course, the make.jl file can be customized to fit your needs, e.g., setting keyword arguments of Remark.slideshow or activating a Project.toml file for reproducibility.

It is also possible to use a julia file as a starting point (i.e., index.jl), thanks to the Literate package. As explained in the Literate documentation, add a comment to slides corresponding to markdown. A slide separator is now # --- for example.

To get started, simple do:

import Remark

# Generate a presentation (html+markdown) from the julia template
# and save it in the folder "julia_presentation".
julia_template = joinpath(dirname(dirname(pathof(Remark))), "examples", "julia")
cp(julia_template, "julia_presentation")
slideshowdir = Remark.slideshow("julia_presentation",
                                options = Dict("ratio" => "16:9"),
                                title = "My beautiful slides")

# Open presentation in default browser.
Remark.open(slideshowdir)

External assets, styling, and customization

If you need extra assets, simply add a assets folder inside src. It will be copied in the build folder automatically.

If you want to use a custom stylesheet rather than the default, simply add a style.css file in your src folder. Your overall folder structure would be:

presentation/
├── src/
│   └── index.md (or .jl)
│   └── style.css
│   └── assets/
├── build/ (generated by the package)
│   └── index.html
│   └── style.css
│   └── assets/

The title of the presentation can be customized via the title keyword. Remark.js options can be set using the options keyword. Documenter is run on the markdown by default: to keep the markdown as is, use documenter=false.

Features

  • The slideshow command creates a slideshow that uses local javascript libraries: the resulting presentation folder can be opened offline.

  • All features of Documenter are automatically available here, for example use # hide at the end of a line of code for it to not appear in the slideshow (useful for saving plots, see example).