Simple, multilingual solution for capitalization formatting
This project is an unofficial implementation of the textcase crate, and its developers have no affiliation with it.
#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.
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.
- 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
-
Prose cases are linguistic rules of text capitalization; and string cases are common naming conventions used in code ↩