index.d.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import type { Node } from "domhandler";
  2. export interface DomSerializerOptions {
  3. /**
  4. * Print an empty attribute's value.
  5. *
  6. * @default xmlMode
  7. * @example With <code>emptyAttrs: false</code>: <code>&lt;input checked&gt;</code>
  8. * @example With <code>emptyAttrs: true</code>: <code>&lt;input checked=""&gt;</code>
  9. */
  10. emptyAttrs?: boolean;
  11. /**
  12. * Print self-closing tags for tags without contents.
  13. *
  14. * @default xmlMode
  15. * @example With <code>selfClosingTags: false</code>: <code>&lt;foo&gt;&lt;/foo&gt;</code>
  16. * @example With <code>selfClosingTags: true</code>: <code>&lt;foo /&gt;</code>
  17. */
  18. selfClosingTags?: boolean;
  19. /**
  20. * Treat the input as an XML document; enables the `emptyAttrs` and `selfClosingTags` options.
  21. *
  22. * If the value is `"foreign"`, it will try to correct mixed-case attribute names.
  23. *
  24. * @default false
  25. */
  26. xmlMode?: boolean | "foreign";
  27. /**
  28. * Encode characters that are either reserved in HTML or XML, or are outside of the ASCII range.
  29. *
  30. * @default true
  31. */
  32. decodeEntities?: boolean;
  33. }
  34. /**
  35. * Renders a DOM node or an array of DOM nodes to a string.
  36. *
  37. * Can be thought of as the equivalent of the `outerHTML` of the passed node(s).
  38. *
  39. * @param node Node to be rendered.
  40. * @param options Changes serialization behavior
  41. */
  42. export default function render(node: Node | ArrayLike<Node>, options?: DomSerializerOptions): string;
  43. //# sourceMappingURL=index.d.ts.map