Count Unicode grapheme clusters in strings, Typst content, or a complete document. Spaces and paragraph breaks are included; equations, citations, images, and other non-prose elements are ignored by default.
#import "char-count.typ": char-count-of
#let count = char-count-of([Hello *Typst*!])
#count.at("characters-with-spaces") // 12Copy char-count.typ into your project and import the
functions you need:
#import "char-count.typ": char-count, char-count-of, total-characters-with-spacesWhen installed as a local Typst package, use:
#import "@local/char-count:0.1.0": char-count, char-count-of, total-characters-with-spacesThe package is implemented entirely in Typst and has no runtime dependencies.
- Documentation overview
char-count-of— count one string or content valuechar-count— count a complete document with a show rule- Exclusions — control which content is omitted
- API reference — every exported value and helper
A compilable example covering the complete public API is available in
examples/all-functions.typ. See the
changelog for release history.
MIT