Crate cargo_doc2readme
source · [−]Expand description
cargo doc2readme
is a cargo subcommand to create a readme file to display on GitHub or crates.io,
containing the rustdoc comments from your code.
Usage
cargo install cargo-doc2readme
cargo doc2readme --out README.md
If you want to run this using GitHub Actions, you can use the pre-built docker image:
readme:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker://ghcr.io/msrd0/cargo-doc2readme
with:
entrypoint: cargo
args: doc2readme
- run: git diff --exit-code README.md
Features
- parse markdown from your rustdoc comments and embed it into your readme
- use existing crates to parse Rust and Markdown
- support your
[CustomType]
rustdoc links - default, minimalistic readme template with some useful badges
- custom readme templates
Non-Goals
- verbatim copy of your markdown
- easy readability of the generated markdown source code
Similar tools
cargo readme
is a similar tool. However, it brings its own Rust code parser that only covers the 95% use case. Also, it does not support Rust path links introduced in Rust 1.48, making your readme ugly due to GitHub showing the unsupported links as raw markdown, and being less convenient for the reader that has to search docs.rs instead of clicking on a link.
Stability Guarantees
This project adheres to semantic versioning. All versions will be tested against the latest stable rust version at the time of the release. All non-bugfix changes to the rustdoc input processing and markdown output or the default readme template are considered breaking changes, as well as any non-backwards-compatible changes to the command-line arguments or to these stability guarantees. All other changes, including any changes to the Rust code, or bumping the MSRV, are not considered breaking changes.
Modules
Structs
Enums
Functions
Copied from cargo crate: https://github.com/rust-lang/cargo/blob/e870eac9967b132825116525476d6875c305e4d8/src/bin/cargo/main.rs#L199