{"id":11050,"library":"html","title":"HTML Pretty Printer CLI","description":"The `html` package, currently at version 1.0.0, functions as a command-line utility for pretty-printing HTML code. It is a direct Node.js port of `beautify-html.js`, which itself is based on `jsbeautifier`. The tool is designed primarily for CLI usage, accepting HTML input via `stdin`, file arguments, or interacting with the system clipboard through utilities like `pbpaste` and `pbcopy` on macOS. Its core purpose is to take minified or unformatted HTML and output a human-readable, indented version. Given its last update in 2012, the project is abandoned. Its release cadence is non-existent, and users are instructed to manually update its underlying `jsbeautifier` dependency, indicating a lack of active maintenance and potential compatibility issues with modern JavaScript environments or Node.js versions. There are no notable differentiators over modern HTML formatters beyond its extremely simple, direct CLI piping approach, which is now largely obsolete.","status":"abandoned","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/maxogden/commonjs-html-prettyprinter","tags":["javascript","html","tabifier","beautifier","prettyprinter","prettifier","pretty","command","shell"],"install":[{"cmd":"npm install html","lang":"bash","label":"npm"},{"cmd":"yarn add html","lang":"bash","label":"yarn"},{"cmd":"pnpm add html","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The primary use case is as a CLI tool; programmatic import is for CommonJS only.","wrong":"import html from 'html'","symbol":"html CLI","correct":"npx html"},{"note":"This package is an old CommonJS module and does not support ES modules natively. It also does not ship with TypeScript types.","wrong":"import { prettyPrint } from 'html';","symbol":"prettyPrint (CommonJS)","correct":"const { prettyPrint } = require('html');"}],"quickstart":{"code":"import { exec } from 'node:child_process';\n\nconst uglyHtml = '<h2><strong><a href=\"http://awesome.com\">AwesomeCom</a></strong><span>is awesome</span></h2>';\n\nexec(`echo \"${uglyHtml}\" | npx html`, (error, stdout, stderr) => {\n  if (error) {\n    console.error(`exec error: ${error}`);\n    return;\n  }\n  if (stderr) {\n    console.error(`stderr: ${stderr}`);\n  }\n  console.log('Pretty Printed HTML:\\n', stdout);\n  // Expected output will be formatted HTML like:\n  // <h2>\n  //     <strong>\n  //         <a href=http://awesome.com>AwesomeCom</a>\n  //     </strong>\n  //     <span>\n  //         is awesome\n  //     </span>\n  // </h2>\n});","lang":"javascript","description":"Demonstrates how to use the `html` CLI tool to pretty-print a string of ugly HTML passed via stdin."},"warnings":[{"fix":"For new projects, use a modern HTML beautifier like Prettier or `js-beautify` directly. If absolutely necessary, configure Node.js to load CJS modules in an ESM context, or use `require()` if in a CJS file.","message":"This package is an abandoned CommonJS module from 2012 and is not compatible with modern ES module environments without specific loader configurations or transpilation. Attempting to `import` it will likely result in errors.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Avoid using this package. Migrate to actively maintained alternatives such as `prettier` for comprehensive code formatting, or a modern `js-beautify` version if a direct replacement is needed.","message":"The project is explicitly abandoned. The README instructs users to manually update its core `beautify-html.js` dependency by dropping new files into the `lib/` directory, rather than receiving updates via npm. This means the version of the underlying beautifier logic is extremely outdated and will not receive security patches or improvements.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"If programmatic use is unavoidable in TypeScript, create a declaration file (`html.d.ts`) with `declare module 'html' { export function prettyPrint(html: string, options?: any): string; }` or use `@ts-ignore`.","message":"The package does not ship with TypeScript type definitions. Using it in a TypeScript project would require manually declaring types or ignoring type errors.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Install the package globally: `npm install -g html` or run it via `npx html` to execute without global installation.","cause":"The `html` CLI tool was not installed globally or is not in the system's PATH, or `npx` was not used.","error":"html: command not found"},{"fix":"If programmatic use is desired, use a modern HTML formatter that supports ESM. If forced to use this package, you must use it in a CommonJS file or configure an ES module loader to interoperate with CJS modules.","cause":"Attempting to use `require('html')` in an ES module context (`type: \"module\"` in `package.json` or `.mjs` file).","error":"TypeError: require is not a function"},{"fix":"Run `npm install html` in your project directory.","cause":"The package was not installed in the current project or is not correctly resolved by Node.js.","error":"Error: Cannot find module 'html'"}],"ecosystem":"npm"}