hast-util-to-string

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

Usage no npm install needed!

<script type="module">
  import hastUtilToString from 'https://cdn.skypack.dev/hast-util-to-string';
</script>

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