From 30c98c4e28f3618df320c57354390f8e72e41506 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Mon, 17 Feb 2025 16:32:17 -0600 Subject: [PATCH 1/5] Add additional examples --- README.md | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 51a01a5..975cd74 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,6 @@ cargo install string-auto-indent ```rust use string_auto_indent::{auto_indent, LineEnding}; -println!(""); let text = r#" String Auto Indent @@ -45,6 +44,28 @@ assert_eq!( ); ``` +### Example Output + +**With `auto-indent` enabled.** + +```text +String Auto Indent + +Level 1 + Level 2 + Level 3 +``` + +**With `auto-intent` disabled.** + +```text + String Auto Indent + + Level 1 + Level 2 + Level 3 +``` + ## How It Works 1. Detects the platform’s line endings (`\n`, `\r\n`, `\r`) and normalizes input for processing. From 5b1c96de864f9720997ef98af39a905998803fc1 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Mon, 17 Feb 2025 16:34:46 -0600 Subject: [PATCH 2/5] Update comments --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 975cd74..8170600 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ When working with multi-line strings inside indented code blocks, unwanted leadi cargo install string-auto-indent ``` -## Example +## Usage ```rust use string_auto_indent::{auto_indent, LineEnding}; @@ -32,14 +32,14 @@ let line_ending = LineEnding::detect(text); // With auto-indent assert_eq!( auto_indent(text), - // Restore platform-specific line endings for testing + // For cross-platform testing: Restore platform-specific line endings line_ending.restore("String Auto Indent\n\nLevel 1\n Level 2\n Level 3\n") ); // Without auto-indent assert_eq!( text, - // Restore platform-specific line endings for testing + // For cross-platform testing: Restore platform-specific line endings line_ending.restore("\n String Auto Indent\n\n Level 1\n Level 2\n Level 3\n"), ); ``` From 1726b59f3fc6331b022729200852b9234337898c Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Mon, 17 Feb 2025 16:37:15 -0600 Subject: [PATCH 3/5] Add badges --- README.md | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8170600..1389263 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,18 @@ # Multi-line String Auto Indent +[![made-with-rust][rust-logo]][rust-src-page] +[![crates.io][crates-badge]][crates-page] +[![Documentation][docs-badge]][docs-page] +[![MIT licensed][license-badge]][license-page] + + +| OS | Status | +|---------------|--------------------------------------------------------------------------------------| +| Ubuntu-latest | [![Ubuntu Tests][ubuntu-latest-badge]][ubuntu-latest-workflow] | +| macOS-latest | [![macOS Tests][macos-latest-badge]][macos-latest-workflow] | +| Windows-latest| [![Windows Tests][windows-latest-badge]][windows-latest-workflow] | + + A Rust utility for automatically normalizing multi-line string indentation while preserving platform-specific line endings. ## Overview @@ -83,5 +96,23 @@ Level 1 ## License Licensed under **MIT**. See [`LICENSE`][license-page] for details. -[license-page]: https://github.com/jzombie/rust-cargo-pkg-info-struct-builder/blob/main/LICENSE +[rust-src-page]: https://www.rust-lang.org/ +[rust-logo]: https://img.shields.io/badge/Made%20with-Rust-black?&logo=Rust + +[crates-page]: https://crates.io/crates/string-auto-indent +[crates-badge]: https://img.shields.io/crates/v/string-auto-indent.svg + +[docs-page]: https://docs.rs/string-auto-indent +[docs-badge]: https://docs.rs/string-auto-indent/badge.svg + +[license-page]: https://github.com/jzombie/rust-string-auto-indent/blob/main/LICENSE [license-badge]: https://img.shields.io/badge/license-MIT-blue.svg + +[ubuntu-latest-badge]: https://github.com/jzombie/rust-string-auto-indent/actions/workflows/rust-tests.yml/badge.svg?branch=main&job=Run%20Rust%20Tests%20(OS%20=%20ubuntu-latest) +[ubuntu-latest-workflow]: https://github.com/jzombie/rust-string-auto-indent/actions/workflows/rust-tests.yml?query=branch%3Amain + +[macos-latest-badge]: https://github.com/jzombie/rust-string-auto-indent/actions/workflows/rust-tests.yml/badge.svg?branch=main&job=Run%20Rust%20Tests%20(OS%20=%20macos-latest) +[macos-latest-workflow]: https://github.com/jzombie/rust-string-auto-indent/actions/workflows/rust-tests.yml?query=branch%3Amain + +[windows-latest-badge]: https://github.com/jzombie/rust-string-auto-indent/actions/workflows/rust-tests.yml/badge.svg?branch=main&job=Run%20Rust%20Tests%20(OS%20=%20windows-latest) +[windows-latest-workflow]: https://github.com/jzombie/rust-string-auto-indent/actions/workflows/rust-tests.yml?query=branch%3Amain From af980cf59353cb0f392b05a7570361c707869f96 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Mon, 17 Feb 2025 16:39:18 -0600 Subject: [PATCH 4/5] Add comment --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 1389263..ad07363 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ let text = r#" Level 3 "#; +// For cross-platform testing let line_ending = LineEnding::detect(text); // With auto-indent From 031b639bac02d35d14ce24bd556697a5ac991d28 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Mon, 17 Feb 2025 16:44:20 -0600 Subject: [PATCH 5/5] Update `Cargo.toml` --- Cargo.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 0a51264..444d888 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,11 @@ [package] name = "string-auto-indent" -description = "Automatically (re)indent multi-line strings" version = "0.1.0-alpha" +authors = ["Jeremy Harris "] edition = "2021" +description = "Normalizes multi-line string indentation while preserving platform-specific line endings." +repository = "https://github.com/jzombie/rust-string-auto-indent" +license = "MIT" [dependencies] doc-comment = "0.3.3"