Skip to content

wustites/mdbook-summarizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mdbook-summarizer

中文文档

Generate an mdBook SUMMARY.md from a source tree.

This is a Rust CLI port of the original generate_summary.py workflow. By default it scans src and writes src/SUMMARY.md.

Installation

cargo install mdbook-summarizer

Usage

mdbook-summarizer
mdbook-summarizer --src src
mdbook-summarizer --src src --output src/SUMMARY.md
mdbook-summarizer --auto-readme
mdbook-summarizer --dry-run
mdbook-summarizer --check

Options

Flag Description
--src <DIR> Source directory to scan (default: src)
-o, --output <FILE> Output file (default: <src>/SUMMARY.md)
--auto-readme Generate README.md (# dirname) for dirs without an index
--dry-run Print generated content without writing
--check Exit with error if output is stale
-h, --help Print help
-V, --version Print version

Behavior

  • Treats README.md or index.md as a directory entry.
  • Extracts the first level-one Markdown heading as the title.
  • Falls back to a title-cased file stem when no heading exists.
  • --auto-readme generates README.md (# dirname) for dirs without an index.
  • Skips generated SUMMARY.md, dot directories, and common temporary files.
  • Sorts directories before files, with natural numeric ordering.

CI Integration

Use --check in CI to keep SUMMARY.md in sync:

mdbook-summarizer --check || (echo "SUMMARY.md is stale" && exit 1)

License

MIT

About

Generate mdBook SUMMARY.md from a source tree

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages