Documentation Book (book)
The book workload compiles folders of Markdown manuscripts into structured, responsive, book-shaped documentation portals.
Powered by mdbind (github.com/krewire/mdbind), the book engine operates with zero external dependencies and compiles hundreds of documentation pages into static HTML in less than 15 milliseconds.
Architectural Characteristics
- Pure Go Standard Library: Zero npm scripts, no Python runtime, and no Node.js dependencies.
- Automated Chapter Ordering: Files and directories with numeric prefixes (
01-overview,02-guide) are automatically converted into numbered chapters and subchapters with clean URL slugs. - Responsive Navigation & Search: Built-in collapsible sidebar, quick chapter search filter, keyboard shortcut navigation (
/to search), and breadcrumbs. - Instant Live Authoring:
mdbind serveprovides a local HTTP server that re-renders Markdown files dynamically on browser refresh. - Dark & Light Theming: Built-in theme switcher with automatic OS preference detection and
localStoragepersistence.
Scaffolding a book Project
kiw new my-book --book
cd my-book
Directory layout:
my-book/
โโโ krewire.yaml # Project configuration
โโโ content/ # Documentation manuscript files
โโโ 01-introduction/
โ โโโ index.md # Chapter 1 overview
โ โโโ 01-welcome.md # Subchapter 1.1
โ โโโ 02-setup.md # Subchapter 1.2
โโโ 02-architecture/
โ โโโ index.md # Chapter 2 overview
โ โโโ 01-layers.md # Subchapter 2.1
โโโ 03-api/
โโโ index.md # Chapter 3 overview
Chapter Ordering Rules
mdbind uses deterministic naming rules to generate human-friendly navigation:
| Directory or File Name | Number | Slug | Display Title |
|---|---|---|---|
01-introduction |
1 | introduction |
1. Introduction |
01-welcome.md |
1.1 | welcome |
1.1 Welcome to the Guide |
02-getting-started |
2 | getting-started |
2. Getting Started |
01-installation.md |
2.1 | installation |
2.1 Installation |
[!NOTE] Titles are extracted automatically from the first
# Headingin each Markdown file. If no heading is present, the slug is formatted as the title.
Frontmatter Support
mdbind tolerates YAML frontmatter blocks, allowing manuscript files to be shared seamlessly with SSG collections:
---
title: "Installation Guide"
description: "How to set up the toolchain on Linux and macOS"
date: "2026-10-08"
---
# Installation Guide
Follow the instructions below to install the binaries...
The frontmatter is automatically stripped before Markdown rendering, ensuring clean HTML output.
Configuration (krewire.yaml)
project:
name: "ecosystem-docs"
kind: book
version: "0.1.0"
# Source directory containing markdown manuscripts
input: "content"
build:
output: ".krewire/build"
base: "/"
Standalone CLI Usage (mdbind)
mdbind can also be run standalone without kiw:
# Build book to dist/
mdbind build --input content --output dist
# Serve book locally with live re-rendering
mdbind serve --input content --port 8080