Loading...
Loading...
MD-Book documentation generator skill. Use when working with MD-Book, a modern mdbook replacement for generating HTML documentation from Markdown files. Supports syntax highlighting, live reload, Pagefind search, and Tera templates.
npx skill4agent add terraphim/terraphim-skills md-book# Build documentation (converts markdown to HTML)
md-book -i input_dir -o output_dir
# Development mode with file watching
md-book -i input_dir -o output_dir --watch
# Development with built-in server (default port 3000)
md-book -i input_dir -o output_dir --serve
# Full development mode (watch + serve on custom port)
md-book -i input_dir -o output_dir --watch --serve --port 8080| Option | Short | Description |
|---|---|---|
| | Input directory containing markdown files (required) |
| | Output directory for HTML files (required) |
| | Optional path to config file |
| | Watch for changes and rebuild |
| | Serve at http://localhost:3000 |
| Port to serve on (default: 3000) |
# Clone and build
git clone https://github.com/terraphim/md-book.git
cd md-book
cargo build --release
# Run from source
cargo run -- -i docs -o output
cargo run -- -i docs -o output --serve --watchbook.toml[book]
title = "My Documentation"
authors = ["Your Name"]
description = "Documentation description"
language = "en"
[output.html]
# Security: raw HTML in markdown is DISABLED by default
allow-html = false # Set to true only if you trust all content authors
mathjax-support = false# Override book title
MDBOOK_BOOK.TITLE="My Book" md-book -i input -o output
# Nested configuration values use underscore
MDBOOK_OUTPUT.HTML.MATHJAX_SUPPORT=true md-book -i input -o outputinput/
index.md # OPTIONAL: Custom home page content
# If present: renders your markdown as home page
# If absent: auto-generates card-based navigation
getting-started.md
configuration.md
advanced/ # Subdirectories become sections
topic1.md
topic2.md
images/ # Static assets copied to outputoutput/
index.html # Generated home page
getting-started.html
configuration.html
advanced/
topic1.html
topic2.html
css/ # Styles
js/ # JavaScript (live reload, search, syntax highlighting)
pagefind/ # Search index (if search feature enabled)```rust
fn main() {
println!("Hello, world!");
}
```
```python
def hello():
print("Hello, world!")
```# Install pagefind
cargo install pagefind
# Pagefind runs automatically during build
# Manual indexing if needed:
pagefind --site output_dir--serve --watchindex.md# Welcome to My Documentation
This is my custom home page content with full markdown support.
## Quick Links
- [Getting Started](getting-started.md)
- [Configuration](configuration.md)
- [API Reference](api/reference.md)index.mdindex.md| Template | Purpose |
|---|---|
| Individual page layout |
| Home page |
| Navigation sidebar |
| Page header |
| Page footer |
doc-toc.jssearch-modal.jsdoc-sidebar.jssimple-block.js# Setup
./scripts/setup-cloudflare.sh
# Deploy
./scripts/deploy.sh production# Build
cargo run -- -i docs -o dist
# Deploy
netlify deploy --prod --dir=dist- name: Build site
run: cargo run -- -i docs -o _site
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4# Unit tests
cargo test --lib --bins
# Integration tests
cargo test --test integration --features "tokio,search,syntax-highlighting"
# All tests
cargo test --all-targets --features "tokio,search,syntax-highlighting"
# Quality checks
make qa # Format, clippy, tests
make ci-local # Simulate CI locally# Cargo.toml features
default = ["server", "watcher", "search", "syntax-highlighting"]
server = ["warp", "tokio/full"] # Dev server with live reload
watcher = ["notify", "tokio/full"] # File watching
search = ["pagefind"] # Pagefind search integration
syntax-highlighting = ["syntect"] # Code highlighting
wasm = ["wasm-bindgen"] # WASM supportcargo build --no-default-features[output.html]
allow-html = true # WARNING: Enables XSS risk.envdocs/1PASSWORD_SETUP.mdmkdir docs
cat > docs/index.md << 'EOF'
# Welcome to My Project
This is the home page with custom content.
## Quick Start
See [Getting Started](getting-started.md) to begin.
EOF
cat > docs/getting-started.md << 'EOF'
# Getting Started
Installation and setup instructions.
EOF
md-book -i docs -o output --serve --watchmkdir docs
# No index.md - cards will be auto-generated
cat > docs/getting-started.md << 'EOF'
# Getting Started
Installation and setup instructions.
EOF
cat > docs/configuration.md << 'EOF'
# Configuration
How to configure the project.
EOF
md-book -i docs -o output --serve --watch
# Home page shows cards linking to all pages automaticallycargo install pagefind
md-book -i docs -o output # Search index generated automaticallysrc/templates/css/styles.css# Verify Rust installation
rustc --version
cargo --version
# Clean and rebuild
cargo clean
cargo build --release# Verify pagefind installed
which pagefind
# Manually run indexing
pagefind --site output_dirmd-book -i docs -o output --watch --serve