{"id":41230,"library":"hihtml","title":"hihtml - HTML Processing Supertool","description":"hihtml (v1.3.2) bundles HTML validation, deprecated markup detection, link checking, and minification into a single CLI and programmatic API. It wraps HTML-validate, ObsoHTML, Node's built-in http/https, and HTML Minifier Next with strong defaults and a conformance gate (--all) that prevents minification if validation fails. Updated regularly on npm, primarily maintained by j9t. Differentiators: all-in-one tool, programmatic plus CLI, built-in conformance gate, highly configurable via JSON settings file.","status":"active","version":"1.3.2","language":"javascript","source_language":"en","source_url":"https://github.com/j9t/hihtml","tags":["javascript","conformance","html","html-minifier","html-minifier-next","html-validate","link-check","links","minification","typescript"],"install":[{"cmd":"npm install hihtml","lang":"bash","label":"npm"},{"cmd":"yarn add hihtml","lang":"bash","label":"yarn"},{"cmd":"pnpm add hihtml","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"HTML validation engine","package":"html-validate","optional":false},{"reason":"Deprecated markup detection","package":"obsohtml","optional":false},{"reason":"HTML minification","package":"html-minifier-next","optional":false}],"imports":[{"note":"hihtml exports named functions, not a default export. Available in ESM only (no CommonJS).","wrong":"import hihtml from 'hihtml'","symbol":"checkCode","correct":"import { checkCode } from 'hihtml'"},{"note":"Package is ESM-only. Requires Node >= 16 and \"type\":\"module\" in package.json or .mjs extension.","wrong":"const { checkLinks } = require('hihtml')","symbol":"checkLinks","correct":"import { checkLinks } from 'hihtml'"},{"note":"Function name is `minify`, not `minimize` or `minifier`.","wrong":"import { minify as minimize } from 'hihtml'","symbol":"minify","correct":"import { minify } from 'hihtml'"},{"note":"collect() returns an array of file paths. Required as input for other functions.","symbol":"collect","correct":"import { collect } from 'hihtml'"},{"note":"String variant that accepts HTML as a string (no file I/O).","symbol":"minifyString","correct":"import { minifyString } from 'hihtml'"}],"quickstart":{"code":"import { collect, checkCode, checkLinks, minify, minifyString } from 'hihtml';\n\n// Validate and check for deprecated markup\nconst files = await collect('./src');\nconst validationResult = await checkCode(files);\nconsole.log('Errors:', validationResult.validation.countErrors);\nconsole.log('Deprecated:', validationResult.deprecation.countIssues);\n\n// Check links\nconst linkResult = await checkLinks(files);\nconsole.log('Broken links:', linkResult.countBroken);\n\n// Minify in-place\nconst minifyResult = await minify(files, files);\nconsole.log('Saved bytes:', minifyResult.saved);\n\n// Minify a string directly\nconst minified = await minifyString('<p>Hello  world</p>');\nconsole.log('Minified:', minified);\n\n// Use with --all equivalent logic\nconst { validation } = await checkCode(files);\nif (validation.countErrors === 0) {\n  await minify(files, files);\n}","lang":"typescript","description":"Programmatic usage: validate HTML, check links, minify, and enforce conformance gate with string variants."},"warnings":[{"fix":"Use import syntax and ensure Node.js version >= 16 with \"type\":\"module\" in package.json or .mjs file extension.","message":"Package is ESM-only. CommonJS require() will throw an error.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Always await hihtml functions: const result = await checkCode(files);","message":"All functions are async. Forgetting await returns a Promise, not the result.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Verify files exist: collect returns array; check length before processing.","message":"collect() defaults to current directory with optional path argument, but returns empty array if no HTML files found.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"For independent tasks, use individual flags: hihtml -c -l -m","message":"The -a flag (--all) behavior changed: it now acts as a conformance gate, running check-code then minify only if no errors. Previously it ran all three tasks independently.","severity":"deprecated","affected_versions":">=1.2.0"}],"env_vars":null,"search_vec":"'all-in-on':63 'api':23 'built':33,72 'built-in':32,71 'bundl':7 'check':14,97 'cli':20,70 'configur':77 'conform':45,74,83 'default':42 'deprec':10 'detect':12 'differenti':62 'fail':53 'file':81 'gate':46,75 'high':76 'hihtml':1,5 'html':2,8,27,37,84,86,89,93 'html-minifi':85 'html-minifier-next':88 'html-valid':26,92 'http/https':35 'j9t':61 'javascript':82 'json':79 'link':13,96,98 'link-check':95 'maintain':59 'markup':11 'minif':16,50,99 'minifi':38,87,90 'next':39,91 'node':30 'npm':57 'obsohtml':29 'one':66 'plus':69 'prevent':49 'primarili':58 'process':3 'programmat':22,68 'regular':55 'set':80 'singl':19 'strong':41 'supertool':4 'tool':67 'typescript':100 'updat':54 'v1.3.2':6 'valid':9,28,52,94 'via':78 'wrap':25","created_at":"2026-06-04T18:51:24.299915+00:00","updated_at":"2026-06-04T18:51:24.299915+00:00","problems":[{"fix":"Use named imports: import { checkCode } from 'hihtml';","cause":"Trying to import default export but package only provides named exports.","error":"SyntaxError: The requested module 'hihtml' does not provide an export named 'default'"},{"fix":"Switch to import syntax or use dynamic import(): const hihtml = await import('hihtml');","cause":"Using require() on an ESM-only package.","error":"ERR_REQUIRE_ESM: require() of ES Module /node_modules/hihtml/index.js not supported."},{"fix":"Ensure you await the result: const result = await checkCode(files);","cause":"Forgetting to await the asynchronous function or destructuring incorrectly.","error":"TypeError: checkCode 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/j9t/hihtml","github":"https://github.com/j9t/hihtml","docs":null,"changelog":null,"pypi":null,"npm":"hihtml","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}}