prettierfier
Intelligently pretty-print HTML/XML with inline tags.
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 prettierfieruv
uv add prettierfierpoetry
poetry add prettierfierInstalling 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>®</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
Tags
More HTML packages
MarkupSafe provides a text object that escapes…
permissive · top 100 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI
beautifulsoup4Beautiful Soup parses HTML and XML documents…
permissive · top 100 on PyPI
lxmllxml provides Python bindings to libxml2 and…
permissive · top 1,000 on PyPI
docutilsDocutils converts plaintext documentation in…
unclear · top 1,000 on PyPI
MarkdownConverts Markdown text to HTML using a Python…
permissive · top 1,000 on PyPI
BeautifulSoupBeautiful Soup parses HTML and XML documents…
permissive · top 15,000 on PyPI
xmlformatterFormats and compresses XML documents by…
permissive · top 15,000 on PyPI
MarkupPyMarkupPy generates HTML and XML markup from…
permissive · top 5,000 on PyPI
pynlinerConverts CSS stylesheets to inline styles in…
permissive · top 15,000 on PyPI
markdownifyConverts HTML to Markdown, with fine-grained…
permissive · top 1,000 on PyPI
premailerConverts CSS style blocks into inline style…
permissive · top 5,000 on PyPI
html-to-jsonConverts HTML documents and HTML tables into…
permissive · top 15,000 on PyPI
html-sanitizerSanitizes HTML fragments by enforcing an…
permissive · top 5,000 on PyPI
dmiparserParses dmidecode output into structured Python…
permissive · top 15,000 on PyPI