2 Getting started

The easiest way to get started is to use the template repository at https://github.com/JuliaBooks/BookTemplate.

From this repository, you can serve your book via:

$ julia --project -e 'using Books; serve()'
Watching ./pandoc/favicon.png
Watching ./src/plots.jl
[...]
 ✓ LiveServer listening on http://localhost:8001/ ...
  (use CTRL+C to shut down)

To generate all the Julia output (see Section 3.1 for more information) use

$ julia --project -ie  'using Books; using MyPackage'

julia> gen(; )
[...]
Updating html

where MyPackage is the name of your package. This evaluates all the code from the code blocks inside your Main module. The benefit of this is that you can easy interact with and access variables defined inside code blocks.

To avoid code duplication between projects, this package tries to have good defaults for many settings. For your project, you can override the default settings by creating config.toml and metadata.yml files. In summary, the metadata.yml file is read by Pandoc while generating the outputs. This file contains settings for the output appearance, author and more, see Section 2.1. The config.toml file is read by Books.jl before calling Pandoc, so contains settings which are essentially passed to Pandoc, see Section 2.2. Still, these defaults can be overwritten. If you also want to override the templates, then see Section 2.3.

To generate the PDF, use

julia> pdf()


CC BY-NC-SA 4.0 Rik Huijzer, and contributors