UNPKG

disjsx

Version:

A library for creating Discord messages in JSX

24 lines 1.25 kB
import type { ReactNode } from "react"; /** * A set of HTML-like block-level element types. * This is used by `processChildrenToString` to determine appropriate newline handling * when converting React nodes to a string representation, ensuring block elements * are typically on new lines. */ export declare const blockElementTypes: Set<string>; /** * Recursively processes React children nodes and converts them into a single string, * applying markdown-like formatting for various HTML-like elements. * * This function handles basic text, numbers, and a curated set of HTML-like tags * (e.g., h1-h3, strong, em, ul, ol, li, blockquote, code, pre, a, br, p, small). * It manages spacing and newlines, particularly differentiating between inline * and block-level elements (defined in `blockElementTypes`) to produce a * readable string output. * * @param childrenNodes The React nodes to process. * @param listIndentPrefix A string prefix used for indenting list items, accumulates with nesting. * @returns A string representation of the processed React nodes. */ export declare const processChildrenToString: (childrenNodes: ReactNode, listIndentPrefix?: string) => string; //# sourceMappingURL=processChildrenToString.d.ts.map