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.0rc5.tar.gz (114.4 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.0rc5-cp313-cp313-win_amd64.whl (522.0 kB view details)

Uploaded CPython 3.13Windows x86-64

cutesy-1.0rc5-cp313-cp313-win32.whl (474.3 kB view details)

Uploaded CPython 3.13Windows x86

cutesy-1.0rc5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (969.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

cutesy-1.0rc5-cp312-cp312-win_amd64.whl (522.2 kB view details)

Uploaded CPython 3.12Windows x86-64

cutesy-1.0rc5-cp312-cp312-win32.whl (475.1 kB view details)

Uploaded CPython 3.12Windows x86

cutesy-1.0rc5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (975.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for cutesy-1.0rc5.tar.gz
Algorithm Hash digest
SHA256 d617784d3d82864bdcc7a287ce2d9c659e4b5d8c88875793448e080abc62212f
MD5 ffb17efcab4dc0ef91f8a45f8bad6b55
BLAKE2b-256 14d046ffd63c0bf77c418cc99f0be890d36b309eef07ef7e5a6052bea0343c37

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: cutesy-1.0rc5-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 522.0 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.0rc5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8637256e498f465db9ac10c478cdbdea68270826504992334182cda5235804b7
MD5 3977888ea225bb2501a79ed65d233aa2
BLAKE2b-256 21eb869c5b9b767747faee0bd82fce447779139d6a1b3e0cc6c571d1b748b963

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: cutesy-1.0rc5-cp313-cp313-win32.whl
  • Upload date:
  • Size: 474.3 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.0rc5-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 aadc0b0a5bc72beecdb1c578822c9ec599f310ff20e4c5f8bde0d5e5895491ff
MD5 dfebd6e8079d0c1d82bf1da7cc55a40a
BLAKE2b-256 033cb5db4f64aac4b42af366d430823d9b41b0dd2a9640507f18481fcb2d9108

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cutesy-1.0rc5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c748bd196c99c457c69c39f2cc51a1cd0623f852acf5a86f11bb4937aeff5c06
MD5 02ecee240664c90359599040e4906495
BLAKE2b-256 8acddfc41b6b31b4994286ec7defee45eb36600dfac2ccc7ef3aa8a02282d6fd

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cutesy-1.0rc5-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 0a2b0a927ef707e20c59dee8791ce17a824c76320c8c86a305169e5b8ea5ecca
MD5 704d868dd3e2f436f9af27c27084bbaa
BLAKE2b-256 fec684e59dca0f345f2cdbbe6c6383fae5ce72d9793d7b56a5004f234f6db034

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cutesy-1.0rc5-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 81914fb3091bfd56c96e22f4c39c226ad7b2449f883a2dc15cce68f4d982f400
MD5 ef435b76e5cf7347d598c907424df65a
BLAKE2b-256 4b04f7fd7f6e9a60b017132802c8a041e833c2b801e4f10fb0025a349d5f2579

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: cutesy-1.0rc5-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 522.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.0rc5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e7d99bf1f4b8665e7dda154e1b9bf9df00059af3a107fa8ab5411b85042b4d7e
MD5 97290e3dcbbdce284ece4adf9e5e6040
BLAKE2b-256 b8b978a47152dc54f20f803b21eb2695df23b0d000b00cc4f1e83155510c0c65

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: cutesy-1.0rc5-cp312-cp312-win32.whl
  • Upload date:
  • Size: 475.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.0rc5-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 072c9561dbbf8a97938920dd8b7b374e086aa3990fc597e877087540a83e18bb
MD5 df1779ce109fd832bc7a1468f9a475a8
BLAKE2b-256 aeb8dc61a4a8c5c814d1f0921add2e2456be9eaa1a3b06567db935a2bf47761b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cutesy-1.0rc5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fa52246aa9dedb2e8e8c44862818d371ae94db7ca9724d6edb936ab0f28975e0
MD5 8b8fac054382d7dcb37026254299db22
BLAKE2b-256 5f8d4545f0a66d059e7f0e036573b2a3496d35105700b6e3f920c05506ffd67c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cutesy-1.0rc5-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 177968c2326207fbdb629c126dfe2e40a802ac5baafdf87e60afb28a840e26af
MD5 2d0a2d1b5f5f87f53678edf6303672b4
BLAKE2b-256 d6c5b1bfbce2bb4a74475ff1cbd8d88855b733ecfbf7f8c1879e952cc0edcd30

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cutesy-1.0rc5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ac26edbbec1e0769effdbb35256cf289231f893fb2e2e0b9da7a6ec593fe3fda
MD5 c3c5fc8f653aab991f1d4529da370bd4
BLAKE2b-256 6b08d630e73c637ec5a077b1f18244f313fa98d9c01b8006ad2c2f48a1370d57

See more details on using hashes here.

Provenance

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