{"id":41261,"library":"htmlfy","title":"htmlfy","description":"An HTML formatter and minifier with a focus on simplicity and zero dependencies. Version 1.0.1 is the current stable release with no fixed release cadence. It provides both pretty-printing and minification for HTML strings, differentiating itself by its minimal footprint (no dependencies) and TypeScript support. Ideal for formatting or compressing HTML in Node.js or browser environments.","status":"active","version":"1.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/j4w8n/htmlfy","tags":["javascript","format","html","pretty","prettier","minifier","prettify","minify","typescript"],"install":[{"cmd":"npm install htmlfy","lang":"bash","label":"npm"},{"cmd":"yarn add htmlfy","lang":"bash","label":"yarn"},{"cmd":"pnpm add htmlfy","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"htmlfy is a named export, not default.","wrong":"import htmlfy from 'htmlfy'","symbol":"htmlfy","correct":"import { htmlfy } from 'htmlfy'"},{"note":"Correct for ESM; for CJS use require('htmlfy').pretty.","wrong":"const pretty = require('htmlfy').pretty","symbol":"pretty","correct":"import { pretty } from 'htmlfy'"},{"note":"minify is a named export; destructure in CJS.","wrong":"const minify = require('htmlfy')","symbol":"minify","correct":"const { minify } = require('htmlfy')"}],"quickstart":{"code":"import { pretty, minify } from 'htmlfy';\n\nconst ugly = '<div > < p >Hello</p></div>';\nconst beautified = pretty(ugly, { indent_size: 2 });\nconsole.log(beautified);\n// Output:\n// <div>\n//   <p>Hello</p>\n// </div>\n\nconst minified = minify(beautified);\nconsole.log(minified);\n// Output:\n// <div><p>Hello</p></div>","lang":"typescript","description":"Demonstrates pretty-printing and minifying HTML with htmlfy."},"warnings":[{"fix":"Use minify for consistent output or manually add newlines if needed.","message":"The pretty function does not add newlines after void elements like <br> or <hr>.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure script and style content is properly handled or avoid minifying such sections.","message":"minify removes whitespace aggressively; it may break inline JavaScript or CSS if not careful.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Consider alternatives like prettier for advanced formatting.","message":"The current version does not support formatting HTML with mixed content (e.g., text nodes with inline elements) beautifully.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.1':16 'browser':58 'cadenc':26 'compress':53 'current':19 'depend':14,45 'differenti':38 'environ':59 'fix':24 'focus':9 'footprint':43 'format':51,61 'formatt':4 'html':3,36,54,62 'htmlfi':1 'ideal':49 'javascript':60 'minif':34 'minifi':6,65,67 'minim':42 'node.js':56 'pretti':31,63 'prettier':64 'prettifi':66 'pretty-print':30 'print':32 'provid':28 'releas':21,25 'simplic':11 'stabl':20 'string':37 'support':48 'typescript':47,68 'version':15 'zero':13","created_at":"2026-06-04T18:51:33.325468+00:00","updated_at":"2026-06-04T18:51:33.325468+00:00","problems":[{"fix":"Use import { htmlfy } from 'htmlfy'","cause":"Using default import instead of named import.","error":"TypeError: htmlfy is not a function"},{"fix":"Run npm install htmlfy and ensure the import path is correct.","cause":"Package not installed or import path incorrect.","error":"Cannot find module 'htmlfy'"},{"fix":"Ensure the input to pretty() is a string.","cause":"Calling pretty on something that is not a string.","error":"TypeError: pretty(...).replace is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/j4w8n/htmlfy#readme","github":"https://github.com/j4w8n/htmlfy","docs":null,"changelog":null,"pypi":null,"npm":"htmlfy","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}