Skip to main content

A linter & formatter for consistent HTML code, or else.

Reason this release was yanked:

Bug

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

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.0rc1.tar.gz (109.8 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.0rc1-cp313-cp313-win_amd64.whl (511.2 kB view details)

Uploaded CPython 3.13Windows x86-64

cutesy-1.0rc1-cp313-cp313-win32.whl (465.4 kB view details)

Uploaded CPython 3.13Windows x86

cutesy-1.0rc1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (953.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

cutesy-1.0rc1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (990.6 kB view details)

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

cutesy-1.0rc1-cp313-cp313-macosx_11_0_arm64.whl (599.1 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

cutesy-1.0rc1-cp312-cp312-win_amd64.whl (511.4 kB view details)

Uploaded CPython 3.12Windows x86-64

cutesy-1.0rc1-cp312-cp312-win32.whl (466.1 kB view details)

Uploaded CPython 3.12Windows x86

cutesy-1.0rc1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (957.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

cutesy-1.0rc1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (996.6 kB view details)

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

cutesy-1.0rc1-cp312-cp312-macosx_11_0_arm64.whl (599.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for cutesy-1.0rc1.tar.gz
Algorithm Hash digest
SHA256 f1adca493d9858d2d0ae6933f1465dbece6dac2f38df32710f8fadafcbd3a280
MD5 54d5ef057925167059a9e61d7ccab5c8
BLAKE2b-256 ed16cda7dc73f253f60a4cad38c4246f09b315cf237d9b54b19cfdbd5fc54b00

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: cutesy-1.0rc1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 511.2 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.0rc1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 b05b066ff16e6bdde26695bf284d6564d36e9d1154203dac1d52720a1f957822
MD5 eab8bd247e0b5ea89d78420094a43b13
BLAKE2b-256 cf0baf7e1179b6364ea2e3357adb7e43cdb0483e4f0c057044db4cb9029041f9

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: cutesy-1.0rc1-cp313-cp313-win32.whl
  • Upload date:
  • Size: 465.4 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.0rc1-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 23bc8f3ce9688bd917a2505f6a6d7b3e0b497fb25a1a45bf6bbd3b0e3c1ce851
MD5 a02254acf87efb53a5f65aa0ec1597be
BLAKE2b-256 d8cc46fdf25f9de7c05c4fbcc7096eba1b567a5bfc957d348e1190d1cd4d8023

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cutesy-1.0rc1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6631fde7c23b815d93ea1fbf581a3e41b6f5665f132db8fbd4c5f6cb5bcccc5d
MD5 73f944f80caf2850785dbbfa316bdba8
BLAKE2b-256 18d99afd03d82f38568ca48c3fb3a68a373fed6a39cdfcff1dac37fbca222e7d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cutesy-1.0rc1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 6c5d99197f4920b4deb4ce697a58c89bad93bfca8a614d4960fc0ee27fa1e7d3
MD5 603eb9d46944d3fa102df02a87da02c2
BLAKE2b-256 1b26eef218aab0287ec47367acdf5e1878e37b0165353f8982e59922ba6ecbc4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cutesy-1.0rc1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8f8bd57dfca4b583dea637c083980fa8bc3feb06a8097b619bc288b5506da816
MD5 eb2a5c28e135767915c563492a7641f4
BLAKE2b-256 0e7e755ca09009600d74e83eb9b397a2fc7a5a450363456d5e477db58d9a930d

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: cutesy-1.0rc1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 511.4 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.0rc1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 2755420cfabb773ee9fbaeaecbafde803011c84171f59a97f62e2dc3ebd87ef9
MD5 60efc3e2913c559409d374bc166d9fa2
BLAKE2b-256 5e38f46e91db0417ea4cd46bf543baef087808db1a0d4a42583d23d0b85246fd

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: cutesy-1.0rc1-cp312-cp312-win32.whl
  • Upload date:
  • Size: 466.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.0rc1-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 9af6d46e5bf5223d0d84e31e8f44a7c252036b80528bdc4fdbdf3408f36566f6
MD5 c2eb59e77f828c23feaef51d544f3e31
BLAKE2b-256 aa77b6f4d56123b1317166adcd7bc455f0d13445f2bdfd11b48ccb126be01e6f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cutesy-1.0rc1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 30fdf7d17196cf22b8b2fb199e604a239cf0061b54014df8630df744b3cdba0f
MD5 0119523fe311649fcb15efa0165b326a
BLAKE2b-256 130f5a2c7a5a19ef5d944d29026145b943b41af8486132e961c3cdff1e7077f1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cutesy-1.0rc1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 91e409bdd5067950fba5e299ca450a398868ff5283d6f21e53800d76393b5bd8
MD5 c1c552c74b3d19741035a5dfe536ab24
BLAKE2b-256 4b04f907f37797b8ab843893256bfc86b8a35da0dfae3eadae1b0c5ff7fa677e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cutesy-1.0rc1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 04477d12877f2b9f8ac89f1a17eaea66e0acff7dc2bc6ef3e8cc5bf669070bf3
MD5 aac502c9cbd12b801ba646c44280577c
BLAKE2b-256 042009b6df8e5e3d432312b8050351c9b53f035a8215918af5332b8d5aef38c6

See more details on using hashes here.

Provenance

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