# hast-util-to-string [![Build][build-badge]][build] [![Coverage][coverage-badge]][coverage] [![Downloads][downloads-badge]][downloads] [![Size][size-badge]][size] [![Sponsors][sponsors-badge]][collective] [![Backers][backers-badge]][collective] [![Chat][chat-badge]][chat] Get the plain-text value of a hast node. ## Install This package is [ESM only][esm]: Node 12+ is needed to use it and it must be `imported`ed instead of `required`d. [npm][]: ```sh npm install hast-util-to-string ``` This package exports the following identifiers: `toString`. There is no default export. ## Use ```js import {h} from 'hastscript' import {toString} from 'hast-util-to-string' toString(h('p', 'Alpha')) //=> 'Alpha' toString(h('div', [h('b', 'Bold'), ' and ', h('i', 'italic'), '.'])) //=> 'Bold and italic.' ``` ## API ### `toString(node)` Transform a node to a string. ## Contribute See [`contributing.md`][contributing] in [`rehypejs/.github`][health] for ways to get started. See [`support.md`][support] for ways to get help. This project has a [code of conduct][coc]. By interacting with this repository, organization, or community you agree to abide by its terms. ## License [MIT][license] © [Titus Wormer][author] [build-badge]: https://github.com/rehypejs/rehype-minify/workflows/main/badge.svg [build]: https://github.com/rehypejs/rehype-minify/actions [coverage-badge]: https://img.shields.io/codecov/c/github/rehypejs/rehype-minify.svg [coverage]: https://codecov.io/github/rehypejs/rehype-minify [downloads-badge]: https://img.shields.io/npm/dm/hast-util-to-string.svg [downloads]: https://www.npmjs.com/package/hast-util-to-string [size-badge]: https://img.shields.io/bundlephobia/minzip/hast-util-to-string.svg [size]: https://bundlephobia.com/result?p=hast-util-to-string [sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg [backers-badge]: https://opencollective.com/unified/backers/badge.svg [collective]: https://opencollective.com/unified [chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg [chat]: https://github.com/rehypejs/rehype/discussions [esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c [npm]: https://docs.npmjs.com/cli/install [health]: https://github.com/rehypejs/.github [contributing]: https://github.com/rehypejs/.github/blob/main/contributing.md [support]: https://github.com/rehypejs/.github/blob/main/support.md [coc]: https://github.com/rehypejs/.github/blob/main/code-of-conduct.md [license]: https://github.com/rehypejs/rehype-minify/blob/main/license [author]: https://wooorm.com