Skip to content
A tool and Rust crate for making text title case
Branch: master
Clone or download
Latest commit 5c517c1 Jan 17, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
ci Disable running the binary on CI for now Jun 18, 2017
src Remove unnecessary grouping from regex Jun 20, 2017
.gitignore Initial commit Jun 17, 2017
.travis.yml Add Travis CI Jun 18, 2017
Cargo.lock Version 0.10.0 Jun 21, 2017
Cargo.toml Version 0.10.0 Jun 21, 2017
LICENSE
README.md
appveyor.yml Fix syntax in appveyor.yml Jun 19, 2017

README.md

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.

Installation

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

Rust Developer/Cargo

If you have a stable Rust compiler toolchain installed you can install 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. The continuous integration configuration uses trust by Jorge Aparicio, dual licensed under the MIT and Apache licenses.

You can’t perform that action at this time.