| Crates.io | typst-count |
| lib.rs | typst-count |
| version | 0.1.0 |
| created_at | 2026-01-17 18:58:05.843686+00 |
| updated_at | 2026-01-17 18:58:05.843686+00 |
| description | Count words and characters in Typst documents |
| homepage | |
| repository | https://github.com/HollowNumber/typst-count |
| max_upload_size | |
| id | 2050962 |
| size | 190,037 |
A command-line tool to count words and characters in Typst documents.
cargo install typst-count
git clone https://github.com/HollowNumber/typst-count.git
cd typst-count
cargo install --path .
# Count both words and characters
typst-count document.typ
# Count only words
typst-count document.typ --words
# Count only characters
typst-count document.typ --characters
# Human-readable output (default)
typst-count document.typ
# JSON output for scripting
typst-count document.typ --format json
# CSV output for data analysis
typst-count document.typ --format csv
# Count multiple files with totals
typst-count doc1.typ doc2.typ doc3.typ
# Output results to a file
typst-count *.typ --output results.json --format json
# Exclude imported/included files (count only main file)
typst-count document.typ --exclude-imports
# Quiet mode (exit code only, useful in CI)
typst-count document.typ --quiet
# Set limits with exit codes (useful for CI/CD)
typst-count document.typ --min-words 500 --max-words 1000
typst-count document.typ --min-chars 2000 --max-chars 5000
typst-count compiles your Typst document and extracts the rendered text content. This means:
*bold*, _italic_)wc -w). Note: For languages without spaces (e.g., Chinese, Japanese), each character may be counted as a separate "word"File: document.typ
Characters: 1,842
Words: 287
{
"files": [
{
"path": "document.typ",
"characters": 1842,
"words": 287
}
],
"total": {
"characters": 1842,
"words": 287
}
}
Check word count limits in your CI pipeline:
# .github/workflows/check-docs.yml
- name: Check documentation word count
run: |
cargo install typst-count
typst-count docs.typ --min-words 1000 --max-words 5000
Exit codes:
0: Success (within limits if specified)1: Below minimum or above maximum limit2: Compilation or other errorwc: Counts only rendered text, not markup/codeContributions are welcome! Please feel free to submit issues or pull requests.
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)# Clone the repository
git clone https://github.com/HollowNumber/typst-count.git
cd typst-count
# Run tests
cargo test
# Run clippy
cargo clippy --all-targets
# Format code
cargo fmt
This project is licensed under the MIT License - see the LICENSE file for details.
wc and modern Typst tooling