({
channelNames,
className,
content,
customEmoji,
imetaByUrl,
interactive = true,
agentMentionPubkeysByName,
mediaInset = false,
mentionNames,
mentionPubkeysByName,
searchQuery,
videoReviewContext,
}: MarkdownProps)
| 1932 | } |
| 1933 | |
| 1934 | function MarkdownInner({ |
| 1935 | channelNames, |
| 1936 | className, |
| 1937 | content, |
| 1938 | customEmoji, |
| 1939 | imetaByUrl, |
| 1940 | interactive = true, |
| 1941 | agentMentionPubkeysByName, |
| 1942 | mediaInset = false, |
| 1943 | mentionNames, |
| 1944 | mentionPubkeysByName, |
| 1945 | searchQuery, |
| 1946 | videoReviewContext, |
| 1947 | }: MarkdownProps) { |
| 1948 | const { channels: rawChannels } = useChannelNavigation(); |
| 1949 | const channels = useStableArray(rawChannels); |
| 1950 | const { goChannel } = useAppNavigation(); |
| 1951 | const onOpenChannel = React.useCallback( |
| 1952 | (channelId: string) => { |
| 1953 | void goChannel(channelId); |
| 1954 | }, |
| 1955 | [goChannel], |
| 1956 | ); |
| 1957 | const onOpenMessageLink = React.useCallback( |
| 1958 | (link: ParsedMessageLink) => { |
| 1959 | // Always route through `goChannel` with `messageId` set: the channel |
| 1960 | // route already handles scroll-into-view + highlight via |
| 1961 | // `useAnchoredScroll` + `getEventById` backfill, and works for |
| 1962 | // both stream-message replies and forum threads. Detecting "the thread |
| 1963 | // root is a forum post" up front would require an event lookup we don't |
| 1964 | // currently have synchronously; the brief explicitly allows skipping |
| 1965 | // that detection and falling through. |
| 1966 | void goChannel(link.channelId, { |
| 1967 | messageId: link.messageId, |
| 1968 | threadRootId: link.threadRootId, |
| 1969 | }); |
| 1970 | }, |
| 1971 | [goChannel], |
| 1972 | ); |
| 1973 | const linkPreviews = React.useMemo( |
| 1974 | () => (interactive ? extractSupportedLinkPreviews(content) : []), |
| 1975 | [content, interactive], |
| 1976 | ); |
| 1977 | const runtimeRef = useLatestRef<MarkdownRuntime>({ |
| 1978 | agentMentionPubkeysByName, |
| 1979 | channels, |
| 1980 | imetaByUrl, |
| 1981 | mentionPubkeysByName, |
| 1982 | onOpenChannel, |
| 1983 | onOpenMessageLink, |
| 1984 | }); |
| 1985 | |
| 1986 | const components = React.useMemo( |
| 1987 | () => createMarkdownComponents(runtimeRef, interactive, mediaInset), |
| 1988 | [runtimeRef, interactive, mediaInset], |
| 1989 | ); |
| 1990 | |
| 1991 | // biome-ignore lint/suspicious/noExplicitAny: PluggableList type not directly importable |
nothing calls this directly
no test coverage detected