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.0rc4.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.0rc4-cp313-cp313-win_amd64.whl (516.9 kB view details)

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13Windows x86

cutesy-1.0rc4-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.0rc4-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.0rc4-cp313-cp313-macosx_11_0_arm64.whl (604.9 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12Windows x86

cutesy-1.0rc4-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.0rc4-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.0rc4-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.0rc4.tar.gz.

File metadata

  • Download URL: cutesy-1.0rc4.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.0rc4.tar.gz
Algorithm Hash digest
SHA256 60cb275750152baed814ee9e58679292f74c3cf4d4e6723d5c11cdba5658c2c6
MD5 28335a0041ede76ada189f6e80dfb7bf
BLAKE2b-256 2ae8fc93b6bdc29e440a8fc58c1a63f0a3277ecf5390d16e592f4fbf6ccfdc4d

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: cutesy-1.0rc4-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.0rc4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8a8b87f09330d17fcd50a93b0024ee4dcee89657db86959ed15089aa618493be
MD5 e8473c56856c61e4d3e8d249ae23719e
BLAKE2b-256 bb38b917b0dbcd2abf3f7d5955575fe3949cc443266d29444569d9eba8138b4f

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: cutesy-1.0rc4-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.0rc4-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 a3f590e3a8b906bddd9bef5d2e0759b37c8c708c06ac683ecf223c4ec5e71671
MD5 08699a067167e4452c6f2f9996d83c15
BLAKE2b-256 5b26ada20829dbd4e029b219410e89d1f009bc1ccea1f47c4dc7cc7b6de16003

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cutesy-1.0rc4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f2b459f169178b72fea057fbb026db6baf6b26b60407fa77169d1e40186daee1
MD5 652d8fb3365edb385aa1c8ea02b79d0d
BLAKE2b-256 6323d1706bd141d570c28e8e3660172beb5716bba7068e22475d072e3244a16d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cutesy-1.0rc4-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 1f8ab26f07744b0b07ad167a19efc88de8a728694a13ef74573e8729e854b7c7
MD5 7dd54a4d3b5d4bff8df741ae216cdec1
BLAKE2b-256 1a55f21fef4f836b8b4db3bb147e6e81660fd33623075b8811cfec534ca290d0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cutesy-1.0rc4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7925481bf0c516f3f5d9c80bc52b2062e25b87a1412bad6a7291b7c765f98b29
MD5 dc411afb54132009eadc1672ebfaead6
BLAKE2b-256 c705cd9540e3ac6d62d70f1116723f4032dfbfd6f489797d74d547596c27e3ca

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: cutesy-1.0rc4-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.0rc4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ca904518e937934c23a64199b88deb9a67c5b9c5ab901cae71711fbb30a1890c
MD5 9787d59e83eead78d08cf0d40755b57d
BLAKE2b-256 ab33737f70723a6e990e554c8ba370f82e793163e2454a9dc3d16eec5f37db3a

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: cutesy-1.0rc4-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.0rc4-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 8df1bded022cd0176f5646a445a9c4d5fdf000669f8ed0f763a9db1139f5342d
MD5 c7ddf2e7070304a654dc6eae63a4e2af
BLAKE2b-256 1b861cf8139908aaba43781f2fa14c9b4e5a9571aaea38fe356a85cf3aa84f5f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cutesy-1.0rc4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5d8ab1b93731e573cd99bdfa2bf441065d3ed90c48fb4dfd0afd71335939c154
MD5 b631a6c74d9364699b6099b94a94fb45
BLAKE2b-256 1cf969a16a87c74ea2035142204bf976ee3fffb22b13c7dffb28a64d66747b19

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cutesy-1.0rc4-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 488ec88c00cca5c37d78551b57e4b8c67137bb3a4fa4de63304571a6b204fb31
MD5 0dbc86b7b8e38b1719f6470e4acc87d2
BLAKE2b-256 084341b397fa4475f083d632e84c8eceb6626dc62bf841fa2ba4cb64092fd88b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cutesy-1.0rc4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9416331cf9d6b40c53d869e52ef71f506a81d5a76e3d1bc0496db9b0db60a48d
MD5 506129565546c733517fe355e02dc18a
BLAKE2b-256 b60c47ed9546cb800845a790a02662f1ff725e4d90f9a87064e9c8b9399e0bec

See more details on using hashes here.

Provenance

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