Count Unicode grapheme clusters and Danish normal pages in strings, Typst content, or a complete document. One normal page is 2,400 characters including spaces. Equations, citations, images, and other non-prose elements are ignored by default.
Counts describe source content, not final rendered output. Context-generated text and show-rule replacements require special care; see counting limits.
#import "char-count.typ": char-count-of
#let count = char-count-of([Hello *Typst*!])
#count.at("characters-with-spaces") // 12
#count.at("normal-pages") // 0.005Copy char-count.typ into your project and import the
functions you need:
#import "char-count.typ": char-count, char-count-of, total-characters-with-spaces, total-normal-pagesWhen installed as a local Typst package, use:
#import "@local/char-count:0.1.0": char-count, char-count-of, total-characters-with-spaces, total-normal-pagesThe 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