{"id":41254,"library":"html-prettify","title":"html-prettify","description":"A simple, lightweight HTML prettifier with TypeScript definitions. Version 1.0.7 is the latest stable release. It takes HTML markup and indents it based on configurable character and count options. Differentiators: minimalistic, no dependencies, provides Vue-style template support (v-for, v-html). Alternative to more complex formatters like prettier.","status":"active","version":"1.0.7","language":"javascript","source_language":"en","source_url":"https://github.com/Dmc0125/html-prettify","tags":["javascript","html","formatter","prettify","typescript"],"install":[{"cmd":"npm install html-prettify","lang":"bash","label":"npm"},{"cmd":"yarn add html-prettify","lang":"bash","label":"yarn"},{"cmd":"pnpm add html-prettify","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is ESM-only; use default import. CommonJS require will fail.","wrong":"const prettify = require('html-prettify')","symbol":"default","correct":"import prettify from 'html-prettify'"},{"note":"Named export also available. CommonJS destructuring fails.","wrong":"const { prettify } = require('html-prettify')","symbol":"prettify","correct":"import { prettify } from 'html-prettify'"},{"note":"Options object with 'char' (space or tab) and 'count' (number) to control indentation.","wrong":"","symbol":"prettify function","correct":"import pt from 'html-prettify'; pt(html, { char: 'tab', count: 4 })"}],"quickstart":{"code":"import prettify from 'html-prettify';\n\nconst html = '<div><p>Hello</p></div>';\nconst result = prettify(html, { char: 'space', count: 2 });\nconsole.log(result);\n// '<div>\\n  <p>Hello</p>\\n</div>'","lang":"typescript","description":"Demonstrates importing the default function and formatting a simple HTML string with space indentation."},"warnings":[{"fix":"Use import instead of require(). If you must use CommonJS, consider dynamic import() or use an older version (<=0.0.x).","message":"Version 1.0.0 dropped CommonJS support; package is ESM-only.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Always use exactly 'space' or 'tab' for the char option.","message":"The 'char' option expects 'space' or 'tab' literally; other values may cause unexpected behavior or fallback to default.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Check output if you rely on specific attribute spacing; consider using a Vue-specific formatter if needed.","message":"Vue directives like v-for with spaces may not be preserved exactly; some formatting removes extra whitespace inside attributes.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.7':13 'altern':49 'base':26 'charact':29 'complex':52 'configur':28 'count':31 'definit':11 'depend':36 'differenti':33 'formatt':53,58 'html':2,7,21,48,57 'html-prettifi':1 'indent':24 'javascript':56 'latest':16 'lightweight':6 'like':54 'markup':22 'minimalist':34 'option':32 'prettier':55 'prettifi':3,8,59 'provid':37 'releas':18 'simpl':5 'stabl':17 'style':40 'support':42 'take':20 'templat':41 'typescript':10,60 'v':44,47 'v-for':43 'v-html':46 'version':12 'vue':39 'vue-styl':38","created_at":"2026-06-04T18:51:31.138281+00:00","updated_at":"2026-06-04T18:51:31.138281+00:00","problems":[{"fix":"Use import or set type: 'module' in package.json if using Node.js, or use dynamic import().","cause":"Using CommonJS require() with an ESM-only package.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module"},{"fix":"Use default import: import prettify from 'html-prettify'.","cause":"Importing named export as default incorrectly, or using wrong import syntax.","error":"TypeError: prettify 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/Dmc0125/html-prettify#readme","github":"https://github.com/Dmc0125/html-prettify","docs":null,"changelog":null,"pypi":null,"npm":"html-prettify","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}}