dedent
A Rust procedural macro for stripping whitespace from multi-line string literals while preserving relative indentation.
Features
- ๐ Preserves relative indentation between lines
- ๐งน Trims leading and trailing empty lines
Usage
use dedent;
How It Works
The dedent! macro:
- Takes a string literal as input
- Splits it into lines
- Calculates the minimum indentation level across all non-empty lines
- Removes that amount of whitespace from the start of each line
- Removes leading and trailing empty lines
- Preserves relative indentation between lines
License
Licensed under:
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
Credits
This crate is inspired by the dedent npm package.