svgbobdoc

docs.rs

This crate provides a procedural macro that renders ASCII diagrams in doc comments as SVG images using [svgbob].

Requires Rust version 1.54 or later or equivalent nightly builds.

Usage

Add the following line to Cargo.toml.

toml [dependencies] svgbobdoc = { version = "0.2", features = ["enable"] }

transform!

Wrap doc comments with #[doc = transform!(...)]. Use svgbob code blocks to write ASCII diagrams.

#[doc = svgbobdoc::transform!(
/// Some structure.
///
/// ```svgbob
///  .--------------------.
///  | Diagrams here      |
///  `--------------------'
/// ```
)]
pub struct TestStruct {}

See the example directory for a complete example.

Tips

License: MIT/Apache-2.0