The document-features crate achieves a similar result as cargo-rdme.
A typical lib.rs doc block using this looks like:
//! Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
//! eiusmod tempor incididunt ut labore et dolore magna aliqua.
//!
//! # Cargo Features
//!
#![doc = document_features::document_features!()]
The last part creates Markdown from ##-prefixed comments in the [features] section of Cargo.toml. I.e. it makes it easy to keep comments in Cargo.toml and docs in sync.
However, it can be mixed with additional (feature) docs and so the header, # Cargo Features, is not coming from document-features) but must be added manually. It then ends up at the bottom of the cargo-rdme-generated README.md, w/o anything under it.
It would be great if this feature-generation stuff could somehow be included/supported in cargo-rdme.
Alternatively a cargo-rdme option that removes the last header if it doesn't have text under it could be a workaround.
E.g. --strip-terminal-empty-header.
The
document-featurescrate achieves a similar result ascargo-rdme.A typical
lib.rsdoc block using this looks like:The last part creates Markdown from
##-prefixed comments in the[features]section ofCargo.toml. I.e. it makes it easy to keep comments inCargo.tomland docs in sync.However, it can be mixed with additional (feature) docs and so the header,
# Cargo Features, is not coming fromdocument-features) but must be added manually. It then ends up at the bottom of thecargo-rdme-generatedREADME.md, w/o anything under it.It would be great if this feature-generation stuff could somehow be included/supported in
cargo-rdme.Alternatively a
cargo-rdmeoption that removes the last header if it doesn't have text under it could be a workaround.E.g.
--strip-terminal-empty-header.