| Crates.io | r3bl-build-infra |
| lib.rs | r3bl-build-infra |
| version | 0.0.1 |
| created_at | 2026-01-23 19:40:25.690775+00 |
| updated_at | 2026-01-23 19:40:25.690775+00 |
| description | Cargo subcommand for formatting rustdoc comments: markdown table alignment and reference-style links |
| homepage | https://r3bl.com |
| repository | https://github.com/r3bl-org/r3bl-open-core |
| max_upload_size | |
| id | 2065344 |
| size | 573,999 |
Build tools and utilities designed for R3BL projects, but usable in any Rust project.
A cargo subcommand that formats markdown tables and converts inline links to
reference-style links within Rust documentation comments (/// and //!).
From crates.io:
cargo install r3bl-build-infra
Or from source (in a workspace containing this crate):
cargo install --path build-infra
Format git-changed files (default - auto-detects staged/unstaged changes):
cargo rustdoc-fmt
Format entire workspace:
cargo rustdoc-fmt --workspace
Format specific files:
cargo rustdoc-fmt src/lib.rs src/main.rs
Format a directory:
cargo rustdoc-fmt src/
Check formatting without modifying (useful for CI):
cargo rustdoc-fmt --check
Only format tables (skip link conversion):
cargo rustdoc-fmt --tables-only
Only convert links (skip table formatting):
cargo rustdoc-fmt --links-only
Verbose output:
cargo rustdoc-fmt --verbose
Combine options:
cargo rustdoc-fmt --check --verbose src/
Markdown tables in rustdoc comments are reformatted with consistent column widths.
Before:
//! | A | B |
//! |---|---|
//! | Short | Very Long Text |
After:
//! | A | B |
//! |-------|----------------|
//! | Short | Very Long Text |
Inline markdown links are converted to reference-style links using the link text as the reference identifier, reducing visual clutter in documentation.
Before:
//! See [docs](https://example.com) and [Rust](https://rust-lang.org).
After:
//! See [docs] and [Rust].
//!
//! [docs]: https://example.com
//! [Rust]: https://rust-lang.org
When run without arguments, cargo-rustdoc-fmt intelligently determines which files
to format:
This makes it perfect for pre-commit hooks and development workflows.
Add to your continuous integration pipeline to enforce formatting standards:
cargo rustdoc-fmt --check
Exits with code 1 if formatting is needed, allowing CI to fail the build.
Example GitHub Actions step:
- name: Check rustdoc formatting
run: cargo rustdoc-fmt --check --verbose
The project follows a multi-tool design pattern (similar to the cmdr/ crate).
Currently implements cargo-rustdoc-fmt, with support for adding additional
build tools in the future without refactoring.
Module structure:
src/lib.rs - Library rootsrc/bin/cargo-rustdoc-fmt.rs - Binary entry pointsrc/cargo_rustdoc_fmt/ - Tool implementation
cli_arg.rs - CLI argument parsingextractor.rs - Extract rustdoc blocks from sourcetable_formatter.rs - Format markdown tableslink_converter.rs - Convert inline to reference-style linksprocessor.rs - Orchestrate file processingir_event_types - Type definitionsui_str.rs - User-facing messagessrc/common/ - Shared utilities
git_utils.rs - Git integrationworkspace_utils.rs - Workspace discovery and file findingCurrently uses pulldown-cmark for markdown parsing. This will be migrated to
r3bl_tui::md_parser once table support is added to that parser, achieving full
R3BL infrastructure dogfooding.
License: Apache-2.0