Skip to main content

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: Rust-accelerated core for high performance

Status

Build Status Coverage: 91% PyPI - Version

Table of Contents

🚀 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.12+ 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, development setup, Rust extensions
Distribution Guide PyPI publishing, Homebrew formula, package management

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.

code style: cutesy

[![code style: cutesy](https://img.shields.io/badge/code_style-cutesy_🥰-fd7f9c.svg?style=flat)](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 tidy with Cutesy! 🥰

or els̴͔e

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cutesy-1.0b28.tar.gz (89.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

cutesy-1.0b28-cp313-cp313-win_amd64.whl (423.5 kB view details)

Uploaded CPython 3.13Windows x86-64

cutesy-1.0b28-cp313-cp313-win32.whl (386.5 kB view details)

Uploaded CPython 3.13Windows x86

cutesy-1.0b28-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (804.1 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

cutesy-1.0b28-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (838.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ i686manylinux: glibc 2.5+ i686

cutesy-1.0b28-cp313-cp313-macosx_11_0_arm64.whl (503.4 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

cutesy-1.0b28-cp312-cp312-win_amd64.whl (423.7 kB view details)

Uploaded CPython 3.12Windows x86-64

cutesy-1.0b28-cp312-cp312-win32.whl (386.9 kB view details)

Uploaded CPython 3.12Windows x86

cutesy-1.0b28-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (808.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

cutesy-1.0b28-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (843.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ i686manylinux: glibc 2.5+ i686

cutesy-1.0b28-cp312-cp312-macosx_11_0_arm64.whl (504.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file cutesy-1.0b28.tar.gz.

File metadata

  • Download URL: cutesy-1.0b28.tar.gz
  • Upload date:
  • Size: 89.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cutesy-1.0b28.tar.gz
Algorithm Hash digest
SHA256 f5f081f7ca1f4e5f5879af2f41d320d98ab648b8e984b54228108bb40e251314
MD5 c006a487d50ea653d7f07f79363ec782
BLAKE2b-256 b03fcf79e6ae09ec67b2b68b9f08a08741b56b928dc1381e4bb44bc162221356

See more details on using hashes here.

Provenance

The following attestation bundles were made for cutesy-1.0b28.tar.gz:

Publisher: publish-to-pypi.yml on chasefinch/cutesy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cutesy-1.0b28-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: cutesy-1.0b28-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 423.5 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cutesy-1.0b28-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 bd8d5383bf302a9dc1f000fea58fd58e982acfddfd532d4880ec572cd03fe002
MD5 fa571810dd2fdb245bc18a9529bd3f70
BLAKE2b-256 525b9e0bbac14b90ab841eb0a615a416ba52410e5cb6581dc0b26a7dae8319d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for cutesy-1.0b28-cp313-cp313-win_amd64.whl:

Publisher: publish-to-pypi.yml on chasefinch/cutesy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cutesy-1.0b28-cp313-cp313-win32.whl.

File metadata

  • Download URL: cutesy-1.0b28-cp313-cp313-win32.whl
  • Upload date:
  • Size: 386.5 kB
  • Tags: CPython 3.13, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cutesy-1.0b28-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 e7d6dcf8c96d02e98bc287117dae34ffb0fcfe2ea110b79bafd425b8ff605825
MD5 e0e76632f74af33209401cd8fcd7c8cf
BLAKE2b-256 e9bc76107ae7b24230ea989c8d32d28e65f862902db3cd36d4376106150a6f39

See more details on using hashes here.

Provenance

The following attestation bundles were made for cutesy-1.0b28-cp313-cp313-win32.whl:

Publisher: publish-to-pypi.yml on chasefinch/cutesy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cutesy-1.0b28-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cutesy-1.0b28-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4494783febc60a05180e9e645e6e57e48a98a8e45825a974a181e8e16a6fcb1f
MD5 9afd0b6bed1be04048d84077515e3757
BLAKE2b-256 f4c8d317b0ad83fb790e613e8d3483fa011acf881fb5d7b2c787d5dfd2012494

See more details on using hashes here.

Provenance

The following attestation bundles were made for cutesy-1.0b28-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish-to-pypi.yml on chasefinch/cutesy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cutesy-1.0b28-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for cutesy-1.0b28-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 80edcc45651274a81b482246852faf7cb0ec6f41ccc587750706b568be8ef4d7
MD5 eb23e664dad39b8e010838505323fb8c
BLAKE2b-256 6a6bb619c9ca6262486934b7afe078a7c8ad7bdee86f6b0dec58a680c50030f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for cutesy-1.0b28-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl:

Publisher: publish-to-pypi.yml on chasefinch/cutesy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cutesy-1.0b28-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cutesy-1.0b28-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7a8a8c2cc30601ce9dc9650911e449a75765a4d4aaa3a079b047fc9894d0c24f
MD5 3609af0f7b00ce916295ca6449c25d2a
BLAKE2b-256 dcfcdc3905bc335e1ca5bf82ac32d7901411be4ba767eb8f8573cf8ceabd26d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for cutesy-1.0b28-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: publish-to-pypi.yml on chasefinch/cutesy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cutesy-1.0b28-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: cutesy-1.0b28-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 423.7 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cutesy-1.0b28-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 2a7acbf4a9efbc1f021d604b58b4bd474163018bcbd7fc8944adc30a61933aed
MD5 3ce4b0e60e552f8d5ff9557af48fc4ae
BLAKE2b-256 824739ff875d835e5c19322b2bfe37dfb4fb65204857abb7274a61b26b8814c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for cutesy-1.0b28-cp312-cp312-win_amd64.whl:

Publisher: publish-to-pypi.yml on chasefinch/cutesy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cutesy-1.0b28-cp312-cp312-win32.whl.

File metadata

  • Download URL: cutesy-1.0b28-cp312-cp312-win32.whl
  • Upload date:
  • Size: 386.9 kB
  • Tags: CPython 3.12, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cutesy-1.0b28-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 afa48e258325b5f421a6c3b6b849a631a360415c60bb0ea6a4011fede12c7de7
MD5 e2f41dda8d8c42341cbf6a3608245ea5
BLAKE2b-256 24f89e292f8021401e70bd2315121dd0d0da3a39e870e13f6b13a85219120cfa

See more details on using hashes here.

Provenance

The following attestation bundles were made for cutesy-1.0b28-cp312-cp312-win32.whl:

Publisher: publish-to-pypi.yml on chasefinch/cutesy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cutesy-1.0b28-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cutesy-1.0b28-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 669dcda4888795a26273abedbb374aefc60519552e3b4ada814f5c562cfcc392
MD5 3ab4d05feb68a39c54f1d6c3900b3e63
BLAKE2b-256 ab84e1306d335140f18a4a8bbae2509c04409e8a846e46028007ab61abfeceb8

See more details on using hashes here.

Provenance

The following attestation bundles were made for cutesy-1.0b28-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish-to-pypi.yml on chasefinch/cutesy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cutesy-1.0b28-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for cutesy-1.0b28-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 842bae6a7b843b607d6785dbf782b8fb3d0c56d1dcb1960cca51ea2745184c2f
MD5 cb2f0a065658d1bed89cabfa0dd171f7
BLAKE2b-256 a01802f701d291dd98bc3b4c0106c39bb3f862dad8f67e74719de375d8739398

See more details on using hashes here.

Provenance

The following attestation bundles were made for cutesy-1.0b28-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl:

Publisher: publish-to-pypi.yml on chasefinch/cutesy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cutesy-1.0b28-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cutesy-1.0b28-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 def79d894218f1a662d1316aded1540840172a27cbdbf5d0e9b6a595480e4b6a
MD5 23d491d1413f38d64b0c8ee5057bafd3
BLAKE2b-256 54dcb68569d1f5c1a7fcd988747dd21fec4677ce2741017418d1cd004bd4e501

See more details on using hashes here.

Provenance

The following attestation bundles were made for cutesy-1.0b28-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: publish-to-pypi.yml on chasefinch/cutesy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page