Skip to content

Typographic linter – because we do care very much about typography.

License

Notifications You must be signed in to change notification settings

rlustin/typographic-linter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

typographic-linter

Build Status

Typographic linter – because we do care very much about typography.

Overview

typographic-linter is Rust library that checks for common typographic rules in several languages: English, French, German, Italian and Spanish.

Library in action

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.");
    }
}

Implemented rules

This library is a work in progress. For now, it only checks for the rules bellow.

All languages

  • curly apostrophes;
  • ellipsis symbol;
  • no space before comma;
  • prices;
  • typographic quotation marks.

French

  • spaces before double punctuation marks.

About

Typographic linter – because we do care very much about typography.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages