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.0rc6.tar.gz (115.0 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.0rc6-cp313-cp313-win_amd64.whl (523.4 kB view details)

Uploaded CPython 3.13Windows x86-64

cutesy-1.0rc6-cp313-cp313-win32.whl (475.7 kB view details)

Uploaded CPython 3.13Windows x86

cutesy-1.0rc6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (971.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

cutesy-1.0rc6-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (1.0 MB view details)

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

cutesy-1.0rc6-cp313-cp313-macosx_11_0_arm64.whl (610.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

cutesy-1.0rc6-cp312-cp312-win_amd64.whl (523.6 kB view details)

Uploaded CPython 3.12Windows x86-64

cutesy-1.0rc6-cp312-cp312-win32.whl (476.4 kB view details)

Uploaded CPython 3.12Windows x86

cutesy-1.0rc6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (978.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

cutesy-1.0rc6-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.0rc6-cp312-cp312-macosx_11_0_arm64.whl (611.7 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for cutesy-1.0rc6.tar.gz
Algorithm Hash digest
SHA256 42ec46fef38cd80f3ce34e70c3bcb7eb28af556a15dc7d8d2a9bebf7af80a2c3
MD5 1a773de441859a783602c4e752d36791
BLAKE2b-256 31c2544b7e818d25bc3a9f58d2ef57c0be3d8c821200be89b7399b09c984a6f3

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: cutesy-1.0rc6-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 523.4 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.0rc6-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8cef810e13682c606e56a0a41cf066f61e4fdb4b61eaf36679b8a68e4f2843b4
MD5 bc825e47dbbf2ea70980fb83cfd5acf7
BLAKE2b-256 a4b9f129b3e2d914dc518a649c13cc2658ed9ae77c79bd393b0b51a63773762d

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: cutesy-1.0rc6-cp313-cp313-win32.whl
  • Upload date:
  • Size: 475.7 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.0rc6-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 83890aca90187b805d8388458732230c9fc31e5c214dd8dab51184379b749587
MD5 a13d3e5ad190e03b1c3ec8e9fa277ece
BLAKE2b-256 6cd36a9e08f3c92bccd4c1586159f542c899df867343ed80a775973393bb49c9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cutesy-1.0rc6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c52904d0fd632b9032ffafd33b64921a8f02b5af45bb18d1d80f6a8e5815065e
MD5 7f5b654538f2327eb87f44282f8b6e5f
BLAKE2b-256 c234f6c33664ce1aadb6cd587b6b307468ae73400bdf0c9752bd45c2fb17e83d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cutesy-1.0rc6-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 6e2453a3ff7c453df82eec318e8d973a9642797b2ccfc4655116b7095a7322fa
MD5 9d693e656cc65efb9b30f11e940659e4
BLAKE2b-256 e21c3446b57e977d2802cff4ea11f6bfd3b26f294fcca34ec2db83b88df62f39

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cutesy-1.0rc6-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1c8fb10e34a2d7fccd9f023fe6f306cc62175b8d1d073ee67c30ec66deee7edb
MD5 0bea34b11bc2ead654e1458569cb65b7
BLAKE2b-256 8d15ccbc625164125e60e05ef03d932cfd24ab3f6caaf1598aaf3fc81ec82064

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: cutesy-1.0rc6-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 523.6 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.0rc6-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4f6034ed5ff19332e7e83cec65dad1ccc66e196da6e11aaec22ddde16d25cde2
MD5 dd9bb52f9aa8d46a205f09dd78debe1c
BLAKE2b-256 36b0d9ff80f7813f3bd887f5a187577acc5ccb641d8bbb288811a0b5cd557a19

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: cutesy-1.0rc6-cp312-cp312-win32.whl
  • Upload date:
  • Size: 476.4 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.0rc6-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 16d0bd3cfe09ad137668be448655bed6b0db8d53051794114b36848c7dfc2f87
MD5 cfb4e4ca7c1d2140ca294ac81774503b
BLAKE2b-256 3a158326320b946849e75887f41de3c9fdc36cbc13c8cd6d64bfd9d58accaf0c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cutesy-1.0rc6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 39cea54d0829df0d88d268ec577ba04d543b712851f1c56f4640c61b86e83d23
MD5 caa318a5dfa72c6bca59ebe71621c2ad
BLAKE2b-256 f16ba68ab67373e7e2c020a1f85456137832c2f16d2d8e0416ba41031a9391d5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cutesy-1.0rc6-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 3c47f1d73f00812482cc8eb920a02da086a32dd4da0af065db20c701e6e922a1
MD5 4571a6236b3300d1bfb32d3bd91319f0
BLAKE2b-256 ab1681d54bcd5fd7111a2fa7f19f0983c6b4c5043c938b9d42513c422aa00a71

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cutesy-1.0rc6-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 aeaa06c627b01bc5ab5de706286ba218e28fca24ff2fb2adc7046b32b2c57529
MD5 6df18c091032c379200c655ed4d7b896
BLAKE2b-256 a36b485058425b1467a321819023ae1a0712c5330e808ac83f6fca1c099dc430

See more details on using hashes here.

Provenance

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