{"id":19536635,"url":"https://github.com/cheeriojs/dom-serializer","last_synced_at":"2025-05-14T09:06:23.320Z","repository":{"id":16244126,"uuid":"18991884","full_name":"cheeriojs/dom-serializer","owner":"cheeriojs","description":"render dom nodes","archived":false,"fork":false,"pushed_at":"2025-05-09T01:06:06.000Z","size":3261,"stargazers_count":133,"open_issues_count":4,"forks_count":69,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-11T18:35:19.920Z","etag":null,"topics":["cheeriojs","htmlparser2"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cheeriojs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["cheeriojs","fb55"],"open_collective":"cheerio","tidelift":"npm/dom-serializer"}},"created_at":"2014-04-21T12:32:23.000Z","updated_at":"2025-05-09T01:04:59.000Z","dependencies_parsed_at":"2024-01-14T10:05:09.440Z","dependency_job_id":"de8e0fbf-e7dd-4fbc-acd8-c520f8c8eaf9","html_url":"https://github.com/cheeriojs/dom-serializer","commit_stats":{"total_commits":1155,"total_committers":21,"mean_commits":55.0,"dds":"0.32900432900432897","last_synced_commit":"c205163bd181b4bc2b93daecb9046143e22c34c5"},"previous_names":["cheeriojs/dom-renderer"],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheeriojs%2Fdom-serializer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheeriojs%2Fdom-serializer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheeriojs%2Fdom-serializer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheeriojs%2Fdom-serializer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cheeriojs","download_url":"https://codeload.github.com/cheeriojs/dom-serializer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253864910,"owners_count":21975816,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cheeriojs","htmlparser2"],"created_at":"2024-11-11T02:23:36.366Z","updated_at":"2025-05-14T09:06:23.295Z","avatar_url":"https://github.com/cheeriojs.png","language":"TypeScript","funding_links":["https://github.com/sponsors/cheeriojs","https://github.com/sponsors/fb55","https://opencollective.com/cheerio","https://tidelift.com/funding/github/npm/dom-serializer"],"categories":[],"sub_categories":[],"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` **decodeEntities**: _boolean | \"utf8\"_\n\nEncode characters that are either reserved in HTML or XML.\n\nIf `xmlMode` is `true` or the value not `'utf8'`, characters outside of the utf8 range will be encoded as well.\n\n**`default`** `decodeEntities`\n\n---\n\n### `decodeEntities`\n\n• `Optional` **decodeEntities**: _boolean_\n\nOption inherited from parsing; will be used as the default value for `encodeEntities`.\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 \u003ccode\u003eemptyAttrs: false\u003c/code\u003e: \u003ccode\u003e\u0026lt;input checked\u0026gt;\u003c/code\u003e\n\n**`example`** With \u003ccode\u003eemptyAttrs: true\u003c/code\u003e: \u003ccode\u003e\u0026lt;input checked=\"\"\u0026gt;\u003c/code\u003e\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 \u003ccode\u003eselfClosingTags: false\u003c/code\u003e: \u003ccode\u003e\u0026lt;foo\u0026gt;\u0026lt;/foo\u0026gt;\u0026lt;br\u0026gt;\u0026lt;/br\u0026gt;\u003c/code\u003e\n\n**`example`** With \u003ccode\u003exmlMode: true\u003c/code\u003e and \u003ccode\u003eselfClosingTags: true\u003c/code\u003e: \u003ccode\u003e\u0026lt;foo/\u0026gt;\u0026lt;br/\u0026gt;\u003c/code\u003e\n\n**`example`** With \u003ccode\u003exmlMode: false\u003c/code\u003e and \u003ccode\u003eselfClosingTags: true\u003c/code\u003e: \u003ccode\u003e\u0026lt;foo\u0026gt;\u0026lt;/foo\u0026gt;\u0026lt;br /\u0026gt;\u003c/code\u003e\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 \u0026 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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheeriojs%2Fdom-serializer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcheeriojs%2Fdom-serializer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheeriojs%2Fdom-serializer/lists"}