TypoLima is a tiny, conservative command-line tool that fixes common typographic issues in HTML, PHP, Hugo templates and plain text files according to language-specific rules.
Why the name? TypoLima combines "Typo" with the Latin word lima (file/polish), which was used by classical authors to describe the final, meticulous polishing of a literary work (labor limae).
It only touches text content (never tags, attributes, scripts, style blocks, Hugo {{ }} shortcodes etc.) and prefers to do nothing rather than risk breaking something.
- Smart curly quotes („ “ for cs, « » for fr, etc.)
- Non-breaking spaces after single-letter prepositions (cs, de, fr …)
- NBSP before units (5 kg, 20 %)
- Intelligent dashes (en-dash
–for ranges10–20, or parenthetical thoughts with NBSP) - Common abbreviations (cs:
s. r. o.,tj.,tzn.) - Automatic units & symbols:
m2→m²,cm3→cm³ - Smart prices:
100,-→100,– - Correct thousands / decimal separators per language
- Spaces around punctuation (especially French style: ? ! : ;)
- Aggressive mode:
(c)→©,+-→±,->→→etc. - Very conservative – skips uncertain cases
- Works on HTML, PHP, Hugo templates, Markdown …
| Code | Language | Quotes | Thousands sep | Decimal sep | NBSP before units? | Special |
|---|---|---|---|---|---|---|
| cs | Čeština | „ “ | , | yes | v s z k o u a i | |
| en | English | “ ” | , | . | yes | |
| fr | Français | « » | , | yes | space before ? ! : ; » | |
| de | Deutsch | „ “ | . | , | yes | |
| it | Italiano | « » / “ ” | . | , | yes | |
| es | Español | « » | . | , | yes | |
| pt | Português | « » / “ ” | . | , | yes |
Option A – via Homebrew (Recommended for macOS)
If you use Homebrew, you can install TypoLima directly from the heptau tap:
brew install heptau/tap/typolimaOption B – via pipx (Isolated installation)
This is the cleanest way to install Python CLI tools without affecting your system Python.
pipx install git+https://github.com/heptau/typolima.gitOption C – via pip You can also install it directly from GitHub using pip:
pip install git+https://github.com/heptau/typolima.gitOption D – From source
git clone https://github.com/heptau/typolima.git
cd typolima
pip install .typolima --help
# Basic usage
typolima article.html --lang cs --in-place
# Show what would change (very useful!)
typolima public/**/*.html --lang fr --dry-run --diff
# Process whole Hugo output
typolima public/ --lang cs --recursive --in-place
# More aggressive mode (convert (c) to ©, +- to ± etc.)
typolima text.md --lang en --aggressive{
"scripts": {
"postbuild": "typolima public/**/*.html --lang cs --in-place"
}
}- Only replaces obvious straight quotes → curly
- NBSP after prepositions only when very clear context
- Skips anything inside
,, <script>, {{ … }}, --dry-run --diffalways shows colorful diff first
- Contributing: Please see CONTRIBUTING.md for guidelines on how to add new languages or report issues.
- License: This project is licensed under the MIT License.