strip-indent 0.1.0

Strip leading whitespace from each line of a multi-line string, based on the least-indented line. A faithful port of the strip-indent npm package. Zero deps, no_std.
Documentation
# strip-indent

[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)

[![crates.io](https://img.shields.io/crates/v/strip-indent.svg)](https://crates.io/crates/strip-indent)
[![docs.rs](https://docs.rs/strip-indent/badge.svg)](https://docs.rs/strip-indent)
[![CI](https://github.com/trananhtung/strip-indent/actions/workflows/ci.yml/badge.svg)](https://github.com/trananhtung/strip-indent/actions/workflows/ci.yml)
[![license](https://img.shields.io/crates/l/strip-indent.svg)](#license)

**Strip leading indentation from a multi-line string.**

Removes the leading whitespace common to every line, based on the least-indented line —
useful for normalizing indented template/heredoc text. A faithful Rust port of the
widely-used [`strip-indent`](https://www.npmjs.com/package/strip-indent) npm package (which
bundles [`min-indent`](https://www.npmjs.com/package/min-indent)).

- **Zero dependencies**, **`#![no_std]`**
- `strip_indent`, `min_indent`, and `dedent`
- Differential-tested against the reference `strip-indent`/`min-indent` implementations

## Install

```toml
[dependencies]
strip-indent = "0.1"
```

## Usage

```rust
use strip_indent::{strip_indent, min_indent, dedent};

assert_eq!(strip_indent("    foo\n      bar"), "foo\n  bar");
assert_eq!(strip_indent("\tfoo\n\t\tbar"), "foo\n\tbar");

// The common indent, in leading spaces/tabs:
assert_eq!(min_indent("  a\n    b"), 2);

// Also trim leading/trailing blank lines:
assert_eq!(dedent("\n\n   foo\n   bar\n\n"), "foo\nbar");
```

Indentation is counted in characters (a tab counts as one), and lines that are empty or
contain only whitespace are ignored when computing the common indent.

## Contributors ✨

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind are welcome — code, docs, bug reports, ideas, reviews! See the [emoji key](https://allcontributors.org/docs/en/emoji-key) for how each contribution is recognized, and open a PR or issue to get involved.

Thanks goes to these wonderful people:

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
  <tbody>
    <tr>
      <td align="center" valign="top" width="14.28%"><a href="https://github.com/trananhtung"><img src="https://avatars.githubusercontent.com/u/30992229?v=4?s=100" width="100px;" alt="Tung Tran"/><br /><sub><b>Tung Tran</b></sub></a><br /><a href="https://github.com/trananhtung/./commits?author=trananhtung" title="Code">💻</a> <a href="#maintenance-trananhtung" title="Maintenance">🚧</a></td>
    </tr>
  </tbody>
</table>

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

## License

Licensed under either of [MIT](LICENSE-MIT) or [Apache-2.0](LICENSE-APACHE) at your option.