{"id":4693,"library":"prettierfier","title":"Prettierfier","description":"Prettierfier is a Python library designed to intelligently pretty-print HTML/XML strings, specifically addressing the issue of unwanted line breaks that often occur with other tools like BeautifulSoup's `prettify()` method. It focuses on preserving inline tags without introducing extraneous whitespace. The current version is 1.0.3, and its release cadence appears to be inactive, with the last update in 2019, suggesting a stable but unmaintained project.","status":"maintenance","version":"1.0.3","language":"en","source_language":"en","source_url":"https://github.com/annedo/prettierfier","tags":["html","xml","formatter","pretty-print","whitespace"],"install":[{"cmd":"pip install prettierfier","lang":"bash","label":"Install with pip"}],"dependencies":[],"imports":[{"note":"The library exposes functions directly under the main module, so importing the module itself is the standard approach before calling its methods.","wrong":"from prettierfier import prettify_html # or prettify_xml","symbol":"prettierfier","correct":"import prettierfier"}],"quickstart":{"code":"import prettierfier\n\nugly_html = \"\"\"<p> Introducing GitHub <sup> &reg; </sup> </p>\"\"\"\npretty_html = prettierfier.prettify_html(ugly_html)\nprint(pretty_html)\n\nugly_xml = \"\"\"<root><tag1>Text</tag1><tag2 attr='value'></tag2></root>\"\"\"\npretty_xml = prettierfier.prettify_xml(ugly_xml, indent=4)\nprint(pretty_xml)","lang":"python","description":"This example demonstrates how to use `prettierfier.prettify_html()` and `prettierfier.prettify_xml()` to reformat HTML and XML strings, respectively, addressing undesirable whitespace around inline tags or applying indentation."},"warnings":[{"fix":"Ensure you are installing `prettierfier` (for HTML/XML) and not attempting to use it for general Python code formatting, for which alternatives like Black or Ruff are recommended.","message":"This library (prettierfier) is distinct from the popular JavaScript code formatter 'Prettier'. Do not confuse the two; `prettierfier` is for HTML/XML string formatting in Python, while the main Prettier formatter is a multi-language (primarily JS) code formatter with a separate, deprecated Python plugin.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For heavily unformatted HTML without existing newlines, `prettierfier` might not introduce all the line breaks you expect for full readability. It works best on HTML that already has some structure or has been partially formatted (e.g., by BeautifulSoup.prettify()) and needs fine-tuning for inline elements.","message":"The `prettierfier` library's `prettify_html()` function is 'originally created to process BeautifulSoup.prettify() output' and 'does not add or remove regular line breaks' in general HTML if they are not already present. It primarily cleans up whitespace around inline tags, rather than imposing a complete formatting style from scratch.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Evaluate if the specific HTML/XML formatting needs are met by this library. For active development, consider alternative, more actively maintained tools if broader or more robust formatting features are required. Given its simple scope and reliance on standard libraries, it might continue to function well for its intended purpose.","message":"The library has not received updates since version 1.0.3 in July 2019. While it uses only the Python Standard Library, long-term maintenance, compatibility with future Python versions, and community support might be limited.","severity":"deprecated","affected_versions":"1.0.3 and older"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}