{"type":"module","name":"dom-serializer","version":"3.1.1","description":"render domhandler DOM nodes to a string","author":{"name":"Felix Boehm","email":"me@feedic.com"},"sideEffects":false,"keywords":["html","xml","render"],"repository":{"type":"git","url":"git://github.com/cheeriojs/dom-serializer.git"},"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"dependencies":{"domelementtype":"^3.0.0","domhandler":"^6.0.0","entities":"^8.0.0"},"devDependencies":{"@biomejs/biome":"^2.4.14","@eslint/compat":"^2.0.5","@feedic/eslint-config":"^0.4.1","@types/node":"^25.6.0","cheerio":"^1.2.0","eslint":"^10.3.0","eslint-config-biome":"^2.1.3","typescript":"^6.0.2","typescript-eslint":"^8.59.1","vitest":"^4.1.5"},"engines":{"node":">=20.19.0"},"scripts":{"build":"tsc","format":"npm run format:es && npm run format:biome","format:biome":"biome check --write .","format:es":"npm run lint:es -- --fix","lint":"npm run lint:es && npm run lint:ts && npm run lint:biome","lint:biome":"biome check .","lint:es":"eslint .","lint:ts":"tsc --noEmit -p tsconfig.eslint.json","prepare":"npm run build","test":"npm run test:vi && npm run lint","test:vi":"vitest run"},"funding":{"type":"github","url":"https://github.com/cheeriojs/dom-serializer?sponsor=1"},"license":"MIT","gitHead":"571d6c4bad6cf551bf3cbc5068593ab3b146d973","_id":"dom-serializer@3.1.1","bugs":{"url":"https://github.com/cheeriojs/dom-serializer/issues"},"homepage":"https://github.com/cheeriojs/dom-serializer#readme","_nodeVersion":"24.14.1","_npmVersion":"11.11.0","dist":{"integrity":"sha512-4MEa38/QexBob6gFNwu+EGdWvhJ1OKuNwdYY3Y3NyeWDQfnGeDYQUDfIRzWu5B5gsv03so2Uxd28YC6zrsx3Lw==","shasum":"54be70ee4fcc2da010f488165e62294798dc57d3","tarball":"http://registry-npm.ywwl.com/dom-serializer/download/dom-serializer-3.1.1.tgz","fileCount":13,"unpackedSize":38248,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/dom-serializer@3.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIEB14lshqAy14qmHrOTbqT465MM/2VDHc7hCFm5g4xWAAiA5lEMd0GGeQGhhA0ZY1l/KgMmzd7+scCNL0H9TgMwF8Q=="}],"size":10730,"noattachment":false,"key":"/dom-serializer/-/dom-serializer-3.1.1.tgz"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:fc60f0e3-5ad6-401b-8d88-2eb66674df3a"}},"directories":{},"maintainers":[{"name":"fb55","email":"me@feedic.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/dom-serializer_3.1.1_1777721206316_0.19594817693140532"},"_hasShrinkwrap":false,"readme":"# dom-serializer [![Node.js CI](https://github.com/cheeriojs/dom-serializer/actions/workflows/nodejs-test.yml/badge.svg)](https://github.com/cheeriojs/dom-serializer/actions/workflows/nodejs-test.yml)\n\nRenders a [domhandler](https://github.com/fb55/domhandler) DOM node or an array of domhandler DOM nodes to a string.\n\n```js\nimport render from \"dom-serializer\";\n\n// OR\n\nconst render = require(\"dom-serializer\").default;\n```\n\n# API\n\n## `render`\n\n▸ **render**(`node`: Node \\| Node[], `options?`: [_Options_](#Options)): _string_\n\nRenders a DOM node or an array of DOM nodes to a string.\n\nCan be thought of as the equivalent of the `outerHTML` of the passed node(s).\n\n#### Parameters:\n\n| Name      | Type                               | Default value | Description                    |\n| :-------- | :--------------------------------- | :------------ | :----------------------------- |\n| `node`    | Node \\| Node[]                     | -             | Node to be rendered.           |\n| `options` | [_DomSerializerOptions_](#Options) | {}            | Changes serialization behavior |\n\n**Returns:** _string_\n\n## Options\n\n### `encodeEntities`\n\n• `Optional` **encodeEntities**: _boolean | \"utf8\"_\n\nEncode characters reserved in HTML or XML in text and attribute values.\n\nIf `xmlMode` is `true` or the value is not `'utf8'`, characters outside of the ASCII range will be encoded as well.\n\n> **Security:** Setting this to `false` disables encoding of `<`, `>`, and `&` in text and attribute values. This is intended for the round-trip case where the DOM was parsed with `decodeEntities: false`, so markup characters only exist as entity references. If the DOM contains raw markup characters (e.g., from a default-decoded parse, or from programmatic manipulation), they will be emitted literally — do not use this option with untrusted input unless you have validated the DOM yourself.\n\n**`default`** `decodeEntities`\n\n---\n\n### `decodeEntities`\n\n• `Optional` **decodeEntities**: _boolean_\n\nDefault for `encodeEntities`. Named to match the parser option of the same name so a single options object can be threaded through parse and serialize. Despite the name, on the serializer this option controls *encoding* — setting it to `false` carries the same security caveat as `encodeEntities: false`.\n\n**`default`** true\n\n---\n\n### `emptyAttrs`\n\n• `Optional` **emptyAttrs**: _boolean_\n\nPrint an empty attribute's value.\n\n**`default`** xmlMode\n\n**`example`** With <code>emptyAttrs: false</code>: <code>&lt;input checked&gt;</code>\n\n**`example`** With <code>emptyAttrs: true</code>: <code>&lt;input checked=\"\"&gt;</code>\n\n---\n\n### `selfClosingTags`\n\n• `Optional` **selfClosingTags**: _boolean_\n\nPrint self-closing tags for tags without contents. If `xmlMode` is set, this\nwill apply to all tags. Otherwise, only tags that are defined as self-closing\nin the HTML specification will be printed as such.\n\n**`default`** xmlMode\n\n**`example`** With <code>selfClosingTags: false</code>: <code>&lt;foo&gt;&lt;/foo&gt;&lt;br&gt;&lt;/br&gt;</code>\n\n**`example`** With <code>xmlMode: true</code> and <code>selfClosingTags: true</code>: <code>&lt;foo/&gt;&lt;br/&gt;</code>\n\n**`example`** With <code>xmlMode: false</code> and <code>selfClosingTags: true</code>: <code>&lt;foo&gt;&lt;/foo&gt;&lt;br /&gt;</code>\n\n---\n\n### `xmlMode`\n\n• `Optional` **xmlMode**: _boolean_ \\| _\"foreign\"_\n\nTreat the input as an XML document; enables the `emptyAttrs` and `selfClosingTags` options.\n\nIf the value is `\"foreign\"`, it will try to correct mixed-case attribute names.\n\n**`default`** false\n\n---\n\n## Ecosystem\n\n| Name                                                          | Description                                             |\n| ------------------------------------------------------------- | ------------------------------------------------------- |\n| [htmlparser2](https://github.com/fb55/htmlparser2)            | Fast & forgiving HTML/XML parser                        |\n| [domhandler](https://github.com/fb55/domhandler)              | Handler for htmlparser2 that turns documents into a DOM |\n| [domutils](https://github.com/fb55/domutils)                  | Utilities for working with domhandler's DOM             |\n| [css-select](https://github.com/fb55/css-select)              | CSS selector engine, compatible with domhandler's DOM   |\n| [cheerio](https://github.com/cheeriojs/cheerio)               | The jQuery API for domhandler's DOM                     |\n| [dom-serializer](https://github.com/cheeriojs/dom-serializer) | Serializer for domhandler's DOM                         |\n\n---\n\nLICENSE: MIT\n","publish_time":1777721206442,"_cnpm_publish_time":1777721206442,"dist-tags":{"latest":"3.1.1"}}