#title #case #capitalization #capitalisation #capitalize

bin+lib titlecase

A tool and library that capitalizes text according to a style defined by John Gruber for post titles on his website Daring Fireball

4 releases (1 stable)

1.1.0 Feb 1, 2020
0.10.0 Jun 21, 2017
0.9.1 Jun 19, 2017
0.9.0 Jun 19, 2017

#102 in Text processing

Download history 20/week @ 2020-01-22 62/week @ 2020-01-29 135/week @ 2020-02-05 127/week @ 2020-02-12 146/week @ 2020-02-19 200/week @ 2020-02-26 193/week @ 2020-03-04 204/week @ 2020-03-11 282/week @ 2020-03-18 256/week @ 2020-03-25 314/week @ 2020-04-01 426/week @ 2020-04-08 300/week @ 2020-04-15 250/week @ 2020-04-22 190/week @ 2020-04-29 332/week @ 2020-05-06

852 downloads per month
Used in book-summary

MIT license

17KB

Title Case (titlecase)

titlecase is a small tool that capitalizes English text according to a style defined by John Gruber for post titles on his website Daring Fireball. titlecase runs on Linux, macOS, FreeBSD, NetBSD, and Windows. A dependency free, single-file binary is built for each supported platform for every release.

Travis CI Appveyor crates.io Documentation

titlecase is licensed under the MIT license.

Examples

% echo 'Being productive on linux' | titlecase
Being Productive on Linux

% echo 'Finding an alternative to Mac OS X — part 2' | titlecase
Finding an Alternative to Mac OS X — Part 2

% echo 'an example with small words and sub-phrases: "the example"' | titlecase
An Example With Small Words and Sub-Phrases: "The Example"

Command Line Usage

titlecase reads lines of text from stdin and prints title cased versions to stdout.

Usage as a Rust Crate

See the crate documentation.

Download

Pre-built titlecase binaries are available for Linux, macOS, FreeBSD, NetBSD, and Windows.

Building

Minimum Supported Rust Version: 1.30.1

If you have a stable Rust compiler toolchain installed you can install the most recently released titlecase with cargo:

% cargo install titlecase

Style

Instead of simply capitalizing each word titlecase does the following (amongst other things):

  • Lower case small words like an, of, or in.
  • Don't capitalize words like iPhone.
  • Don't interfere with file paths, URLs, domains, and email addresses.
  • Always capitalize the first and last words, even if they are small words or surrounded by quotes.
  • Don't interfere with terms like "Q&A", or "AT&T".
  • Capitalize small words after a colon.

Credits

This tool makes use of prior work by John Gruber, Aristotle Pagaltzis, and David Gouch.

Dependencies

~1.5MB