import { IndexerAPICommentReferenceURLVideoSchemaType, IndexerAPICommentReferenceURLImageSchemaType, IndexerAPICommentReferenceURLFileSchemaType, IndexerAPICommentReferenceSchemaType, IndexerAPICommentReferencesSchemaType } from '@ecp.eth/sdk/indexer'; declare const KEEP_ORIGINAL_TEXT: unique symbol; type AllowedMediaReferences = IndexerAPICommentReferenceURLVideoSchemaType | IndexerAPICommentReferenceURLImageSchemaType | IndexerAPICommentReferenceURLFileSchemaType; type ReferenceRenderer = { length: (reference: TReference) => number; render: (reference: TReference) => TNode | typeof KEEP_ORIGINAL_TEXT; }; type ReferenceRenderers = { [K in IndexerAPICommentReferenceSchemaType["type"]]: ReferenceRenderer>; }; type ElementRenderers = { paragraph: (children: TNode[]) => TNode; text: (text: string) => TNode; url: (url: string) => TNode; }; type RenderOptions = { content: string; references: IndexerAPICommentReferencesSchemaType; maxLength?: number; maxLines?: number; /** * Custom renderers for specific reference types * * if provided it will use only the provided renderers */ renderers: Partial>; elementRenderers: ElementRenderers; /** * Custom function to process media references, returned media references * * @param references - The references to process * @returns The processed media references and the content without the media references */ processMediaReferences?: (content: string, references: IndexerAPICommentReferenceSchemaType[]) => { mediaReferences: TAllowedReferences[]; content: string; }; }; /** * Result type for render */ type RenderResult = { result: TNode[]; mediaReferences: TAllowedReferences[]; isTruncated: boolean; }; /** * Renders the content and references as an array of nodes. * * @param options - The options for the renderer * @returns The rendered node, media references and if the content was truncated */ declare function render({ content, references, maxLength, maxLines, renderers, elementRenderers, processMediaReferences, }: RenderOptions): RenderResult; /** * Reference renderers for React */ declare const reactReferenceRenderers: Partial>; /** * Helper function to hash a string * @param str - The string to hash * @returns The hashed string */ declare function hashKey(str: string): string; /** * Helper function to generate a key for a React element * @param element - The element to generate a key for * @returns The key for the element */ declare function generateKey(element: React.ReactElement> | string): undefined | string; /** * Result type for renderToReact */ type RenderToReactResult = Omit, "result"> & { element: React.ReactElement; }; /** * Renders the content to a React element * * @param options - The options for the renderer * @returns The rendered element, media references and if the content was truncated */ declare function renderToReact(options: Omit, "renderers" | "elementRenderers" | "processMediaReferences">): RenderToReactResult; /** * Reference renderers for markdown */ declare const markdownReferenceRenderers: Partial>; /** * Element renderers for markdown */ declare const markdownElementRenderers: ElementRenderers; type RenderToMarkdownResult = Omit, "result"> & { result: string; }; /** * Renders the content to a markdown string * * @param options - The options for the renderer * @returns The rendered markdown string, media references and if the content was truncated */ declare function renderToMarkdown(options: Omit, "renderers" | "elementRenderers" | "processMediaReferences"> & { elementRenderers?: Partial["elementRenderers"]>; }): RenderToMarkdownResult; type ProcessMediaReferencesResult = { mediaReferences: AllowedMediaReferences[]; /** * Content without media references */ content: string; }; /** * Helper function to process media references from the content. * * The resultig content will be stripped of any media references that are at the end of the content. * * @param content - The content to process * @param references - The references to process * @returns The processed content and media references */ declare function processMediaReferences(content: string, references: IndexerAPICommentReferenceSchemaType[]): ProcessMediaReferencesResult; export { type AllowedMediaReferences, type ElementRenderers, type ProcessMediaReferencesResult, type ReferenceRenderer, type ReferenceRenderers, type RenderOptions, type RenderResult, type RenderToMarkdownResult, type RenderToReactResult, generateKey, hashKey, markdownElementRenderers, markdownReferenceRenderers, processMediaReferences, reactReferenceRenderers, render, renderToMarkdown, renderToReact };