Skip to main content

Module counts

Module counts 

Source
Expand description

Word, character, and paragraph counts over the text a reader sees.

The numbers a status bar shows are a claim about the document, not about the markup that spells it: **bold** is one word and four characters, a link is its label and not its destination, and a picture is a picture. So the tally runs over a VisualMap — the same rendering the WYSIWYG view paints — rather than over the source string, and cannot drift from what is on the page the way a second, private markdown walk would.

What it takes off that map is narrower than what the map draws. A glyph counts only if it is a caret stop (Glyph::stop) and its Role is one a reader would call text. The first half drops the scaffolding a proportional surface draws but nobody types into — a nested item’s indent, a cell’s alignment padding — and, because a stop opens a grapheme cluster and never sits inside one, makes “one stop” and “one character” the same statement. The second drops the synthetic furniture: a bullet, a quote’s gutter, a rule, a hidden delimiter revealed under MarkupMode::Full, and the 🖼 alt / ⧉ name placeholder a block picture or directive stands in as.

Structs§

TextCounts
Statistics over the text a reader sees. See Doc::counts for the rules each field is counted by, and crate::counts for what “sees” means.