automd-rs
automd-rs is a Rust crate that updates your README.md from your Cargo.toml automatically. Put special HTML comments in your README; run the tool (CLI or as a library), and it fills those blocks with badges, contributor info, and more—so you don’t have to keep version, repo URL, or author in sync by hand.
Features
- Badges – Crates.io version, downloads, docs.rs, GitHub commit activity, repo stars
- Contributors – License line and contrib.rocks image from repo
- With-automdrs – Optional “auto updated with automd-rs” footer
- Extensible – Use the library with a custom
BlockHandlerto add your own blocks
Installation
As a dependency (library):
As a binary (to run in your project root):
Usage
CLI
From your crate root (where Cargo.toml and README.md live):
This reads Cargo.toml, finds all <!-- automdrs:... --> blocks in README.md, generates content for each, and overwrites README.md with the result.
Library
use run;
use Path;
For custom block types, use run_with_handler and implement the BlockHandler trait.
README block syntax
Blocks are HTML comments. Open with <!-- automdrs:NAME [options] -->, close with <!-- /automdrs -->. The content between is replaced by generated output.
| Block | Options (examples) | Description |
|---|---|---|
badges |
showCrateVersion="true", showCrateDownloads, showCrateDocs, showCommitActivity, showRepoStars (or short: version, downloads, docs, commit_activity, repo_stars) |
Shield badges for crates.io and GitHub |
contributors |
author="YOUR_NAME", license="MIT" |
License line + contrib.rocks image |
with-automdrs |
(none) | Footer: “auto updated with automd-rs” |
Example – badges (all on):
...generated badges...
Example – contributors:
...generated license + contrib.rocks...
Your Cargo.toml must include repository = "https://github.com/owner/repo" (or similar) so the tool can derive the GitHub owner/repo for badges and contributors.
Contribution
- Clone this repository
- Install the latest version of Rust
- Run tests using
cargo testorcargo run
Credits
automd-rs was inspired by the idea of keeping README and crate metadata in sync via comment-driven blocks, similar in spirit to doc-generation and badge tools in the Rust and JavaScript ecosystems, such as @automd.
License
Published under the MIT license. Made by @YONGQI 💛
🛠️ auto updated with automd-rs