- parse md, mdx or gfm files thanks to markdown-rs
- tera templates for easy hacking
- Beautiful default styling
- Right hand TOC to navigate around the page.
- Create index.md to create a content for home page, alternatively it will create a list of cards with all the pages as index.
- Code blocks with syntax highlighting on server side using syntect
Checkout the source code and run:
cargo run -- -i ../mdBook/test_book -o ./test_mdbook-i is the input directory and -o is the output directory. input directory is the directory with md files.
The tool will generate the input directory with markdown files and the output directory with HTML files ready to be deployed on any static site.
Adjust the styling in the src/templates/css/styles.css file.
Or anything you want to change in the src/templates folder. It's a standard Tera template, so you can add your own custom stuff there.
- Nicer default styling for content - multiple columns for horizontal layout,
- Right-hand TOC to navigate around the page.
- Create index.md to create content for the home page; alternatively, it will create a list of cards with all the pages as an index.
-
Code blocks with syntax highlighting
-
Better default styling
-
Clone and build:
git clone https://github.com/terraphim/md-book.git cd md-book cargo build -
Set up pre-commit hooks (recommended):
make install-pre-commit # or manually: ./scripts/setup-pre-commit.sh -
Run quality checks:
make qa # Run all checks (format, lint, test) make dev-check # Complete development check make ci-local # Simulate CI checks locally
make help- Show all available commandsmake check- Run cargo checkmake fmt- Check code formattingmake fmt-fix- Fix code formattingmake clippy- Run clippy lintsmake test- Run unit testsmake test-integration- Run integration testsmake test-all- Run all testsmake qa- Run all quality checksmake clean- Clean build artifacts
The project includes pre-commit hooks that automatically run:
cargo fmt --all -- --check- Formatting checkcargo clippy --all-targets --all-features -- -D warnings- Lintingcargo test --lib --bins- Unit testscargo check --all-targets --all-features- Compilation check
These run automatically on every commit to ensure code quality.
You can add a book.toml file to the input directory to configure the book.
Supports TOML configuration via book.toml Allows overriding with environment variables (prefixed with MDBOOK_) Supports command-line arguments Enables shell expansion in config file paths Provides default values for optional fields Example usage:
# Using environment variables
MDBOOK_BOOK.TITLE="My Book" ./md-book -i input -o output
# Using custom config file
./md-book -i input -o output -c ~/my-config.toml
# Config values can be nested using an underscore
MDBOOK_OUTPUT.HTML.MATHJAX_SUPPORT=true ./md-book -i input -o outputThe configuration system follows the priority order:
- Command line arguments (highest priority)
- Environment variables (prefixed with MDBOOK_)
- Custom config file (if provided)
- Default book.toml
- Default values (lowest priority) you shall be able to feed config into json and yaml files.
cargo run -- -i input -o outputcargo run -- -i input -o output --watchcargo run -- -i input -o output --servecargo run -- -i input -o output --watch --serve --port 8080MD-Book supports deployment to multiple platforms:
# Setup (includes 1Password integration)
./scripts/setup-cloudflare.sh
# Deploy to production
./scripts/deploy.sh production# Build site
cargo run -- -i docs -o dist
# Deploy with CLI
netlify deploy --prod --dir=dist
# Or drag & drop at https://app.netlify.com/dropSee DEPLOYMENT.md for comprehensive deployment documentation including:
- 1Password integration for secure secret management
- GitHub Actions workflows
- Custom domains and SSL
- Performance optimization
- Platform comparison
- Rust specific synax highlight. Good first issue.
- Search [Done]
- Mathjax

