README: Autogenerate from library documentation using cargo-readme
Based on the suggestion from @katyo in 1 and implementation in 2. This also adds some neat badges for the repo (though I'm not sure how relevant the SLOC one is given all the generated files...).
We'll have to wait for https://github.com/livioribeiro/cargo-readme/pull/67 to get rid of the # without introducing empty newlines.
Error: Generated README is, please regenerate with `cargo readme > README.md`
diff --git a/README.md b/README.md
index c0d3cba..e7a3138 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@ gbm
[](https://github.com/Smithay/gbm.rs)

-## Usage
+### Usage
Add to your `Cargo.toml`:
@@ -75,8 +75,4 @@ gbm.set_crtc(crtc_handle, Some(fb), (0, 0), &[con], Some(mode))
.unwrap();
#```
-Current version: 0.6.0
-
-Some additional info here
-
License: MIT
Error: Process completed with exit code 1.
Ha, that' works at least :)
@MarijnS95 Rust since 1.54 can include README.md into documentation (see https://blog.rust-lang.org/2021/07/29/Rust-1.54.0.html#attributes-can-invoke-function-like-macros). So I suggest simply to use this feature if support older Rust versions does not so important for us. I was used cargo-readme as temporary solution before.
@katyo I've considered that for some other projects too, but am hesitant for a couple reasons (drawbacks):
cargo-readmehas some macros to take care of automatically inserting{{version}}and{{license}};- All unnecessary bits from the readme (everything that's in
README.tplaround{{readme}}) such as license and badges make it into the module docs; #-prefixed lines aren't filtered out in```rustmarkdown in the rendered readme;```rust,no_runisn't rendered as Rust code - but breaks doc testing ifno_runis removed.
On the other hand cargo-readme is an extra utility that isn't maintained anymore.