skillfed

prettierfier

Intelligently pretty-print HTML/XML with inline tags.

prettierfier v1.0.3 615.0K downloads/30d#5,744 on PyPI5
Permissive license MIT Abandoned released

What it is and what it does

Prettierfier is a lightweight HTML and XML formatter that solves a specific problem: BeautifulSoup's prettify() method adds line breaks between every tag, which breaks inline elements like `<span>`, `<sup>`, and `<em>`. This package uses regex-based parsing to reformat markup more intelligently, preserving inline tags on the same line while still indenting block-level structure.

The package contains no external dependencies—it uses only the Python Standard Library—and offers two main functions: prettify_xml() for raw XML with configurable indentation, and prettify_html() designed to post-process BeautifulSoup output. It's a single-purpose tool for developers who need cleaner, more readable HTML/XML output without the whitespace bloat.

Use it for:

  • Post-process BeautifulSoup.prettify() output to remove unwanted line breaks between inline HTML tags.
  • Format raw XML strings with intelligent indentation before writing to files or logs.
  • Clean up HTML templates or scraped markup for human readability without breaking inline element layout.
  • Debug HTML/XML structure by viewing it in a more compact, readable form than standard prettifiers produce.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Reformats HTML and XML strings with intelligent inline-tag handling, avoiding the excessive line breaks that tools like BeautifulSoup.prettify() introduce between tags that should stay on the same line.

No. The project is abandoned with its last release on 2019-07-22 and no maintenance since. While the code is simple and dependency-free, there is no path to bug fixes or compatibility updates. For active alternatives, consider using BeautifulSoup with a custom formatter or modern HTML/XML libraries with maintained prettification support.

Install

prettierfier on PyPI

pip

pip install prettierfier

uv

uv add prettierfier

poetry

poetry add prettierfier

Installing prettierfier

Before you install

Installation is frictionless—the package has no external dependencies and installs as a pure Python wheel. However, the project has been abandoned since its last release on 2019-07-22 with no updates since, so expect no maintenance or bug fixes going forward.

License in practice

Licensed under MIT (permissive), so you can use, modify, and distribute this package freely in both open-source and commercial projects with minimal restrictions.

Quickstart

pip install prettierfier

import prettierfier

ugly_html = """<span>Introducing GitHub</span><sup>&reg;</sup>"""
pretty = prettierfier.prettify_html(ugly_html)
print(pretty)

Verify before relying

  • Whether the regex-based parsing handles all HTML5/XML edge cases or only a subset of real-world markup.
  • Performance characteristics on large documents or whether there are known scalability limits.
  • Compatibility with Python versions beyond 3.7 (the latest classifier listed), given the maintenance gap.

Package facts

License MIT (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance abandoned — 2,580 days since the last release
Last repo commit
First released
Downloads 614,995/month — #5,744 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: prettierfier-1.0.3-py3-none-any.whl

Keywords: html, xml, formatting, prettify

Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: Microsoft :: WindowsProgramming Language :: Python :: 3Programming Language :: Python :: 3.7Topic :: Text Processing :: Markup :: HTMLTopic :: Text Processing :: Markup :: XML

Tags

html xml formattingprettify html without extra whitespaceintelligent html indentationremove unwanted linebreaks htmlformat html inline tagsxml pretty printbeautifulsoup prettify alternative
html-formattingxml-prettifyabandoned

More HTML packages