Skip to content

Commit

Permalink
Mention indentation in root module docstring
Browse files Browse the repository at this point in the history
Fixes #258.
  • Loading branch information
mgeisler committed Dec 29, 2020
1 parent 7aaccb7 commit ee98f4b
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//! The textwrap library provides functions for word wrapping and
//! indenting text.
//!
//! # Wrapping Text
//!
//! Wrapping text can be very useful in command-line programs where
//! you want to format dynamic output nicely so it looks good in a
//! terminal. A quick example:
Expand Down Expand Up @@ -48,12 +50,12 @@
//! ping text.
//! ```
//!
//! # Wrapping Strings at Compile Time
//! ## Wrapping Strings at Compile Time
//!
//! If your strings are known at compile time, please take a look at
//! the procedural macros from the [textwrap-macros] crate.
//!
//! # Displayed Width vs Byte Size
//! ## Displayed Width vs Byte Size
//!
//! To word wrap text, one must know the width of each word so one can
//! know when to break lines. This library will by default measure the
Expand All @@ -73,6 +75,32 @@
//! `unicode-width` Cargo feature is enabled (it is enabled by
//! default).
//!
//! # Indentation and Dedentation
//!
//! The textwrap library also offers functions for adding a prefix to
//! every line of a string and to remove leading whitespace. As an
//! example, the [`indent`] function allows you to turn lines of text
//! into a bullet list:
//!
//! ```
//! assert_eq!(textwrap::indent("foo\nbar\nbaz\n", "* "),
//! "* foo\n* bar\n* baz\n");
//! ```
//!
//! Removing leading whitespace is done with [`dedent`]:
//!
//! ```
//! let text = "
//! Some
//! indented
//! text";
//! assert_eq!(textwrap::dedent(text),
//! "
//! Some
//! indented
//! text");
//! ```
//!
//! # Cargo Features
//!
//! The textwrap library can be slimmed down as needed via a number of
Expand Down

0 comments on commit ee98f4b

Please sign in to comment.