Skip to content
Grimoire

Commands

Five commands. Every flag has a long form; the common ones have a short form too, and --help on any command prints the same table.

sh
grimoire --help          # the command list
grimoire build --help    # one command's flags
grimoire --version

A flag always wins over grimoire.toml, so a one-off build needs no edit to the file.

grimoire build

Render the site.

FlagDefaultWhat it does
-c, --config PATHgrimoire.tomlwhich configuration file to read
-s, --src DIRfrom configthe directory of Markdown to build
-o, --out DIRfrom configwhere to write the site
-t, --theme NAMEfrom configtheme to use; grimoire themes lists them
-m, --mode MODEfrom configfirst-visit colour mode: auto, light, dark
--pdfoffalso render the book to PDF
--no-searchoffskip the search index and the search UI
-j, --jobs N0chapters to render in parallel; 0 is one per CPU
-v, --verboseoffreport each chapter as it is rendered
-q, --quietoffprint nothing on success
sh
grimoire build
grimoire build --theme nordic --out /tmp/preview
grimoire build --pdf --jobs 4

The exit status is 1 when the outline names a chapter with no file behind it - the rest of the book still builds, and the missing entries are reported on stderr.

grimoire pdf

Render only the PDF, skipping the site.

FlagDefaultWhat it does
-c, --config PATHgrimoire.tomlwhich configuration file to read
-s, --src DIRfrom configthe directory of Markdown to build
-o, --out DIRfrom configwhere to write the PDF
-v, --verboseoffreport each chapter as it is laid out
--output FILEfrom configPDF filename, relative to the output directory
--paper SIZEfrom configa4 or letter
sh
grimoire pdf
grimoire pdf --paper letter --output manual.pdf

grimoire serve

Build, then serve the result on a local address until interrupted.

FlagDefaultWhat it does
-c, --config PATHgrimoire.tomlwhich configuration file to read
-s, --src DIRfrom configthe directory of Markdown to build
-o, --out DIRfrom configwhich directory to serve
-v, --verboseoffreport each chapter as it is rendered
-a, --addr ADDR127.0.0.1:8080address to listen on
--no-buildoffserve what is already there, without rebuilding
sh
grimoire serve
grimoire serve --addr 0.0.0.0:9000 --no-build

The server runs a small pool of accept loops, because a browser asks for the page, the stylesheet, the runtime, and (on the first search) the index in parallel; a single-threaded loop would serialise them. It needs the default jennifer binary - jennifer-tiny stubs httpd and says so.

grimoire init [dir]

Write a starter book - grimoire.toml, a SUMMARY.md, and three chapters - into dir, or into the current directory if none is given.

sh
grimoire init my-book

Existing files are never overwritten. Running it twice is safe: the second run reports each file it kept, which also makes it a way to add the pieces you deleted back.

grimoire themes

List the built-in themes with a one-line description of each. See Themes for what they look like.

Verbose output

--verbose names each chapter as it goes, which is how you find the one that is slow or throwing:

$ grimoire build --verbose --jobs 1
building docs -> site (theme grimoire, 13 chapters, 1 job)
  render  index.md  ->  index.html
  render  guide/syntax.md  ->  guide/syntax.html
  ...
  assets  stylesheet, runtime, search index
  copied  2 files from docs

Chapters render in parallel, so with the default --jobs the lines arrive in the order chapters finish, not the order they are listed. Pass --jobs 1 when you want outline order.

--verbose and --quiet are not exclusive: verbose adds progress, quiet suppresses the closing summary. Passing both gives progress and no summary.