import type { LocalMessage } from 'stream-chat'; import type { PluggableList } from 'unified'; import type { ChatContextValue } from '../../context/ChatContext'; import type { TranslationContextValue } from '../../context/TranslationContext'; import type { ChannelPreviewMessageType } from './hooks/useLatestMessagePreview'; /** Remark plugins of the latest-message preview, shared by its markdown and plain-text forms. */ export declare const previewRemarkPlugins: PluggableList; /** * How plain text is read: * - `display`: the visible one-line preview. Lists keep their markers (`-`, `1.`, `[x]`) and tables * their `|` cell separators, so the reader can tell what the message contains. * - `announcement`: text read by screen readers. Only the words are kept, plus the numbers of * ordered list items. */ export type PlainTextFormat = 'announcement' | 'display'; /** * Strips markdown syntax from message text with the preview's remark plugins, in the given * {@link PlainTextFormat}. Blocks such as paragraphs and list items are joined with a space, and * line breaks read as spaces. When processing throws or yields nothing, returns the raw text on * one line. */ export declare const markdownToPlainText: (text: string, format: PlainTextFormat) => string; /** * {@link markdownToPlainText} in the `announcement` format, for text read by screen readers: * `**done**` reads as `done`, `[docs](https://…)` as `docs`, and list bullets, task checkboxes and * table separators are dropped. */ export declare const stripMarkdownToText: (text: string) => string; export type GetPlainPreviewTextParams = { /** `display` for the visible preview, `announcement` for text read by screen readers. */ format: PlainTextFormat; /** AI-generated text is returned verbatim, as the row labels read it. */ isMessageAIGenerated?: ChatContextValue['isMessageAIGenerated']; /** Message the preview was built from. */ latestMessage: LocalMessage | undefined; /** Preview text from `useLatestMessagePreview`. */ text: string; /** Preview type from `useLatestMessagePreview`. */ type: ChannelPreviewMessageType; userLanguage: TranslationContextValue['userLanguage']; }; /** * The `useLatestMessagePreview` text as plain text in the given format. When the preview starts * with the message text, that part loses its markdown syntax and the rest (an attachment's * duration) stays. Labels, attachment titles, system strings and AI-generated text are returned as * they are. */ export declare const getPlainPreviewText: ({ format, isMessageAIGenerated, latestMessage, text, type, userLanguage, }: GetPlainPreviewTextParams) => string; //# sourceMappingURL=previewText.d.ts.map