{"name":"hast-util-to-parse5","version":"2.2.0","description":"Transform HAST to Parse5’s AST","license":"MIT","keywords":["hast","parse5","ast","utility"],"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"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"http://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"http://wooorm.com"}],"files":["index.js"],"dependencies":{"hast-to-hyperscript":"^3.0.0","mapz":"^1.0.0","web-namespaces":"^1.0.0","xtend":"^4.0.1","zwitch":"^1.0.0"},"devDependencies":{"browserify":"^14.0.0","esmangle":"^1.0.1","nyc":"^11.0.0","parse5":"^3.0.0","remark-cli":"^4.0.0","remark-preset-wooorm":"^3.0.0","tape":"^4.0.0","xo":"^0.18.0"},"scripts":{"build-md":"remark . --quiet --frail --output","build-bundle":"browserify index.js --bare -s hastUtilToParse5 > hast-util-to-parse5.js","build-mangle":"esmangle hast-util-to-parse5.js > hast-util-to-parse5.min.js","build":"npm run build-md && npm run build-bundle && npm run build-mangle","lint":"xo","test-api":"node test","test-coverage":"nyc --reporter lcov tape test","test":"npm run build && npm run lint && npm run test-coverage"},"xo":{"space":true,"esnext":false,"rules":{"guard-for-in":"off"},"ignores":["hast-util-to-parse5.js"]},"nyc":{"check-coverage":true,"lines":100,"functions":100,"branches":100},"remarkConfig":{"plugins":["preset-wooorm"]},"gitHead":"881a64dccac652a792b0bce52f73d023a1a37676","homepage":"https://github.com/syntax-tree/hast-util-to-parse5#readme","_id":"hast-util-to-parse5@2.2.0","_npmVersion":"5.0.0","_nodeVersion":"8.0.0","_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"dist":{"integrity":"sha512-Eg1mrf0VTT/PipFN5z1+mVi+4GNhinKk/i/HKeX1h17IYiMdm3G8vgA0FU04XCuD1cWV58f5zziFKcBkr+WuKw==","shasum":"48c8f7f783020c04c3625db06109d02017033cbc","tarball":"http://registry-npm.ywwl.com/hast-util-to-parse5/download/hast-util-to-parse5-2.2.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQClTYfcM7mD3BteCuDdC3wixeqNkXSkN/jiXpPM7kO/PAIhAKfkAhR6x1dhbWUg+eEjygLMPkqRugwlos126I+UFH4h"}],"size":3484,"noattachment":false,"key":"/hast-util-to-parse5/-/hast-util-to-parse5-2.2.0.tgz"},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hast-util-to-parse5-2.2.0.tgz_1500913398813_0.28654744126833975"},"directories":{},"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":1500913399733,"_cnpm_publish_time":1500913399733,"dist-tags":{"latest":"8.0.1"}}