Peanutbook¶
Peanutbook is a Markdown-based format for writing books, papers, business plans, and static websites — a structured syntax and project layout for long-form, print-ready documents (textbooks, technical books, memoirs, research papers, business plans, and similar works).

It extends ordinary Markdown with chapter conventions, semantic blocks (>NOTES: … >NOTEE), figures, math, cross-references, multi-language editions, and print metadata. See What is Peanutbook? for the full definition.
The build toolchain (pip install peanutbook) turns Peanutbook source files into PDF, EPUB, DOCX, and static HTML book sites via Pandoc, LaTeX, Lua filters (including Mermaid diagram rendering), and the built-in HTML renderer.
Peanutbook uses bubble-build.
Format vs toolchain¶
| Peanutbook | peanutbook (PyPI) |
|
|---|---|---|
| Role | Authoring format (.md + peanut.config) |
Build tools (bubble-build, …) |
| You | Write and organize chapters | Install once, run to export |
pip install peanutbook
bubble-convert 1
bubble-build --style square
What Peanutbook supports¶
- Numbered chapters with title pages, preface, and appendix
- Multi-language editions (
chapter1.md,chapter1_zh.md, …) - Semantic note / important / warning blocks and custom layouts
- Figures, code listings, math, indexes, and cross-references
- Print-on-demand covers and trim sizes (KDP, Lulu, Ingram, …)
- Static HTML book sites (
book_html/) for online reading - Business plans (
bubble-bizplan,peanut-biz.config) — see Business plans - Academic papers (
bubble-paper) — see Academic papers (single- and two-column PDF previews) - Optional watermarks and PDF protection on output
Documentation map¶
| Section | Contents |
|---|---|
| What is Peanutbook? | Format definition and naming |
| Installation | Install peanutbook |
| Quick start | First build in five minutes |
| Project layout | Peanutbook source tree |
| Syntax reference | All Peanutbook Markdown extensions |
| Chapter format | Standard chapter front matter |
| Configuration | peanut.config keys |
| Theme | Colors, chapter opener, quote style (no LaTeX) |
| Multi-language | --lang, file suffixes, fonts |
| Covers & templates | Page sizes, cover folders |
| Business plans | Business-plan workflow (bubble-bizplan, peanut-biz.config) |
| Academic papers (bubble-paper) | Research-paper workflow, layout previews |
| HTML generation | Static book site (bubble-render-html) |
| Command reference | All bubble-* CLI tools |
| Python API | Converter, BookBuilder |
| System requirements | Pandoc, LaTeX, Ghostscript, qpdf |
| Watermarks · PDF protection | Post-processing |
| Cross-references troubleshooting | Fix ?? in PDF |
Package names (toolchain)¶
| Context | Name |
|---|---|
| Format | Peanutbook |
| PyPI | peanutbook (pip install peanutbook) |
| Python import | bubble |
| CLI | bubble-build, bubble-convert, bubble-render-html, bubble-batch, … |
License¶
This project is licensed under the Apache License, Version 2.0.
Contact¶
Xuan Xin — xuanxinjushi [at] gmail [dot] com