PlandUML and Drawio diagrams in doc comments as PNG or SVG images.

Related tags

Command-line rsdoc
Overview

rsdoc

This crate provides a procedural macro that transform PlandUML and Drawio diagrams in doc comments as PNG or SVG images. The diagrams in doc comments as SVG images using drawio. The UML diagrams and flow diagrams in doc comments as PNG images using plantUML.

Requires Rust version 1.54 or later or equivalent nightly builds.

https://raw.githubusercontent.com/cocalon/rsdoc/main/rsdoc_example.png

Usage

Add the following line to Cargo.toml.

[dependencies]
rsdoc = "0.1.0"

plantuml!

Wrap doc comments with #[doc = plantuml!(...)]. Use plantuml code blocks to write uml diagrams. In this way, you can directly use the Alt+D key to browse the UML diagram in the source code after installing the PlantUML plug-in

#[doc = rsdoc::plantuml!(
/// @startuml
/// !theme cyborg-outline
/// Bob -> Alice : hello
/// @enduml
)]
pub fn test_function(){}

plantuml_file!

Or you can directly attach the puml file stored as a file

#[doc = rsdoc::plantuml_file!(test.puml)]

If your file is placed in a folder under the project directory, you can input the relative path directly like that.

#[doc = rsdoc::plantuml_file!(pumls/test.puml)]

image!

If you want to attach pictures, such as PNG or SVG, you can do it this way

#[doc = rsdoc::image!(test.png)]

And you can also use it with the Drawio tool, hope you like it!

#[doc = rsdoc::image!(test.drawio.svg)]

If your file is placed in a folder under the project directory, you can input the relative path directly like that.

#[doc = rsdoc::image!(images/test.drawio.svg)]

Tips

  • Using this macro increases the compilation time. The enable Cargo feature can be used to turn off the transformation and the compilation of most dependent packages.

License: MIT/Apache-2.0

You might also like...
SAORI for UKAGAKA. Convert a image file to resized png file.

Resized Png GitHub repository これは何? デスクトップマスコット、「伺か」で使用できるSAORIの一種です。 機能としては、指定した画像ファイルを拡大または縮小し、pngとして出力します。 「伺か」「SAORI」等の用語については詳しく説明いたしませんのでご了承下さい。

SVG to PDF file conversion based on "svg2pdf" and "resvg" Rust projects

pysvg2pdf Blazingly Fast ™️ SVG to PDF file conversion for Python. This project is based on Rust's svg2pdf and resvg projects. The project uses pyo3 a

Turns lines of text into SVG files.

Sentences 2 svg Does what it says on the tin. This takes in a file with some sentences and outputs numbered svgs. There are 3 arguments to keep in min

ufo2nft is a CLI Rust tool to automate creating on-chain SVG NFTs from UFO font sources

ufo2nft is a CLI Rust program created by Eli Heuer at the 2022 Seattle Solana Hacker House event. It uses Norad to create on-chain SVG images from UFO font sources, and prepares them for minting as Solana NFTs. For Ethereum NFTs the program can just export the SVGs and Ethereum NFTs can be built manually.

Captcha based on SVG.

BioSvg Captcha based on SVG. Original idea SVG绘制原理与验证码 Usage cargo add biosvg let (answer, svg) = BiosvgBuilder::new() .length(4) .difficulty(

Command-Line program that takes images and produces the copy of the image with a thin frame and palette made of the 10 most frequent colors.
Command-Line program that takes images and produces the copy of the image with a thin frame and palette made of the 10 most frequent colors.

paleatra v.0.0.1 Command-Line program that takes an image and produces the copy of the image with a thin frame and palette made of the 10 most frequen

Safer Nostr is a service that helps protect users by loading sensitive information (IP leak) and using AI to prevent inappropriate images from being uploaded.

Safer Nostr is a service that helps protect users by loading sensitive information (IP leak) and using AI to prevent inappropriate images from being uploaded. It also offers image optimization and storage options. It has configurable privacy and storage settings, as well as custom cache expiration.

Enhance low quality images and videos using AI technology.
Enhance low quality images and videos using AI technology.

Real ESRGAN GUI Real ESRGAN GUI is a simple and minimal GUI for xinntao's Real-ESRGAN This allows you to enhance low quality images and videos using A

A simple CLI utility to add rounded borders, padding, and shadows to images.

shadower a simple command-line utility to add rounded corners and shadows to images Installation From AUR paru -S shadower-git From source cargo build

Owner
null
An mdBook backend to output Typst markup, pdf, png, or svg

mdbook-typst mdbook-typst is a backend for mdBook. The backend converts the book to Typst markup and can output any format Typst can (currently pdf, p

Christian Legnitto 18 Dec 16, 2023
A little program written in Rust that prints random PNG images to the terminal in text grabbed from an image repo.

Cermic A little program written in Rust that prints random PNG images to the terminal in text grabbed from an image repo. NOTE: As of right now, Cermi

Jackson Novak 7 Oct 1, 2022
A simple Node.js library to convert raster images into svg

@neplex/vectorizer A simple Node.js library to convert raster images into svg using VTracer, with time complexity of O(n). Installation npm install @n

Neplex 21 Dec 28, 2023
A cli tool to download Imperial DoC past papers 🦀

Exams DoC Downloader A cli tool to download past papers from exams.doc.ic.ac.uk. An excercise in procrastination, written in Rust ?? . This currently

Ashvin Arsakularatne 3 Apr 8, 2022
🏭 Convert Markdown documents into themed HTML pages with support for code syntax highlighting, LaTeX and Mermaid diagrams.

Marky Markdown Magician ?? Features Hot reload previewing ?? Conversion to HTML / PDF ?? Themes! ✨ Extensions - Math, diagrams, syntax-highlighting ??

Vadim 12 Feb 19, 2023
🍅 A command-line tool to get and set values in toml files while preserving comments and formatting

tomato Get, set, and delete values in TOML files while preserving comments and formatting. That's it. That's the feature set. I wrote tomato to satisf

C J Silverio 15 Dec 23, 2022
png_defringe_rs is a port of Immorpher's PNG Defringe program written in Rust to achieve easier installation and faster performance.

png_defringe_rs png_defringe_rs is a port of Immorpher's PNG Defringe program written in Rust to achieve easier installation and faster performance. U

null 2 Nov 17, 2022
Rust low-level minimalist APNG writer and PNG reader with just a few dependencies with all possible formats coverage (including HDR).

project Wiki https://github.com/js29a/micro_png/wiki at glance use micro_png::*; fn main() { // load an image let image = read_png("tmp/test.

jacek SQ6KBQ 8 Aug 30, 2023
Replace an app's icon from a png with a single terminal script. Made with Rust

Replace macOS App Icon Replace an app's icon from a png with a single terminal CLI. Made with Rust

Kunal Bagaria 8 Aug 3, 2022
PNG manipulation library.

pngmanip A simple rust library for parsing and manipulating PNG images, primarily at the chunk level. The intended use case was for solving PNG based

Sam Leonard 1 Jan 7, 2022