Urara-Blog/node_modules/.pnpm-store/v3/files/3e/14badeadf767a5b87c50926d09b7297df38d5f2e1be98dca84fa06448b07c4b7662eb11f635cbf7067e8ec745c82fed6c4550d82e91135f26a232357b0f78e
2022-08-14 01:14:53 +08:00

37 lines
866 B
Text

/**
* @fileoverview
* Get the plain-text value of a hast node.
* @longdescription
* ## 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.
*/
/**
* @typedef {import('hast').Root} Root
* @typedef {import('hast').Element} Element
* @typedef {Root|Root['children'][number]} Node
*/
/**
* Get the plain-text value of a hast node.
*
* @param {Node} node
* @returns {string}
*/
export function toString(node: Node): string
export type Root = import('hast').Root
export type Element = import('hast').Element
export type Node = Root | Root['children'][number]