{"id":41238,"library":"html-generators","title":"html-generators","description":"A library for generating random HTML strings for property-based testing. Version 1.1.0 is stable with no recent releases (last updated 2017). It builds on chance-generators and integrates with unexpected-check and unchecked. Unlike other HTML generators, it produces structurally valid but semantically random HTML documents, including elements, attributes, and content. Supports custom seeds and limits. Suitable for testing HTML parsers, minifiers, sanitizers, and other tools where diverse HTML input is needed.","status":"maintenance","version":"1.1.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","testing","generators","chance-generators"],"install":[{"cmd":"npm install html-generators","lang":"bash","label":"npm"},{"cmd":"yarn add html-generators","lang":"bash","label":"yarn"},{"cmd":"pnpm add html-generators","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core dependency providing random value generation (strings, numbers, booleans, etc.)","package":"chance-generators","optional":false}],"imports":[{"note":"htmlString is a named export, not a default export","wrong":"const htmlString = require('html-generators')","symbol":"htmlString","correct":"const { htmlString } = require('html-generators')"},{"note":"Package uses CommonJS, not ESM. ESM import will fail without bundler","wrong":"import { htmlFragment } from 'html-generators'","symbol":"htmlFragment","correct":"const { htmlFragment } = require('html-generators')"},{"note":"Destructuring is preferred but property access also works","wrong":"const htmlDocument = require('html-generators').htmlDocument","symbol":"htmlDocument","correct":"const { htmlDocument } = require('html-generators')"}],"quickstart":{"code":"const { htmlString, htmlFragment, htmlDocument } = require('html-generators');\nconst seed = Date.now();\nconst generator = htmlString({ seed });\nconsole.log(generator.first());\n// Output: random HTML string\n\nconst fragGenerator = htmlFragment({ seed: seed + 1 });\nconsole.log(fragGenerator.first());\n\nconst docGenerator = htmlDocument({ seed: seed + 2 });\nconsole.log(docGenerator.first());","lang":"javascript","description":"Demonstrates generating random HTML strings, fragments, and documents using the three main generators."},"warnings":[{"fix":"Consider migrating to a more modern alternative like faker or quick-check.","message":"The library is in maintenance mode with no updates since 2017.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Do not use for production HTML generation; intended for testing with property-based testing frameworks.","message":"Generated HTML may contain invalid attribute values or malformed content.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use require() instead of import, or use a bundler.","message":"CommonJS only – ESM imports will throw 'ERR_REQUIRE_ESM'.","severity":"breaking","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.1.0':17 '2017':26 'attribut':56 'base':14 'build':28 'chanc':31,84 'chance-gener':30,83 'check':38 'content':58 'custom':60 'divers':75 'document':53 'element':55 'generat':3,7,32,44,82,85 'html':2,9,43,52,67,76 'html-gener':1 'includ':54 'input':77 'integr':34 'javascript':80 'last':24 'librari':5 'limit':63 'minifi':69 'need':79 'parser':68 'produc':46 'properti':13 'property-bas':12 'random':8,51 'recent':22 'releas':23 'sanit':70 'seed':61 'semant':50 'stabl':19 'string':10 'structur':47 'suitabl':64 'support':59 'test':15,66,81 'tool':73 'uncheck':40 'unexpect':37 'unexpected-check':36 'unlik':41 'updat':25 'valid':48 'version':16","created_at":"2026-06-04T18:51:26.590351+00:00","updated_at":"2026-06-04T18:51:26.590351+00:00","problems":[{"fix":"Run 'npm install html-generators' and ensure it is in package.json dependencies.","cause":"npm package not installed or misspelled","error":"Cannot find module 'html-generators'"},{"fix":"Use 'const { htmlString } = require('html-generators')'","cause":"Used wrong import style – destructing missing or used default import","error":"htmlString is not a function"},{"fix":"Assign result: 'const gen = htmlString(); const result = gen.first();'","cause":"htmlString is a factory, not a direct iterator. Must call .first() on the generator instance","error":"TypeError: htmlString.first 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":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"html-generators","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"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}}