Edge Rewrite
Jump to content

Module:Word count/doc

From Wikipedia, the free encyclopedia
Word_count
DescriptionThis module implements {{Word count}}.
Status
Alpha
UpdatedMay 25, 2026 (2 months ago)
DependenciesModule:Arguments

This module implements {{Word count}}.

Usage

Count the number of words in supplied text:

{{#invoke:Word count|main|Some text here}}

This will output the word count and display the supplied text.

Counting words on another page

To count the words on an existing page without displaying its contents, use the page parameter:

{{#invoke:Word count|main|page=Albert Einstein}}

When page is specified, the module outputs **only the word count** and does not display the page text.

Optional parameters

showcount
Set to yes to display the word count.
When counting another page, the word count is shown by default.
limit
Sets a target or maximum word count.
When provided, the output is styled to indicate whether the count is below, near, or above the limit.
trim
When used with supplied text, trims output to the specified word limit.
This parameter has no effect when page is used.
prepend, append
Text to add before or after the displayed content.
Ignored when page is used.

Notes

  • The page parameter only works for pages on the local wiki.
  • The word count is based on the page’s wikitext, with common non-content elements (such as templates and references) excluded.
  • This module does not expand templates when counting words.

Documentation

Package items

Word_count._main( str, limit ) (function)
Main entry point for modules
Parameters:
str Input string (string)
limit Word count limit (number)
Returns: table with necessary outputs
Word_count.main( frame ) (function)
Entrypoint for template
Parameters:
frame processing frame (table)
frame.args Template arguments (table)
frame.args.page Page mode (string)
frame.args.limit Word count limit (string)
frame.args.showcount whether to show the word count (boolean)
frame.args.trim Whether to trim at the word count limit (boolean)
frame.args.unsubst Whether to convert substitutions into transclusions (boolean)
frame.args.prepend What to prepend prior to word limited section (string)
frame.args.append What to append after word limited section (string)
Returns: Output wikitext (string)

Documentation above is auto generated