gleebook

Package Version Hex Docs

A fast, zero-config static site generator for books and documentation, written in Gleam. Point it at a folder of Markdown files and a SUMMARY.md, and it builds a themed, searchable-by-eye site with a collapsible sidebar, syntax highlighting and live reload — in the spirit of mdBook, but built on Lustre, Wisp and Mist.

Features

Installation

Standalone release (no Gleam toolchain required)

Every GitHub release ships a prebuilt gleebook binary (currently only for linux-amd64).No Gleam compiler and no host project needed.

# Download the latest release and make it executable
# Download release from https://github.com/v4rm4n/gleebook/releases/tag/v0.1.1
chmod +x gleebook

# Optional: put it on your PATH
mv gleebook ~/.local/bin/

Then run it from the directory that contains (or will contain) your book/ folder:

gleebook init
gleebook serve --port=3000
gleebook build

On Windows, run it through the Erlang launcher instead: escript gleebook build.

As a Gleam dependency

If you already have a Gleam project, or want one to host the book, add Gleebook and run it through gleam run:

gleam add gleebook@1
gleam run -m gleebook init

The commands below are written in this form. With the standalone release, replace gleam run -m gleebook with gleebook.

Writing your book

book/SUMMARY.md

The summary defines the book title and the sidebar. The first level-one heading is the title; each list item is a chapter, and indenting by two spaces nests it under the item above.

# My Book

- [Introduction](index.md)
- [Getting Started](getting-started.md)
  - [Installation](getting-started/installation.md)
  - [First Steps](getting-started/first-steps.md)
- [Reference]()
  - [CLI](reference/cli.md)
  - [Configuration](reference/config.md)

An entry with an empty link, like [Reference](), is a label-only group: it appears in the sidebar as a heading for its children but has no page of its own. Chapters can live in subdirectories; the output mirrors the same structure.

Links between pages are written with the .md extension (so they work in your editor and on GitHub) and are rewritten to .html at build time.

Markdown support

SyntaxResult
**bold**, *italic*, ~~strike~~, `code`Inline formatting
# … ######Headings
- item / 1. itemBullet and ordered lists, nested by indentation
- [ ] task / - [x] doneTask lists
> noteRendered as an accented callout box
| a | b | with a | - | - | rowTables (:-: centre, -: right)
[^1] and [^1]: …Footnotes, collected at the end of the page
![alt](image.png)Images
![title](https://youtu.be/…)Embedded YouTube player
```gleamHighlighted code block with a copy button
---Thematic break

Raw HTML blocks are replaced with a warning in the rendered page rather than being passed through.

Theming

The sidebar toggle switches between the two built-in themes and remembers the choice in localStorage. You can also force a theme with a query parameter, which is preserved as you navigate:

index.html?theme=cyberpunk
index.html?theme=olive

To customise colours, create book/custom.css. It is copied into the build and loaded after the built-in styles, so you can override any of the theme variables:

[data-theme='cyberpunk'] {
  --gb-bg: #0b0b12;
  --gb-accent: #7dd3fc;
}

[data-theme='olive'] {
  --gb-accent: #b45309;
}

Variables available on both themes:

VariablePurpose
--gb-bg, --gb-textPage background and body text
--gb-sidebar, --gb-borderSidebar background and borders
--gb-accentBrand colour, links, active nav item
--gb-nav-text, --gb-nav-hover, --gb-nav-activeSidebar link states
--gb-code-bg, --gb-code-bar, --gb-code-bar-textCode block body and title bar
--gb-calloutCallout background
--gb-syn-keyword, --gb-syn-func, --gb-syn-string, --gb-syn-num, --gb-syn-comment, --gb-syn-punctSyntax highlighting palette

Any other CSS works too — the content column carries the gleebook-prose class, so .gleebook-prose h2 { … } is a safe hook.

Project layout

my_book/
├── gleam.toml
├── assets/              # static files, copied to build/gleebook/assets/
├── book/
│   ├── SUMMARY.md       # title + sidebar structure
│   ├── custom.css       # optional theme overrides
│   ├── index.md
│   └── ...
└── build/
    └── gleebook/        # generated site (git-ignore this)
        ├── index.html
        ├── assets/
        └── ...

Deploying

build/gleebook/ is a self-contained static site. Deploy it like any other: GitHub Pages, Netlify, Cloudflare Pages, an S3 bucket, or a plain web server. Links are relative, so the site works from a sub-path as well as from a domain root.

CLI reference

CommandDescription
gleam run -m gleebook initCreate book/ with a starter SUMMARY.md and index.md
gleam run -m gleebook buildCompile the book into build/gleebook/
gleam run -m gleebook serve [--port N]Build, then serve locally with file watching and live reload (default port 8000)

build exits with an error summary if any chapter listed in SUMMARY.md has no matching Markdown file; a placeholder 404 page is generated in its place so the rest of the site still builds.

Requirements

Development

gleam build            # Build the project
gleam test             # Run the tests
gleam run -m gleebook serve   # Dogfood the docs in ./book

Further documentation can be found at https://gleebook.hexdocs.pm/.

Licence

MIT — see LICENCE.

Search Document