Skip to content

Latest commit

 

History

41 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Text Case

Simple, multilingual solution for capitalization formatting

Typst Universe version GitHub development branch version

Get Manual Example PDF Example source code Changelog file Contribute with development

General tests badge Build test badge Spellcheck test badge Plugin build badge

This project is an unofficial implementation of the textcase crate, and its developers have no affiliation with it.

Quick Start

#import "@preview/textcase:0.1.0": contextual

// "Sentence case text."
#contextual.sentence-case("sentence case text.")

// "Sentence case title: Subtitle"
#contextual.sentence-case-title("sentence case title: subtitle")

// "Title Case: Subtitle"
#contextual.title-case("title case: subtitle")

// "sentence-title"
#contextual.detect-case("Sentence case title: Subtitle")

// "camelCaseString"
#contextual.convert("camel case string", mode: "camel")

The #textcase.contextual module allows obtaining the locale from #text.lang. The same commands are available directly without this functionality.

Description

Multilingual sentence and title recasing for Latin-script languages. This recases text whose capitalization is wrong or missing — lowercase feeds, SHOUTED titles, Title Cased Prose — while preserving capitalization that carries information. It works without any external data. Conversion to string cases is also supported, as well as the detection of prose or string case1 of a text.

Feature List

  • Sentence case text
  • Sentence case titles and subtitles
  • Title case text
  • Advanced text capitalization
    • Set subtitle separator character
    • Capitalize subtitles
    • Preserve acronyms
    • Preserve mixed case text
    • Preserve known proper nouns
    • Preserve proper names (capitalized)
    • Normalize additional whitespace
    • Capitalization mode for german language
  • Prose/string case detection
  • Automatic contextual locale (#text.lang)

This package relies heavily on the textcase and inflections crates for text processing (via plugin).

Footnotes

  1. Prose cases are linguistic rules of text capitalization; and string cases are common naming conventions used in code

Releases

Contributors

Languages