index.d.ts 833 B

12345678910111213141516171819202122232425262728293031
  1. /**
  2. * Get the text content of a node or list of nodes.
  3. *
  4. * Prefers the node’s plain-text fields, otherwise serializes its children,
  5. * and if the given value is an array, serialize the nodes in it.
  6. *
  7. * @param {unknown} [value]
  8. * Thing to serialize, typically `Node`.
  9. * @param {Options | null | undefined} [options]
  10. * Configuration (optional).
  11. * @returns {string}
  12. * Serialized `value`.
  13. */
  14. export function toString(
  15. value?: unknown,
  16. options?: Options | null | undefined
  17. ): string
  18. export type Nodes = import('mdast').Nodes
  19. /**
  20. * Configuration (optional).
  21. */
  22. export type Options = {
  23. /**
  24. * Whether to use `alt` for `image`s (default: `true`).
  25. */
  26. includeImageAlt?: boolean | null | undefined
  27. /**
  28. * Whether to use `value` of HTML (default: `true`).
  29. */
  30. includeHtml?: boolean | null | undefined
  31. }