Skip to content

Commit

Permalink
Merge pull request #263 from mgeisler/copy-editing
Browse files Browse the repository at this point in the history
Copy editing
  • Loading branch information
mgeisler authored Dec 29, 2020
2 parents 4301afe + 06eba3a commit 7aaccb7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
[![](https://img.shields.io/crates/v/textwrap.svg)][crates-io]
[![](https://docs.rs/textwrap/badge.svg)][api-docs]

Textwrap is a library for word wrapping text. You can use it to format
strings for display in commandline applications. The crate name and
interface is inspired by the [Python textwrap module][py-textwrap].
Textwrap is a library for wrapping and indenting text. It is most
often used by command-line programs to format dynamic output nicely so
it looks good in a terminal. However, you can use the library to wrap
arbitrary things by implementing the `Fragment` trait — an example
would be wrapping text for PDF files.

## Usage

To use `textwrap`, add this to your `Cargo.toml` file:
To use the textwrap crate, add this to your `Cargo.toml` file:
```toml
[dependencies]
textwrap = "0.13"
Expand All @@ -23,7 +25,7 @@ Unicode support can be disabled if needed. This allows you slim down
the library and so you will only pay for the features you actually
use. Please see the [_Cargo Features_ in the crate
documentation](https://docs.rs/textwrap/#cargo-features) for a full
list of the featurs.
list of the available features.

## Documentation

Expand Down Expand Up @@ -56,7 +58,7 @@ The explanation is that textwrap does not just wrap text one line at a
time. Instead, it uses an optimal-fit algorithm which looks ahead and
chooses line breaks which minimize the gaps left at ends of lines.

Without look ahead, the first line would be longer and the text would
Without look-ahead, the first line would be longer and the text would
look like this:

```
Expand Down Expand Up @@ -106,7 +108,6 @@ see the [`hyphenation` documentation] for details.
If your strings are known at compile time, please take a look at the
procedural macros from the [`textwrap-macros` crate].


## Examples

The library comes with [a
Expand Down Expand Up @@ -141,7 +142,6 @@ Contributions will be accepted under the same license.
[crates-io]: https://crates.io/crates/textwrap
[build-status]: https://github.com/mgeisler/textwrap/actions?query=workflow%3Abuild+branch%3Amaster
[codecov]: https://codecov.io/gh/mgeisler/textwrap
[py-textwrap]: https://docs.python.org/library/textwrap
[`textwrap-macros` crate]: https://crates.io/crates/textwrap-macros
[`hyphenation` example]: https://github.com/mgeisler/textwrap/blob/master/examples/hyphenation.rs
[`termwidth` example]: https://github.com/mgeisler/textwrap/blob/master/examples/termwidth.rs
Expand Down
3 changes: 1 addition & 2 deletions src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,7 @@ pub enum WrapAlgorithm {
/// "not wrap",
/// "nicely."]);
///
/// // We can avoid the short line if we look ahead (this requires the
/// // smawk Cargo feature):
/// // We can avoid the short line if we look ahead:
/// #[cfg(feature = "smawk")]
/// assert_eq!(lines_to_strings(textwrap::core::wrap_optimal_fit(&words, |_| 15)),
/// vec!["These few",
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! The textwrap library provides functions for word wrapping and
//! filling text.
//! indenting text.
//!
//! Wrapping text can be very useful in commandline programs where you
//! want to format dynamic output nicely so it looks good in a
//! 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:
//!
//! ```no_run
Expand Down

0 comments on commit 7aaccb7

Please sign in to comment.