#documentation #rustdoc #no-std

no-std include-utils

mdBook-like include macro as the powerful replacement for the standard include_str macro

5 releases

0.2.2 Apr 19, 2024
0.2.1 Mar 31, 2024
0.2.0 Jan 12, 2024
0.1.1 Dec 29, 2023
0.1.0 Dec 29, 2023

#740 in Development tools

Download history 73/week @ 2024-04-02 6/week @ 2024-04-09 224/week @ 2024-04-16 128/week @ 2024-04-23 48/week @ 2024-04-30 1/week @ 2024-05-07 26/week @ 2024-05-14 62/week @ 2024-05-21 52/week @ 2024-05-28 38/week @ 2024-06-04 56/week @ 2024-06-11 68/week @ 2024-06-18 58/week @ 2024-06-25 53/week @ 2024-07-02 131/week @ 2024-07-09 159/week @ 2024-07-16

413 downloads per month
Used in 3 crates

MIT/Apache

9KB

Include utils

tests crates.io Documentation MIT/Apache-2 licensed

A more powerful replacement for the standard inlcude_str macros.

Often you only need a specific part of the file, e.g. relevant lines for an example, or section of README.md. This crate provides macros that can include only part of a file, similar to the mdbook specific feature.

Imagine that you want to include "usage" section from your repository readme file to the crate documentation. But you do not want to see in crate documentation some parts of readme file, like header, badges, etc. With the include_str macro you can only include the entire file content.

But with the include_md macro you can include only a specific section of the file.

Notes

  • Unlike the built-in macro, this macros uses the CARGO_MANIFEST_DIR as the current directory instead of the directory from which macro is called.

  • If the workspace feature is enabled, then if the file cannot be found relative to the CARGO_MANIFEST_DIR, it will be searhed relative to the cargo workspace root directory. It may be useful if you want to store your documentation in the single directory outside the crates. In this case you have to copy included directory to each crate before you publish it to the crates registry.

Usage

//! # Crate overview
//!
#![doc = include_utils::include_md!("README.md:description")]
//!
//! ## Other section

Dependencies

~1–1.6MB
~32K SLoC