{"name":"hast-util-to-parse5","version":"8.0.1","description":"hast utility to transform to a `parse5` AST","license":"MIT","keywords":["unist","hast","hast-util","util","utility","html","parse5","ast","tree"],"repository":{"type":"git","url":"git+https://github.com/syntax-tree/hast-util-to-parse5.git"},"bugs":{"url":"https://github.com/syntax-tree/hast-util-to-parse5/issues"},"funding":{"type":"opencollective","url":"https://opencollective.com/unified"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"}],"sideEffects":false,"type":"module","exports":"./index.js","dependencies":{"@types/hast":"^3.0.0","comma-separated-tokens":"^2.0.0","devlop":"^1.0.0","property-information":"^7.0.0","space-separated-tokens":"^2.0.0","web-namespaces":"^2.0.0","zwitch":"^2.0.0"},"devDependencies":{"@types/json-stringify-safe":"^5.0.0","@types/node":"^24.0.0","c8":"^10.0.0","json-stringify-safe":"^5.0.0","parse5":"^8.0.0","prettier":"^3.0.0","remark-cli":"^12.0.0","remark-preset-wooorm":"^10.0.0","type-coverage":"^2.0.0","typescript":"^5.0.0","xo":"^0.55.0"},"scripts":{"prepack":"npm run build && npm run format","build":"tsc --build --clean && tsc --build && type-coverage","format":"remark . -qfo && prettier . -w --log-level warn && xo --fix","test-api":"node --conditions development test.js","test-coverage":"c8 --100 --reporter lcov npm run test-api","test":"npm run build && npm run format && npm run test-coverage"},"prettier":{"bracketSpacing":false,"semi":false,"singleQuote":true,"tabWidth":2,"trailingComma":"none","useTabs":false},"remarkConfig":{"plugins":["remark-preset-wooorm"]},"typeCoverage":{"atLeast":100,"detail":true,"ignoreCatch":true,"strict":true},"xo":{"prettier":true},"gitHead":"cba581a04ae64a103c53cf651db790cf495ba4d4","types":"./index.d.ts","_id":"hast-util-to-parse5@8.0.1","homepage":"https://github.com/syntax-tree/hast-util-to-parse5#readme","_nodeVersion":"23.9.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-MlWT6Pjt4CG9lFCjiz4BH7l9wmrMkfkJYCxFwKQic8+RTZgWPuWxwAfjJElsXkex7DJjfSJsQIt931ilUgmwdA==","shasum":"95aa391cc0514b4951418d01c883d1038af42f5d","tarball":"http://registry-npm.ywwl.com/hast-util-to-parse5/download/hast-util-to-parse5-8.0.1.tgz","fileCount":9,"unpackedSize":20064,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDjd1d89D7ZYulQaWgdNyn6teEeheYhVATwNccvfZfCLAIhANo/mu94nAo89hnBM++5dUqk3ULdlDAVW3bf/wqRgLMt"}],"size":6716,"noattachment":false,"key":"/hast-util-to-parse5/-/hast-util-to-parse5-8.0.1.tgz"},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"},{"name":"kmck","email":"keith@mcknig.ht"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/hast-util-to-parse5_8.0.1_1764866070771_0.2638334038650325"},"_hasShrinkwrap":false,"readme":"# hast-util-to-parse5\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n[![Sponsors][sponsors-badge]][collective]\n[![Backers][backers-badge]][collective]\n[![Chat][chat-badge]][chat]\n\n[hast][] utility to transform to a [`parse5`][parse5] [AST][parse5-node].\n\n## Contents\n\n* [What is this?](#what-is-this)\n* [When should I use this?](#when-should-i-use-this)\n* [Install](#install)\n* [Use](#use)\n* [API](#api)\n  * [`toParse5(tree[, options])`](#toparse5tree-options)\n  * [`Options`](#options)\n  * [`Space`](#space)\n* [Types](#types)\n* [Compatibility](#compatibility)\n* [Security](#security)\n* [Related](#related)\n* [Contribute](#contribute)\n* [License](#license)\n\n## What is this?\n\nThis package is a utility that can turn a hast syntax tree into a `parse5` AST.\nWhy not use a Parse5 adapter, you might ask?\nWell, because it’s more code weight to use adapters, and more fragile.\n\n## When should I use this?\n\nThis package is useful when working with `parse5`, and for some reason want to\ngenerate its AST again.\nThe inverse utility, [`hast-util-from-parse5`][hast-util-from-parse5], is more\nlikely what you want.\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install hast-util-to-parse5\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {toParse5} from 'https://esm.sh/hast-util-to-parse5@8'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import {toParse5} from 'https://esm.sh/hast-util-to-parse5@8?bundle'\n</script>\n```\n\n## Use\n\n```js\nimport {toParse5} from 'hast-util-to-parse5'\n\nconst tree = toParse5({\n  type: 'element',\n  tagName: 'h1',\n  properties: {},\n  children: [{type: 'text', value: 'World!'}]\n})\n\nconsole.log(tree)\n```\n\nYields:\n\n```js\n{ nodeName: 'h1',\n  tagName: 'h1',\n  attrs: [],\n  namespaceURI: 'http://www.w3.org/1999/xhtml',\n  childNodes: [ { nodeName: '#text', value: 'World!', parentNode: [Circular] } ] }\n```\n\n## API\n\nThis package exports the identifier [`toParse5`][api-to-parse5].\nThere is no default export.\n\n### `toParse5(tree[, options])`\n\nTransform a hast tree to a `parse5` AST.\n\n###### Parameters\n\n* `tree` ([`HastNode`][hast-node])\n  — tree to transform\n* `options` ([`Options`][api-options], optional)\n  — configuration\n\n###### Returns\n\n`parse5` node ([`Parse5Node`][parse5-node]).\n\n### `Options`\n\nConfiguration (TypeScript type).\n\n###### Fields\n\n* `space` ([`Space`][api-space], optional)\n  — which space the document is in\n\n### `Space`\n\nNamespace (TypeScript type).\n\n###### Type\n\n```ts\ntype Space = 'html' | 'svg'\n```\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the additional types [`Options`][api-options] and\n[`Space`][api-space].\n\n## Compatibility\n\nProjects maintained by the unified collective are compatible with maintained\nversions of Node.js.\n\nWhen we cut a new major release, we drop support for unmaintained versions of\nNode.\nThis means we try to keep the current release line, `hast-util-to-parse5@^8`,\ncompatible with Node.js 16.\n\n## Security\n\nUse of `hast-util-to-parse5` can open you up to a\n[cross-site scripting (XSS)][xss] attack if the hast tree is unsafe.\n\n## Related\n\n* [`hast-util-from-parse5`](https://github.com/syntax-tree/hast-util-from-parse5)\n  — transform from Parse5’s AST to hast\n* [`hast-util-to-nlcst`](https://github.com/syntax-tree/hast-util-to-nlcst)\n  — transform hast to nlcst\n* [`hast-util-to-mdast`](https://github.com/syntax-tree/hast-util-to-mdast)\n  — transform hast to mdast\n* [`hast-util-to-xast`](https://github.com/syntax-tree/hast-util-to-xast)\n  — transform hast to xast\n* [`mdast-util-to-hast`](https://github.com/syntax-tree/mdast-util-to-hast)\n  — transform mdast to hast\n* [`mdast-util-to-nlcst`](https://github.com/syntax-tree/mdast-util-to-nlcst)\n  — transform mdast to nlcst\n\n## Contribute\n\nSee [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for\nways to get started.\nSee [`support.md`][support] for ways to get help.\n\nThis project has a [code of conduct][coc].\nBy interacting with this repository, organization, or community you agree to\nabide by its terms.\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n<!-- Definitions -->\n\n[build-badge]: https://github.com/syntax-tree/hast-util-to-parse5/workflows/main/badge.svg\n\n[build]: https://github.com/syntax-tree/hast-util-to-parse5/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/hast-util-to-parse5.svg\n\n[coverage]: https://codecov.io/github/syntax-tree/hast-util-to-parse5\n\n[downloads-badge]: https://img.shields.io/npm/dm/hast-util-to-parse5.svg\n\n[downloads]: https://www.npmjs.com/package/hast-util-to-parse5\n\n[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=hast-util-to-parse5\n\n[size]: https://bundlejs.com/?q=hast-util-to-parse5\n\n[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[collective]: https://opencollective.com/unified\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[chat]: https://github.com/syntax-tree/unist/discussions\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esmsh]: https://esm.sh\n\n[typescript]: https://www.typescriptlang.org\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[health]: https://github.com/syntax-tree/.github\n\n[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md\n\n[support]: https://github.com/syntax-tree/.github/blob/main/support.md\n\n[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md\n\n[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting\n\n[hast]: https://github.com/syntax-tree/hast\n\n[hast-node]: https://github.com/syntax-tree/hast#nodes\n\n[parse5]: https://github.com/inikulin/parse5\n\n[parse5-node]: https://github.com/inikulin/parse5/blob/master/packages/parse5/lib/tree-adapters/default.ts\n\n[hast-util-from-parse5]: https://github.com/syntax-tree/hast-util-from-parse5\n\n[api-to-parse5]: #toparse5tree-options\n\n[api-options]: #options\n\n[api-space]: #space\n","publish_time":1764866070916,"_cnpm_publish_time":1764866070916,"dist-tags":{"latest":"8.0.1"}}