A linter & formatter for consistent HTML code, or else.
Project description
Cutesy 🥰
A cute little HTML linter, until y̵ou ma̴k̵e i̴͌ͅt̴̖̀ a̵̤̤͕̰͐̅͘͘n̶̦̣͙̑̌̆̄ǵ̷̗̗̀͝r̷̭̈́͂͘ẙ̶͔̟̞̊̈…̴̢͘
Cutesy reformats & lints HTML documents, including HTML templates. It ensures consistent indentation, line breaks, and formatting while automatically fixing most issues.
First-class support for your favorite frameworks ❤️
- Full support for Django templates 🐍💕
- Sorts classes for TailwindCSS 💖✨
- Works with AlpineJS and HTMX ⚡💘
Features ✨
- Auto-fix: Automatically corrects most formatting issues
- Configurable: Extensive configuration options for your project's needs
- Fast: Processes large codebases quickly
Status
Table of Contents
- Quick Start
- Installation
- Basic Usage
- Configuration
- Framework Support
- Examples
- Documentation
- Benefits
- Badge
- License
- Contributing
🚀 Quick Start
Install:
pip install cutesy
Format your HTML files:
cutesy "*.html" --fix
For Django projects with TailwindCSS:
cutesy "templates/**/*.html" --fix --extras=[django,tailwind]
Installation
Cutesy requires Python 3.11+ and works on Linux, macOS, and Windows.
Basic Installation:
pip install cutesy
For system-wide CLI tool:
pipx install cutesy
Development Installation:
git clone https://github.com/chasefinch/cutesy.git
cd cutesy
pip install -e .
📚 Detailed guide: See Installation Documentation for editor integration, pre-commit hooks, and CI/CD setup.
Basic Usage
Command Line
Check files for issues:
cutesy "*.html" # Check all HTML files
cutesy "templates/**/*.html" # Check recursively
cutesy --code '<div>test</div>' # Check code string
Fix issues automatically:
cutesy "*.html" --fix # Fix all issues
cutesy "*.html" --fix --quiet # Fix quietly
cutesy "*.html" --return-zero # Don't fail CI on issues
Key Options
| Option | Description | Example |
|---|---|---|
--fix |
Auto-fix issues (recommended) | cutesy "*.html" --fix |
--extras |
Enable template/framework support | --extras=[django,tailwind] |
--ignore |
Ignore specific rules | --ignore=[F1,D5] |
--quiet |
Suppress detailed output | --quiet |
--check-doctype |
Process non-HTML5 files | --check-doctype |
Configuration
Configuration Files
Create a cutesy.toml file in your project:
fix = true
extras = ["django", "tailwind"]
indentation_type = "spaces"
line_length = 99
ignore = ["F1"] # Ignore specific rules
Also supports:
pyproject.toml(under[tool.cutesy])setup.cfg(under[cutesy])
Common Configurations
Django + TailwindCSS:
fix = true
extras = ["django", "tailwind"]
line_length = 120
max_items_per_line = 6
📚 Complete guide: See Configuration Documentation for all options and examples.
Framework Support
Django Templates
Enable Django template processing:
cutesy "templates/*.html" --fix --extras=django
Supports:
{% %}template tags with proper indentation{{ }}variables- Template inheritance (
{% extends %},{% block %}) - Complex template logic with nested HTML
Example transformation:
<!-- Before -->
{% if user.is_authenticated %}
<div class="welcome">
<h1>Welcome, {{ user.name }}!</h1>
{% endif %}
<!-- After -->
{% if user.is_authenticated %}
<div class="welcome">
<h1>Welcome, {{ user.name }}!</h1>
</div>
{% endif %}
TailwindCSS
Automatic class sorting and organization:
cutesy "*.html" --fix --extras=tailwind
Features:
- Smart sorting: Groups utility classes logically
- Responsive prefixes: Maintains
sm:,md:,lg:order - Pseudo-classes: Preserves
hover:,focus:, etc. - Custom classes: Keeps your custom classes at the end
Example:
<!-- Before -->
<div class="text-red-500 p-4 bg-white hover:bg-gray-100 md:p-8 rounded-lg">
<!-- After -->
<div class="bg-white hover:bg-gray-100 p-4 md:p-8 rounded-lg text-red-500">
AlpineJS & HTMX
Cutesy works great with attribute-heavy frameworks:
- Proper indentation for multi-line attributes
- Whitespace normalization inside attributes
- Consistent formatting across your components
Examples
Cutesy ensures that HTML documents contain consistent whitespace, follow best practices, and adhere to common conventions. In --fix mode, Cutesy turns this:
<!doctype html>
<html>
<head>
<title>Cutesy 🥰 demo</title>
</head>
<body>
<h1>Hi there!</h1>
{% if request.user.is_authenticated %}
<p>Cutesy is so happy when your code is neat.</p>
{% endif %}
<div class='danger-zone'
id="lintTrap" ></div >
</body>
</html>
…into this:
<!doctype html>
<html>
<head>
<title>Cutesy 🥰 demo</title>
</head>
<body>
<h1>Hi there!</h1>
{% if request.user.is_authenticated %}
<p>Cutesy is so happy when your code is neat.</p>
{% endif %}
<div id="lintTrap" class="danger-zone"></div>
</body>
</html>
Real-World Usage
Django Project:
# Format all templates
cutesy "templates/**/*.html" --fix --extras=[django,tailwind]
# Check before committing
cutesy "templates/**/*.html" --quiet
Static Site:
# Format with custom config
cutesy "src/**/*.html" --fix --line-length=120
# Format specific files
cutesy "src/components/*.html" --fix --extras=tailwind
Documentation
| Document | Description |
|---|---|
| Installation Guide | Complete installation instructions, editor integration, CI/CD setup |
| Configuration Guide | All configuration options, file formats, project examples |
| Rules Reference | Complete list of all rules with examples and fixes |
| Development Guide | Contributing, testing, and development setup |
Benefits
- ✅ Validate AI code output - Catch inconsistencies in generated HTML
- ✅ Enforce team standards - Consistent formatting across all developers
- ✅ Catch errors early - Find malformed HTML and template syntax issues
- ✅ Save time - No more manual formatting or style discussions
- ✅ Better code reviews - Focus on logic, not formatting
- ✅ Framework integration - Works with your existing tools and workflows
Badge
Show off how Cutesy keeps you in line.
[](https://github.com/chasefinch/cutesy)
License
MIT License - see LICENSE file for details.
Contributing
We welcome contributions! Whether it's:
- 🐛 Bug reports via GitHub Issues
- 💡 Feature requests via GitHub Discussions
- 🔧 Code contributions via Pull Requests
- 📖 Documentation improvements
See our Development Guide for getting started.
Keep your HTML cute and tidy with Cutesy! 🥰
Or els̴͔e.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cutesy-1.0b9.tar.gz.
File metadata
- Download URL: cutesy-1.0b9.tar.gz
- Upload date:
- Size: 75.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed2480de4e45fd98fc9a1787144341803e1979daf5c39e083444feae6ee3f614
|
|
| MD5 |
d4f835383e1160a14d72c8990cd0f8fc
|
|
| BLAKE2b-256 |
6e4d8e9096c65734b6c769228920631c5618c492a092dff600fb8b5d4359fb3f
|
Provenance
The following attestation bundles were made for cutesy-1.0b9.tar.gz:
Publisher:
publish-to-pypi.yml on chasefinch/cutesy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cutesy-1.0b9.tar.gz -
Subject digest:
ed2480de4e45fd98fc9a1787144341803e1979daf5c39e083444feae6ee3f614 - Sigstore transparency entry: 538485990
- Sigstore integration time:
-
Permalink:
chasefinch/cutesy@1d23beec53c2ea418fc2310939e625cdb681216a -
Branch / Tag:
refs/tags/v1.0b9 - Owner: https://github.com/chasefinch
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@1d23beec53c2ea418fc2310939e625cdb681216a -
Trigger Event:
push
-
Statement type:
File details
Details for the file cutesy-1.0b9-py3-none-any.whl.
File metadata
- Download URL: cutesy-1.0b9-py3-none-any.whl
- Upload date:
- Size: 89.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c79f5c5d9e99c0ef336943f7e7faba957222e3d308b78fa2ec8e1c78a314fae
|
|
| MD5 |
7b4becb0001a450271164aa2e72b5476
|
|
| BLAKE2b-256 |
e05e9bcd57c2e17fa4c8b56244a1bccffd6402795f84e26dadbb4900bff4445d
|
Provenance
The following attestation bundles were made for cutesy-1.0b9-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on chasefinch/cutesy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cutesy-1.0b9-py3-none-any.whl -
Subject digest:
2c79f5c5d9e99c0ef336943f7e7faba957222e3d308b78fa2ec8e1c78a314fae - Sigstore transparency entry: 538486033
- Sigstore integration time:
-
Permalink:
chasefinch/cutesy@1d23beec53c2ea418fc2310939e625cdb681216a -
Branch / Tag:
refs/tags/v1.0b9 - Owner: https://github.com/chasefinch
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@1d23beec53c2ea418fc2310939e625cdb681216a -
Trigger Event:
push
-
Statement type: