Typographic linter – because we do care very much about typography.
typographic-linter
is Rust library that checks for common typographic rules in several languages:
English, French, German, Italian and Spanish.
Add the dependency in your Cargo.toml
:
typographic_linter = { git = "https://github.com/rlustin/typograhic-linter" }
extern crate typographic_linter;
use typographic_linter::Linter;
fn main() {
let linter = Linter::new("en".to_string()).unwrap();
let content = "It's me...";
let result = linter.check(content);
if result.is_err() {
let warnings = result.err().unwrap();
println!("There are {} typographic warnings in “{}”:", warnings.len(), content);
for warning in &warnings {
println!("- At {}, {}: {}", warning.start, warning.end, warning.message);
}
} else {
println!("There’s no typographic warning.");
}
}
This library is a work in progress. For now, it only checks for the rules bellow.
- curly apostrophes;
- ellipsis symbol;
- no space before comma;
- prices;
- typographic quotation marks.
- spaces before double punctuation marks.