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

Status

Build Status Coverage: 92% 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

When to Use Cutesy

Cutesy is great for:

  • Server-rendered HTML templates with Django, Jinja2, ERB, Liquid, and other template engines
  • Attribute-heavy patterns like AlpineJS and HTMX, with smart attribute reordering and formatting
  • Component frameworks like Svelte and Vue (.svelte, .vue files) with HTMLX-style syntax
  • Speed-focused static analysis for HTML — fast, with additional linting and best-practice checks beyond formatting
  • Pluggability — better hooks for custom attribute ordering, validation, and transformation
  • AI code validation — an all-in validation strategy to maximize code quality and catch errors, which agents can use to validate and update their own output

Not for

  • JSX / TSX files — Cutesy formats HTML templates, not JavaScript files.
  • Standalone JS / CSS files — Cutesy’s just for HTML, the templates that generate it, and the styles & scripts inside it. Use a CSS/JS toolchain for external files. Avoid JS or CSS “templates” which accept server instructions; Keep this in your HTML.

Why not Prettier, Stylelint & ESLint? Cutesy uses all three under the hood for formatting scripts & styles, and it will even respect your configuration for each. Cutesy provides access to these tools (as well as Typescript and automated testing) for server-rendered HTML templates, for <style> and <script> blocks inside of HTML documents, and for styles & scripts inside of HTML attributes.

Aside from that, Cutesy enforces an opinionated style for the HTML itself, along with any template-language tags, and it includes additional post-format analysis such as HTML & framework best practices. (Think image sizing, load order, template tag formatting, Tailwind theme setup, etc.)

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.0rc3.tar.gz (113.2 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.0rc3-cp313-cp313-win_amd64.whl (516.9 kB view details)

Uploaded CPython 3.13Windows x86-64

cutesy-1.0rc3-cp313-cp313-win32.whl (470.5 kB view details)

Uploaded CPython 3.13Windows x86

cutesy-1.0rc3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (961.0 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

cutesy-1.0rc3-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (999.1 kB view details)

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

cutesy-1.0rc3-cp313-cp313-macosx_11_0_arm64.whl (604.9 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

cutesy-1.0rc3-cp312-cp312-win_amd64.whl (517.2 kB view details)

Uploaded CPython 3.12Windows x86-64

cutesy-1.0rc3-cp312-cp312-win32.whl (471.1 kB view details)

Uploaded CPython 3.12Windows x86

cutesy-1.0rc3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (965.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

cutesy-1.0rc3-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (1.0 MB view details)

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

cutesy-1.0rc3-cp312-cp312-macosx_11_0_arm64.whl (605.6 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for cutesy-1.0rc3.tar.gz
Algorithm Hash digest
SHA256 25247de5563d5236d43104db11d36d26d38a1b35514ae0a79fb592f9eda052c1
MD5 69518e007532534441b7da850a8a3c67
BLAKE2b-256 c2a530abd59e33a009d844dcbd167f4c6a20da851e40862b2ed67e171211ef66

See more details on using hashes here.

Provenance

The following attestation bundles were made for cutesy-1.0rc3.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.0rc3-cp313-cp313-win_amd64.whl.

File metadata

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

File hashes

Hashes for cutesy-1.0rc3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 cad76b07f473eb5f8ce5ce85e3da0daab3c94af85a0b7967874df793f0b6b1f0
MD5 c7bf83c6f2226eb46d2b113fe8ae2eb1
BLAKE2b-256 824707ff86b55c1320f2c0bb736d281ec45a88eece7df35889c3675fcc84c024

See more details on using hashes here.

Provenance

The following attestation bundles were made for cutesy-1.0rc3-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.0rc3-cp313-cp313-win32.whl.

File metadata

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

File hashes

Hashes for cutesy-1.0rc3-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 18697afa92d701e6d7d01a5c2548ac6473fa2be62349ccc66a268a4294344e31
MD5 fbb055017919caa78a9ac4f7de370f93
BLAKE2b-256 3d0b1a9a0f04880449b1ac1d9fb0b6876a3f8df7c370d3fb1e106645c3b4db4e

See more details on using hashes here.

Provenance

The following attestation bundles were made for cutesy-1.0rc3-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.0rc3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cutesy-1.0rc3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3f8da5a7376cd56ac1abd3935aefdb8220ad9ced58ffaa06e56d507d382be0bd
MD5 3e44f9df0c79a0a3191cf1ef4e426b4d
BLAKE2b-256 4922b3eb27c0ba140ecf9ff815b1374deae4bb593b5a21582274c4c0bce162ba

See more details on using hashes here.

Provenance

The following attestation bundles were made for cutesy-1.0rc3-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.0rc3-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for cutesy-1.0rc3-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 b7971d1da1464120e2faf78701fad77f727744a5f4dde961becad533e7711625
MD5 3ff435688ba971519be02a6db342cc9c
BLAKE2b-256 7417854a0c20a749124ce89f5b3285f9a05bc43ec52eda049c589c78660a426e

See more details on using hashes here.

Provenance

The following attestation bundles were made for cutesy-1.0rc3-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.0rc3-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cutesy-1.0rc3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cd8d8c778b02cf6cd2d6fbd9c2c52b4cae657f24343d19ac34fe4a359cbcaad9
MD5 c360d568d95cc5a1074ef3c251dec208
BLAKE2b-256 9c3906240a263a360f11528f6c57357af070140fce9ad9bc4310377ba894c0e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for cutesy-1.0rc3-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.0rc3-cp312-cp312-win_amd64.whl.

File metadata

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

File hashes

Hashes for cutesy-1.0rc3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 40f690870dc2f8f1c6ef1be419e085e73aa59c924ef5ea2b11ac891f776bcfeb
MD5 79286a1949df39376636c3e6ac0078d8
BLAKE2b-256 1c64a9a62d9a322130dc35ecf7112daf7b223ca4c3a1c3c6ee5e5b0920449a26

See more details on using hashes here.

Provenance

The following attestation bundles were made for cutesy-1.0rc3-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.0rc3-cp312-cp312-win32.whl.

File metadata

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

File hashes

Hashes for cutesy-1.0rc3-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 4d1179d0bfea81f3bc3ef14b84b54d2279125b634164841375e9ac795ff0421d
MD5 f7e010584b900b27eb6ff0fb6cc991a7
BLAKE2b-256 e84c4648436e331c598d544566487cbaff0f8961008b8161814e27e9716fd935

See more details on using hashes here.

Provenance

The following attestation bundles were made for cutesy-1.0rc3-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.0rc3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cutesy-1.0rc3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5e2eb84ae68bf0c0b1d8d296bdb4b465f5c93617609f886f3826fbaa1b8b6277
MD5 76493c6fa559055014fbac401a3dda1e
BLAKE2b-256 9dec2e3205ba06d4271388b9415313c2bdec90397454f9dab84b3dc004d2cca7

See more details on using hashes here.

Provenance

The following attestation bundles were made for cutesy-1.0rc3-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.0rc3-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for cutesy-1.0rc3-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 94abb7286fbd4cb2cdb9bfdde910bf4802873abf3f0dae542ff8475dc991ade5
MD5 8966b9d4f1c8352e4ada2a4da37bad87
BLAKE2b-256 f3aaf311c0ce26b0df5f67f2f99892ce47936cd49e30af1eafa0335442282ef0

See more details on using hashes here.

Provenance

The following attestation bundles were made for cutesy-1.0rc3-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.0rc3-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cutesy-1.0rc3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 82df98ef9b5c9c7f872b1485d65a60e9bf3d77b7d81587175ce890749871ee5b
MD5 f46d91133fd7fa6d1ab8b52db9d98b60
BLAKE2b-256 c0c3d0f6c2d51397d6f8a0369721cb364d68734dd6a48b84be3023e52cbec0cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for cutesy-1.0rc3-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