{"id":19609059,"url":"https://github.com/collective/zpretty","last_synced_at":"2025-07-15T11:42:18.633Z","repository":{"id":17307475,"uuid":"81653307","full_name":"collective/zpretty","owner":"collective","description":"A tool to format in a very opinionated way HTML, XML and text containing XML snippets.","archived":false,"fork":false,"pushed_at":"2025-06-18T07:55:47.000Z","size":327,"stargazers_count":9,"open_issues_count":5,"forks_count":5,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-06-20T06:38:49.530Z","etag":null,"topics":["html","indentation","pretty-print","python-library","python-script","xml"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/zpretty/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/collective.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-02-11T13:02:07.000Z","updated_at":"2025-04-07T14:39:55.000Z","dependencies_parsed_at":"2023-09-22T13:20:27.825Z","dependency_job_id":"c0136140-48fb-4946-a033-1510ab93b7b8","html_url":"https://github.com/collective/zpretty","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"purl":"pkg:github/collective/zpretty","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/collective%2Fzpretty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/collective%2Fzpretty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/collective%2Fzpretty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/collective%2Fzpretty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/collective","download_url":"https://codeload.github.com/collective/zpretty/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/collective%2Fzpretty/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265432947,"owners_count":23764193,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["html","indentation","pretty-print","python-library","python-script","xml"],"created_at":"2024-11-11T10:19:08.774Z","updated_at":"2025-07-15T11:42:18.621Z","avatar_url":"https://github.com/collective.png","language":"Python","readme":"![tests](https://github.com/collective/zpretty/workflows/tests/badge.svg)\n\n[![image](https://coveralls.io/repos/github/collective/zpretty/badge.svg?branch=master)](https://coveralls.io/github/collective/zpretty?branch=master)\n\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/collective/zpretty/master.svg)](https://results.pre-commit.ci/latest/github/collective/zpretty/master)\n\nA tool to format in a **very opinionated** way HTML, XML and text\ncontaining XML snippets.\n\nIt satisfies a primary need: decrease the pain of diffing HTML/XML.\n\nFor this reason `zpretty` formats the markup following these rules of\nthumb:\n\n- maximize the vertical space/decrease the line length\n- attributes should be sorted consistently\n- attribute sorting is first semantic and then alphabetic\n\nThis tool understands the [TAL\nlanguage](https://en.wikipedia.org/wiki/Template_Attribute_Language) and\nhas some features dedicated to it.\n\nThis tool is not a linter! If you are looking for linters safe bets are\n[Tidy](https://www.html-tidy.org/) and\n[xmllint](http://xmlsoft.org/xmllint.html).\n\nYou may have parsing problems! `zpretty` will close for you some known\nself closing tags, like `input` and `img`, that are allowed to be open\nin HTML.\n\n`zpretty` is not clever enough to understand correctly valueless\nattributes! Some work is ongoing, but it works best with \\\"normal\\\"\nattributes.\n\nLack of feature/slowness are a known issue. For the moment the\ndevelopment focused in having a working tool. So it works fast enough:\nless than a second to format a \\~100k file. New features are planned and\nalso huge perfomance boost can be easily obtained. Anyway `zpretty` is\nnot your option for formatting large files (\\\u003e 1 MB).\n\nSee [TODO section](#todo_section) to know what is forecast for the\nfuture.\n\nThe source code and the issue tracker are hosted on\n[GitHub](https://github.com/collective/zpretty).\n\n# INSTALL\n\nThe suggested installation method is using\n[pip](https://pypi.python.org/pypi/pip/):\n\n```bash\npython3 -m pip install --user zpretty\n```\n\nThe latest release of `zpretty` requires Python3. If you need to use\nPython2.7 use `zpretty` 0.9.x.\n\n# USAGE\n\nBasic usage:\n\n```console\n$ zpretty -h\nusage: zpretty [-h] [--encoding ENCODING] [-i] [-v] [-x] [-z] [--check]\n               [--include INCLUDE] [--exclude EXCLUDE]\n               [--extend-exclude EXTEND_EXCLUDE]\n               [paths ...]\n\npositional arguments:\n  paths                 The list of files or directory to prettify (defaults to\n                        stdin). If a directory is passed, all files and\n                        directories matching the regular expression passed to\n                        --include will be prettified.\n\noptions:\n  -h, --help            show this help message and exit\n  --encoding ENCODING   The file encoding (defaults to utf8)\n  -i, --inplace         Format files in place (overwrite existing file)\n  -v, --version         Show zpretty version number\n  -x, --xml             Treat the input file(s) as XML\n  -z, --zcml            Treat the input file(s) as XML. Follow the ZCML\n                        styleguide\n  --check               Return code 0 if nothing would be changed, 1 if some\n                        files would be reformatted\n  --include INCLUDE     A regular expression that matches files and directories\n                        that should be included on recursive searches. An empty\n                        value means all files are included regardless of the\n                        name. Use forward slashes for directories on all\n                        platforms (Windows, too). Exclusions are calculated\n                        first, inclusions later. [default:\n                        \\.(html|pt|xml|zcml)$]\n  --exclude EXCLUDE     A regular expression that matches files and directories\n                        that should be excluded on recursive searches. An empty\n                        value means no paths are excluded. Use forward slashes\n                        for directories on all platforms (Windows, too).\n                        Exclusions are calculated first, inclusions later.\n                        [default: /(\\.direnv|\\.eggs|\\.git|\\.hg|\\.mypy_cache|\\.no\n                        x|\\.tox|\\.venv|venv|\\.svn|\\.ipynb_checkpoints|_build|buc\n                        k-out|build|dist|__pypackages__)/]\n  --extend-exclude EXTEND_EXCLUDE\n                        Like --exclude, but adds additional files and\n                        directories on top of the excluded ones. (Useful if you\n                        simply want to add to the default)\n\nThe default exclude pattern is: `/(\\.direnv|\\.eggs|\\.git|\\.hg|\\.mypy_cache|\\.nox\n|\\.tox|\\.venv|venv|\\.svn|\\.ipynb_checkpoints|_build|buck-\nout|build|dist|__pypackages__)/`\n```\n\nWithout parameters constraining the file type (e.g. `-x`, `-z`, \\...)\n`zpretty` will try to guess the right options for you.\n\nExample:\n\n```console\nzpretty hello_world.html\n```\n\n# pre-commit support\n\n`zpretty` can be used as a [pre-commit](https://pre-commit.com/) hook.\nTo do so, add the following to your `.pre-commit-config.yaml`:\n\n```yaml\n- repo: https://github.com/collective/zpretty\n  rev: FIXME\n  hooks:\n    - id: zpretty\n```\n\n# VSCode extension\n\nThere is a VSCode extension that uses `zpretty`:\n\n- [https://marketplace.visualstudio.com/items?itemName=erral.erral-zcmlLanguageConfiguration](https://marketplace.visualstudio.com/items?itemName=erral.erral-zcmlLanguageConfiguration)\n\nThanks to [@erral](https://github.com/erral) for the work!\n\n# DEVELOP\n\n```bash\ngit clone ...\ncd zpretty\nmake\n```\n\n# RUNNING TESTS\n\n```bash\nmake test\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcollective%2Fzpretty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcollective%2Fzpretty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcollective%2Fzpretty/lists"}