readme-rustdocifier

A library for rustdocifying README.md for inclusion in lib.rs.

Usage

toml [build-dependencies] readme-rustdocifier = "0.1.0"

```no_run use std::{env, error::Error, fs, path::PathBuf};

const CRATENAME: &str = "yourcratenamehere";

fn main() -> Result<(), Box> { println!("cargo:rerun-if-changed=README.md"); fs::write( PathBuf::from(env::var("OUTDIR")?).join("README-rustdocified.md"), readmerustdocifier::rustdocify( &fs::readtostring("README.md")?, &env::var("CARGOPKGNAME")?, Some(&env::var("CARGOPKGVERSION")?), Some(CRATE_NAME), )?, )?; Ok(()) } ```

```no_run

![doc = includestr!(concat!(env!("OUTDIR"), "/README-rustdocified.md"))]

```

Example README.md

```markdown

foo

A foo library.

Usage

Create [Foo::new].

```

Above README.md is rustdocified to:

```markdown

A foo library.

Usage

Create [Foo::new].

```

Link conversions

Lines like [...]: https://docs.rs/PACKAGE/... are converted to rustdoc format.

Following conversions are done:

Notes:

Safety

This crate doesn't use any unsafe code. This is enforced by #![forbid(unsafe_code)].