Initialize an mdpress project in a directory. It has two modes:
- If the directory already contains Markdown files, scan the structure and generate
book.yaml - If the directory has no Markdown files, create a minimal starter template
mdpress init [directory] [flags]| Argument | Required | Description |
|---|---|---|
[directory] |
No | Target directory. If omitted, the current directory is used. |
| Flag | Default | Description |
|---|---|---|
-i, --interactive |
off | Use interactive prompts for title, author, language, and theme. |
-v, --verbose |
off | Print detailed logs. |
-q, --quiet |
off | Print errors only. |
mdpress init ./my-bookThe current implementation:
- Recursively scans
.mdfiles - Uses the first H1 in each file as the chapter title
- Generates
book.yaml - Detects
SUMMARY.md,GLOSSARY.md, andLANGS.md - Auto-detects common cover filenames such as
cover.png,cover.jpg, andcover.svg
If the target directory has no Markdown files, the command creates a minimal project skeleton with:
book.yamlpreface.mdchapter01/README.md
mdpress init --interactive
mdpress init ./my-book -iInteractive mode asks for:
- Title
- Author
- Language
- Theme
If the current terminal is not interactive, the command falls back to default values.
mdpress init
mdpress init ./docs-book
mdpress init --interactive
mdpress init ./docs-book -i- If
book.yamlalready exists in the target directory, the command fails instead of overwriting it. - When scanning an existing project, a top-level
README.mdis currently treated as project-level introduction and skipped as a chapter file;README.mdfiles inside subdirectories are kept. - If
SUMMARY.mdis detected, the generatedbook.yamldoes not write achapterslist. Chapter structure is delegated toSUMMARY.mdduring builds. --configappears in global flags, butinitdoes not use it to change the output path. It always writesbook.yamlinto the target directory.