hast-util-to-string

hast utility to get the plain-text value of a node

Stats

StarsIssuesVersionUpdatedCreatedSize
hast-util-to-string
5232.0.06 months ago5 years agoMinified + gzip package size for hast-util-to-string in KB

Readme

hast-util-to-string

Build Coverage Downloads Size Sponsors Backers Chat

Get the plain-text value of a hast node.

Install

This package is ESM only: Node 12+ is needed to use it and it must be importeded instead of requiredd.

npm:

npm install hast-util-to-string

This package exports the following identifiers: toString. There is no default export.

Use

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 in rehypejs/.github for ways to get started. See support.md for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MIT © Titus Wormer

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.